[library-web/new-website-style] [mallard] expand doc_figures variable



commit dc70761768fcd7426a680b488ca42ee94d19877f
Author: Frédéric Péters <fpeters 0d be>
Date:   Sun Mar 27 21:08:13 2011 +0530

    [mallard] expand doc_figures variable

 src/modtypes/mallard.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/modtypes/mallard.py b/src/modtypes/mallard.py
index 1ba348c..96fc21e 100644
--- a/src/modtypes/mallard.py
+++ b/src/modtypes/mallard.py
@@ -164,6 +164,19 @@ class MallardModule(DocModule):
     def __str__(self):
         return 'mallard module at %s' % self.dirname
 
+    def expand_doc_figures(self, doc_figures):
+        for figure in doc_figures[:]:
+            if figure == '$(NULL)': # common idiom
+                doc_figures.remove(figure)
+                continue
+
+            if figure.startswith('$'): # $(blah)
+                doc_figures.remove(figure)
+                var_name = figure[2:-1]
+                var_content = re.findall('%s\s+=\s+(.*)' % var_name,
+                                self.makefile_am)[0].split()
+                doc_figures.extend(var_content)
+
     def process(self):
         doc_module = self.modulename
         ext_dirname = os.path.join(app.config.private_dir, 'extracts')
@@ -185,6 +198,7 @@ class MallardModule(DocModule):
             doc_figures = re.findall('DOC_FIGURES\s+=\s+(.*)',
                     self.makefile_am)[0].split()
             figures_dirname = os.path.join(ext_dirname, self.dirname, 'C')
+            self.expand_doc_figures(doc_figures)
             for doc_figure in doc_figures:
                 if not os.path.exists(os.path.join(figures_dirname, doc_figure)):
                     logging.warning('figure (%s) listed but not present, going to autodiscover' % \



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