[library-web] [mallard] add handling of figures (GNOME bug 597334)



commit 8453c605cb84d9448868a0efefa3d09268beec45
Author: Frédéric Péters <fpeters 0d be>
Date:   Sun Oct 4 19:55:37 2009 +0200

    [mallard] add handling of figures (GNOME bug 597334)

 src/modtypes/mallard.py |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/modtypes/mallard.py b/src/modtypes/mallard.py
index e964966..38b542a 100644
--- a/src/modtypes/mallard.py
+++ b/src/modtypes/mallard.py
@@ -243,5 +243,20 @@ class MallardModule(DocModule):
                 if rc != 0:
                     logging.warn('%s failed with error %d' % (' '.join(cmd), rc))
 
+            if doc_figures:
+                # and copy images/
+                logging.debug('copying figures')
+                for doc_figure in doc_figures:
+                    src = os.path.join(lang_dirname, doc_figure)
+                    if not os.path.exists(src):
+                        # fallback to image from C locale.
+                        src = os.path.join(ext_dirname, self.dirname, 'C', doc_figure)
+                        if not os.path.exists(src):
+                            continue
+                    dst = os.path.join(web_output_dir, doc_figure + '.%s' % lang)
+                    if not os.path.exists(os.path.split(dst)[0]):
+                        os.makedirs(os.path.split(dst)[0])
+                    open(dst, 'w').write(open(src, 'r').read())
+
         self.install_version_symlinks(doc)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]