aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaire Revillet <grenoya@zarb.org>2015-04-08 21:21:29 +0200
committerClaire Revillet <grenoya@zarb.org>2015-04-08 21:21:29 +0200
commit1f5096e898cf6aea1a385e5a7dfc71c29a639e7b (patch)
treec19fe3cf855007709e798f515a23ccccc5987998
parentddc2fb8360f840ee806a6b2c0a04ad964ff98732 (diff)
downloaddoc-1f5096e898cf6aea1a385e5a7dfc71c29a639e7b.tar
doc-1f5096e898cf6aea1a385e5a7dfc71c29a639e7b.tar.gz
doc-1f5096e898cf6aea1a385e5a7dfc71c29a639e7b.tar.bz2
doc-1f5096e898cf6aea1a385e5a7dfc71c29a639e7b.tar.xz
doc-1f5096e898cf6aea1a385e5a7dfc71c29a639e7b.zip
add script to use a unique common folder for all lang. of a doc
-rw-r--r--fix_common_path.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/fix_common_path.py b/fix_common_path.py
new file mode 100644
index 00000000..20d974c4
--- /dev/null
+++ b/fix_common_path.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+""" Script to fix the path to the common files in Mageia html documentation
+
+ Usage: python3 fix_common_path.py
+
+"""
+from os import walk
+from os.path import splitext, join
+import fileinput
+
+path_to_fix = 'mcc/4/tr'
+
+# first step: let's walk along the folder
+for root, dirs, files in walk(path_to_fix):
+ # second step: identification of html files
+ for elem in files:
+ if splitext(elem)[1] == '.html':
+ # third step: replacing the path
+ with fileinput.input(files=join(root, elem), inplace=True) as f:
+ for line in f:
+ line = line.rstrip('\n')
+ line = line.replace('"../common/', '"../../common/')
+ line = line.replace('(../common/', '(../../common/')
+ # with fileinput, you need to us 'print' and not 'write' to
+ # write in the file
+ print(line)