[library-web] add tarball name to index pages (GNOME bug 670454)



commit b0373ea8cf9265edded296f67d60872ebaa3bf6f
Author: FrÃdÃric PÃters <fpeters 0d be>
Date:   Mon Apr 16 15:33:38 2012 +0200

    add tarball name to index pages (GNOME bug 670454)

 data/catalog.xml.in        |    1 +
 data/xslt/dev_indexes.xsl  |   11 +++++++++++
 data/xslt/help_indexes.xsl |   11 +++++++++++
 data/xslt/indexes.xsl      |   11 +++++++++++
 src/document.py            |    3 +++
 src/modtypes/base.py       |    2 ++
 6 files changed, 39 insertions(+), 0 deletions(-)
---
diff --git a/data/catalog.xml.in b/data/catalog.xml.in
index 5cf84e7..0a01a7f 100644
--- a/data/catalog.xml.in
+++ b/data/catalog.xml.in
@@ -105,4 +105,5 @@ find information on tools and methods to work with many GNOME desktops.
   <_msgstr msgid="nightly-documents">Nightly Generated Documents</_msgstr>
   <_msgstr msgid="deprecated-api-references">Deprecated API References</_msgstr>
   <_msgstr msgid="welcome-to-gnome-devcenter">Welcome to GNOME. Getting started is easy - install our dev tools and take a look at a tutorial.</_msgstr>
+  <_msgstr msgid="tarball-location">This documentation is generated from the following tarball:</_msgstr>
 </msgcat>
diff --git a/data/xslt/dev_indexes.xsl b/data/xslt/dev_indexes.xsl
index aae81d4..536c16f 100644
--- a/data/xslt/dev_indexes.xsl
+++ b/data/xslt/dev_indexes.xsl
@@ -407,6 +407,17 @@ doctype-system="http://www.w3.org/TR/html4/loose.dtd";>
             </div>
             </xsl:if>
 
+            <xsl:if test="@tarballname">
+            <div class="tarballname subtle_box">
+              <p>
+                <xsl:call-template name="gettext"><xsl:with-param name="lang"
+		  select="$lang"/><xsl:with-param name="msgid"
+		  select="'tarball-location'"/></xsl:call-template>
+                <xsl:value-of select="@tarballname"/>
+              </p>
+            </div>
+            </xsl:if>
+
 	    </div>
 	  </div>
 	  <div id="footer_art" class="default">Â</div>
diff --git a/data/xslt/help_indexes.xsl b/data/xslt/help_indexes.xsl
index fbfffeb..db293a7 100644
--- a/data/xslt/help_indexes.xsl
+++ b/data/xslt/help_indexes.xsl
@@ -404,6 +404,17 @@ doctype-system="http://www.w3.org/TR/html4/loose.dtd";>
             </div>
             </xsl:if>
 
+            <xsl:if test="@tarballname">
+            <div class="tarballname subtle_box">
+              <p>
+                <xsl:call-template name="gettext"><xsl:with-param name="lang"
+		  select="$lang"/><xsl:with-param name="msgid"
+		  select="'tarball-location'"/></xsl:call-template>
+                <xsl:value-of select="@tarballname"/>
+              </p>
+            </div>
+            </xsl:if>
+
 	    </div>
 	  </div>
 	  <div id="footer_art" class="default">Â</div>
diff --git a/data/xslt/indexes.xsl b/data/xslt/indexes.xsl
index 17248d7..8977b2c 100644
--- a/data/xslt/indexes.xsl
+++ b/data/xslt/indexes.xsl
@@ -404,6 +404,17 @@ doctype-system="http://www.w3.org/TR/html4/loose.dtd";>
             </div>
             </xsl:if>
 
+            <xsl:if test="@tarballname">
+            <div class="tarballname subtle_box">
+              <p>
+                <xsl:call-template name="gettext"><xsl:with-param name="lang"
+		  select="$lang"/><xsl:with-param name="msgid"
+		  select="'tarball-location'"/></xsl:call-template>
+                <xsl:value-of select="@tarballname"/>
+              </p>
+            </div>
+            </xsl:if>
+
 	    </div>
 	  </div>
 	  <div id="footer_art" class="default">Â</div>
diff --git a/src/document.py b/src/document.py
index 0be04d4..491ad9b 100644
--- a/src/document.py
+++ b/src/document.py
@@ -47,6 +47,7 @@ class Document:
     subsection = None
     weight = 0.5
     single_page_alternative = False
+    tarballname = None
 
     title = None # indexed on language, most recent version
     abstract = None # indexed on language, most recent version
@@ -79,6 +80,8 @@ class Document:
         href_language = None
         if self.module:
             doc.set('modulename', self.module)
+        if self.tarballname:
+            doc.set('tarballname', self.tarballname)
         if self.path:
             doc.set('path', self.path)
         elif self.href:
diff --git a/src/modtypes/base.py b/src/modtypes/base.py
index cba66c6..c47564e 100644
--- a/src/modtypes/base.py
+++ b/src/modtypes/base.py
@@ -45,6 +45,7 @@ class DocModule(object):
             self.dirname = tarinfo.name
         else:
             self.dirname = os.path.dirname(tarinfo.name)
+        self.tarballname = '-'.join(self.dirname.split('/')[0].split('-')[:-1])
         if makefile_am:
             self.makefile_am = makefile_am
             self.modulename = re.findall(r'(?:DOC_ID|DOC_MODULE|HELP_ID)\s?=\s?(.*)',
@@ -119,6 +120,7 @@ class DocModule(object):
             doc.channel = self.channel
             doc.languages = doc_linguas
             doc.path = self.path
+            doc.tarballname = self.tarballname
             doc._last_version = self.version
             doc.versions = [self.one_dot_version]
             app.documents.append(doc)



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