[library-web] fix generation of sitemap.xml files (GNOME bug 675979)



commit 763f38f42602de702f072b5e048799d274739aff
Author: FrÃdÃric PÃters <fpeters 0d be>
Date:   Sun Aug 12 12:05:40 2012 +0200

    fix generation of sitemap.xml files (GNOME bug 675979)

 data/xslt/sitemap.xsl |    9 ++++++---
 src/config.py         |    3 ++-
 src/defaults.lgorc    |    3 +++
 src/lgo.py            |    4 ++++
 4 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/data/xslt/sitemap.xsl b/data/xslt/sitemap.xsl
index a218649..e18c66c 100644
--- a/data/xslt/sitemap.xsl
+++ b/data/xslt/sitemap.xsl
@@ -26,12 +26,14 @@ along with libgo; if not, write to the Free Software Foundation, Inc.,
                 xsl:exclude-result-prefixes="sitemap"
                 version="1.0">
 
+  <xsl:param name="libgo.baseref" select="'http://library.gnome.org'"/>
 
   <!-- Google sitemap stuff -->
   <xsl:template match="document" mode="sitemap">
+    <xsl:message>processing <xsl:value-of select="@modulename"/></xsl:message>
     <xsl:if test="@path"> <!-- only local documents -->
       <url xmlns="http://www.google.com/schemas/sitemap/0.84";>
-        <loc>http://library.gnome.org<xsl:value-of select="@path"
+        <loc><xsl:value-of select="$libgo.baseref"/><xsl:value-of select="@path"
           />index.html.<xsl:value-of select="@lang"/></loc>
         <changefreq>daily</changefreq>
 	<priority>0.7</priority>
@@ -50,7 +52,7 @@ along with libgo; if not, write to the Free Software Foundation, Inc.,
     </xsl:param>
 
     <url xmlns="http://www.google.com/schemas/sitemap/0.84";>
-      <loc>http://library.gnome.org/<xsl:value-of select="@channel"
+      <loc><xsl:value-of select="$libgo.baseref"/>/<xsl:value-of select="@channel"
         />/<xsl:value-of select="$filename"
         />.html.<xsl:value-of select="@lang"/></loc>
       <priority>0.9</priority>
@@ -58,12 +60,13 @@ along with libgo; if not, write to the Free Software Foundation, Inc.,
     </url>
     <xsl:apply-templates select="index" mode="sitemap"/>
     <xsl:apply-templates select="section/document[ lang = $lang]" mode="sitemap"/>
+    <xsl:apply-templates select="section/section/document[ lang = $lang]" mode="sitemap"/>
   </xsl:template>
 
   <xsl:template match="home" mode="sitemap">
     <xsl:param name="lang" select="@lang"/>
     <url xmlns="http://www.google.com/schemas/sitemap/0.84";>
-      <loc>http://library.gnome.org/index.html.<xsl:value-of select="$lang"/></loc>
+      <loc><xsl:value-of select="$libgo.baseref"/>/index.html.<xsl:value-of select="$lang"/></loc>
       <priority>1.0</priority>
       <changefreq>daily</changefreq>
     </url>
diff --git a/src/config.py b/src/config.py
index 3af938f..a68a846 100644
--- a/src/config.py
+++ b/src/config.py
@@ -36,7 +36,8 @@ _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', 'indexes_xsl_file']
+            'channels', 'doc_path_template', 'indexes_xsl_file',
+            'baseref']
 
 class Config:
     def __init__(self, filename=_default_lgorc):
diff --git a/src/defaults.lgorc b/src/defaults.lgorc
index 5ba417d..3b2fe0a 100644
--- a/src/defaults.lgorc
+++ b/src/defaults.lgorc
@@ -1,5 +1,8 @@
 import os
 
+# base URL
+baseref = 'http://library.gnome.org'
+
 # local access to ftp.gnome.org
 ftp_gnome_org_local_copy = None
 
diff --git a/src/lgo.py b/src/lgo.py
index c7e90b5..5a8a646 100755
--- a/src/lgo.py
+++ b/src/lgo.py
@@ -739,6 +739,10 @@ class Lgo(App):
             cmd.insert(-2, '--param')
             cmd.insert(-2, 'libgo.dbm_support')
             cmd.insert(-2, 'true()')
+        if self.config.baseref:
+            cmd.insert(-2, '--stringparam')
+            cmd.insert(-2, 'libgo.baseref')
+            cmd.insert(-2, self.config.baseref)
 
         logging.debug('executing %s' % ' '.join(cmd))
         rc = subprocess.call(cmd)



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