[library-web] make it possible to specify a different xsl file to generate index.html files



commit f973fbd5407b07110e257d9b16c721475053383f
Author: Frédéric Péters <fpeters 0d be>
Date:   Sat Mar 19 19:46:07 2011 +0100

    make it possible to specify a different xsl file to generate index.html files

 src/app.py         |    2 +-
 src/config.py      |    2 +-
 src/defaults.lgorc |    3 +++
 src/lgo.py         |    3 ++-
 4 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/app.py b/src/app.py
index 1a3ca55..688ecc6 100644
--- a/src/app.py
+++ b/src/app.py
@@ -41,7 +41,7 @@ from config import Config
 import utils
 
 class App:
-    indexes_xsl_file = os.path.join(data_dir, 'xslt', 'indexes.xsl')
+    default_indexes_xsl_file = os.path.join(data_dir, 'xslt', 'indexes.xsl')
     javascript_dir = os.path.join(data_dir, 'js')
     skin_dir = os.path.join(data_dir, 'skin')
 
diff --git a/src/config.py b/src/config.py
index 1987a13..3af938f 100644
--- a/src/config.py
+++ b/src/config.py
@@ -36,7 +36,7 @@ _known_keys = ['ftp_gnome_org_local_copy', 'use_latest_version',
             'blacklist', 'extra_tarballs', 'symbols_dbm_filepath',
             'httxt2dbm_path', 'fast_mode', 'create_tarballs',
             'symbols_sqlite_filepath', 'nightly_tarballs_location',
-            'channels', 'doc_path_template']
+            'channels', 'doc_path_template', 'indexes_xsl_file']
 
 class Config:
     def __init__(self, filename=_default_lgorc):
diff --git a/src/defaults.lgorc b/src/defaults.lgorc
index 1b1c2b4..5ba417d 100644
--- a/src/defaults.lgorc
+++ b/src/defaults.lgorc
@@ -67,3 +67,6 @@ channels = None
 
 # document path template (known variables are %(channel)s and %(module)s
 doc_path_template = '/%(channel)s/%(module)s/'
+
+# xsl file to use to create index.html files
+indexes_xsl_file = None
diff --git a/src/lgo.py b/src/lgo.py
index 876ebad..2cfc070 100755
--- a/src/lgo.py
+++ b/src/lgo.py
@@ -709,7 +709,8 @@ class Lgo(App):
 
     def generate_html_indexes(self):
         logging.info('generating index.html files')
-        self.generate_from_indexes(self.indexes_xsl_file)
+        indexes_xsl_file = self.config.indexes_xsl_file or self.default_indexes_xsl_file
+        self.generate_from_indexes(indexes_xsl_file)
 
     def generate_robots(self):
         logging.info('generating robots.txt file')



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