aboutsummaryrefslogtreecommitdiffstats
path: root/update_manual.py
diff options
context:
space:
mode:
authorClaire Revillet <grenoya@zarb.org>2015-05-11 22:33:33 +0200
committerClaire Revillet <grenoya@zarb.org>2015-05-11 22:33:33 +0200
commit92996bed8f29772f4eeb507f3f8522816e58a884 (patch)
tree7ec87e036ca7b261ade88b2b99e77d64d7084c33 /update_manual.py
parent116f783067b95f5d61fa2edf7c03642547b4d0df (diff)
downloaddoc-92996bed8f29772f4eeb507f3f8522816e58a884.tar
doc-92996bed8f29772f4eeb507f3f8522816e58a884.tar.gz
doc-92996bed8f29772f4eeb507f3f8522816e58a884.tar.bz2
doc-92996bed8f29772f4eeb507f3f8522816e58a884.tar.xz
doc-92996bed8f29772f4eeb507f3f8522816e58a884.zip
add a fix for missing images in update script
Diffstat (limited to 'update_manual.py')
-rw-r--r--update_manual.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/update_manual.py b/update_manual.py
index ab1c4939..e664a238 100644
--- a/update_manual.py
+++ b/update_manual.py
@@ -27,6 +27,22 @@ import fileinput
+def fix_image_path(path_to_fix, images_path):
+ # 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('cco:/', images_path)
+ # with fileinput, you need to us 'print' and not 'write' to
+ # write in the file
+ print(line)
+
+
def fix_common_path(path_to_fix):
# first step: let's walk along the folder
for root, dirs, files in walk(path_to_fix):
@@ -71,6 +87,9 @@ if __name__ == "__main__":
# create the path to the manual
manual_path = join(manual_name, release, language)
+ # create the path of the EN manual for missing images
+ image_path = "../../en/content/images/"
+
# create the zip interface
archive_int = ZipFile(archive)
@@ -94,6 +113,9 @@ if __name__ == "__main__":
# ... fix the links
fix_common_path(manual_path)
+ # fix the links for missing images
+ fix_image_path(manual_path, image_path)
+
# tell git about the changes
command_add = ['git', 'add'] + files_to_add
call(command_add)