library-web r382 - in trunk: data data/skin data/xslt src



Author: fpeters
Date: Wed Feb 27 15:05:28 2008
New Revision: 382
URL: http://svn.gnome.org/viewvc/library-web?rev=382&view=rev

Log:
support to integrate release notes

Modified:
   trunk/data/overlay.xml.in
   trunk/data/skin/lgo.css
   trunk/data/xslt/db2html.xsl
   trunk/src/config.py
   trunk/src/defaults.lgorc
   trunk/src/lgo.py

Modified: trunk/data/overlay.xml.in
==============================================================================
--- trunk/data/overlay.xml.in	(original)
+++ trunk/data/overlay.xml.in	Wed Feb 27 15:05:28 2008
@@ -630,8 +630,19 @@
       </_abstract>
     </document>
 
+    <document doc_module="release-notes" channel="users">
+      <keywords>
+        <keyword>no-main-index</keyword>
+      </keywords>
+    </document>
+
   </documents>
+
   <quirks doc_module="evolution" channel="users">
     <quirk fixed-in="2.11.90">missing-id-on-top-book-element</quirk>
   </quirks>
+  <quirks doc_module="release-notes" channel="users">
+    <quirk>flat-rendering</quirk>
+    <quirk>languages-in-sidebar</quirk>
+  </quirks>
 </overlay>

Modified: trunk/data/skin/lgo.css
==============================================================================
--- trunk/data/skin/lgo.css	(original)
+++ trunk/data/skin/lgo.css	Wed Feb 27 15:05:28 2008
@@ -56,15 +56,20 @@
 	font-size: 100%;
 }
 
+ul.i18n,
 ul.toc {
 	padding: 0;
 	padding-left: 20px;
-	margin-left: 0;
+	margin: 0;
 	margin-right: 10px;
 	list-style: none;
 }
 
+ul.i18n li,
 ul.toc li {
+	margin: 0;
+	margin-left: 1em;
+	padding: 0;
 	list-style: circle;
 }
 

Modified: trunk/data/xslt/db2html.xsl
==============================================================================
--- trunk/data/xslt/db2html.xsl	(original)
+++ trunk/data/xslt/db2html.xsl	Wed Feb 27 15:05:28 2008
@@ -23,14 +23,16 @@
                 xmlns:exsl="http://exslt.org/common";
                 xmlns:set="http://exslt.org/sets";
                 xmlns="http://www.w3.org/1999/xhtml";
+		xmlns:str="http://exslt.org/strings";
                 extension-element-prefixes="exsl"
-                xsl:exclude-result-prefixes="set"
+                xsl:exclude-result-prefixes="set str"
                 version="1.0">
 
 <!-- FIXME: Shaun's styles are under LGPL, is it OK to use GPL for this? -->
 <xsl:import href="/usr/share/xml/gnome/xslt/docbook/html/db2html.xsl"/>
 <xsl:import href="heading.xsl"/>
 <xsl:import href="libgo-xref.xsl"/>
+<xsl:import href="gettext.xsl"/>
 
 <!-- output -->
 <xsl:output method="html" encoding="UTF-8" indent="yes"
@@ -41,6 +43,7 @@
 <!-- This gets set on the command line ... -->
 <xsl:param name="libgo.lang" select="''"/>
 <xsl:param name="libgo.tarball" select="false()"/>
+<xsl:param name="libgo.languages_in_sidebar" select="false()"/>
 
 <!-- Setting parameters for included stylesheets -->
 <xsl:param name="db.chunk.extension" select="concat('.html.',$libgo.lang)"/>
@@ -129,49 +132,6 @@
   <xsl:message>TTTT</xsl:message>
 </xsl:template>
 
-<!-- override db.chunk from docbook/common/db-chunk.xsl to add doctype to HTML
-     files-->
-<xsl:template name="db.chunk">
-  <xsl:param name="node" select="."/>
-  <xsl:param name="template"/>
-  <xsl:param name="href">
-    <xsl:choose>
-      <xsl:when test="$template = 'info'">
-        <xsl:value-of select="$db.chunk.info_basename"/>
-      </xsl:when>
-      <xsl:when test="set:has-same-node($node, /*)">
-        <xsl:value-of select="$db.chunk.basename"/>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:value-of select="$node/@id"/>
-      </xsl:otherwise>
-    </xsl:choose>
-    <xsl:value-of select="$db.chunk.extension"/>
-  </xsl:param>
-  <xsl:param name="depth_of_chunk">
-    <xsl:call-template name="db.chunk.depth-of-chunk">
-      <xsl:with-param name="node" select="$node"/>
-    </xsl:call-template>
-  </xsl:param>
-  <exsl:document href="{$href}"
-        method="html" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"
-        doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
-        doctype-system="http://www.w3.org/TR/html4/loose.dtd";>
-    <xsl:call-template name="db.chunk.content">
-      <xsl:with-param name="node" select="$node"/>
-      <xsl:with-param name="template" select="$template"/>
-      <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
-    </xsl:call-template>
-  </exsl:document>
-  <xsl:if test="string($template) = ''">
-    <xsl:call-template name="db.chunk.children">
-      <xsl:with-param name="node" select="$node"/>
-      <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
-    </xsl:call-template>
-  </xsl:if>
-</xsl:template>
-
-
 <!-- Process -->
 <xsl:template match="/">
   <xsl:call-template name="db.chunk">
@@ -200,4 +160,60 @@
   </xsl:if>
 </xsl:template>
 
+<xsl:template name="db2html.sidenav">
+  <xsl:param name="node" select="."/>
+  <xsl:param name="template"/>
+  <div class="sidenav">
+    <xsl:call-template name="db2html.autotoc">
+      <xsl:with-param name="node" select="/"/>
+      <xsl:with-param name="show_info" select="$db.chunk.info_chunk"/>
+      <xsl:with-param name="is_info" select="$template = 'info'"/>
+      <xsl:with-param name="selected" select="$node"/>
+      <xsl:with-param name="divisions" select="/*"/>
+      <xsl:with-param name="toc_depth" select="$db.chunk.max_depth + 1"/>
+      <xsl:with-param name="labels" select="false()"/>
+      <xsl:with-param name="titleabbrev" select="true()"/>
+    </xsl:call-template>
+    <xsl:if test="$libgo.languages_in_sidebar">
+      <h4>
+        <xsl:call-template name="gettext"><xsl:with-param name="lang"
+        select="libgo.lang"/><xsl:with-param name="msgid"
+        select="'langinfo'"/></xsl:call-template>
+      </h4>
+      <ul class="i18n">
+      <xsl:for-each select="str:split($libgo.languages_in_sidebar, ',')">
+        <li><a href="index.html.{node()}">
+          <xsl:call-template name="language-label">
+            <xsl:with-param name="lang" select="."/>
+          </xsl:call-template>
+          </a>
+          <xsl:text> </xsl:text>
+          <span class="lang-code">(<xsl:value-of select="."/>)</span>
+        </li>
+      </xsl:for-each>
+      </ul>
+    </xsl:if>
+  </div>
+</xsl:template>
+
+  <xsl:template name="language-label">
+    <xsl:param name="lang"/>
+    <xsl:choose>
+      <xsl:when test="document('../languages.xml')//lang[ code = $lang]">
+        <xsl:value-of select="document('../languages.xml')//lang[ code =
+        $lang]"/>
+      </xsl:when>
+      <xsl:when test="document('../languages.xml')//lang[substring(@code, 1, 2) = $lang]">
+        <xsl:value-of
+        select="document('../languages.xml')//lang[substring(@code, 1, 2) =
+        $lang]"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$lang"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+
 </xsl:stylesheet>

Modified: trunk/src/config.py
==============================================================================
--- trunk/src/config.py	(original)
+++ trunk/src/config.py	Wed Feb 27 15:05:28 2008
@@ -31,7 +31,7 @@
             'version_min', 'version_max', 'modules', 'languages',
             'blacklist', 'extra_tarballs', 'symbols_dbm_filepath',
             'httxt2dbm_path', 'fast_mode', 'create_tarballs',
-            'symbols_sqlite_filepath']
+            'symbols_sqlite_filepath', 'always_extract_and_rebuild']
 
 class Config:
     def __init__(self, filename=_default_lgorc):

Modified: trunk/src/defaults.lgorc
==============================================================================
--- trunk/src/defaults.lgorc	(original)
+++ trunk/src/defaults.lgorc	Wed Feb 27 15:05:28 2008
@@ -54,3 +54,6 @@
 
 # also create tarballs with HTML files for download
 create_tarballs = True
+
+# list of tarballs to always rebuild
+always_extract_and_rebuild = ['release-notes']

Modified: trunk/src/lgo.py
==============================================================================
--- trunk/src/lgo.py	(original)
+++ trunk/src/lgo.py	Wed Feb 27 15:05:28 2008
@@ -77,7 +77,10 @@
     return re.match('\d+\.\d+', v) is not None
 
 def download(href):
-    filename = '/'.join(urllib2.urlparse.urlparse(href)[1:3])
+    parsed_url = urllib2.urlparse.urlparse(href)
+    if parsed_url[0] == 'file':
+        return parsed_url[2]
+    filename = '/'.join(parsed_url[1:3])
     cache_filename = os.path.join(app.config.download_cache_dir, filename)
     cache_dir = os.path.split(cache_filename)[0]
     if not os.path.exists(cache_dir):
@@ -370,14 +373,21 @@
         if not os.path.exists(ext_dirname):
             os.makedirs(ext_dirname)
 
-        if not os.path.exists(os.path.join(ext_dirname, self.dirname)):
+        base_tarball_name = os.path.basename(self.filename).rsplit('-', 1)[0]
+        if base_tarball_name in app.config.always_extract_and_rebuild or \
+                os.path.basename(self.filename) in app.config.always_extract_and_rebuild:
+            always_extract = True
+        else:
+            always_extract = False
+
+        if always_extract or not os.path.exists(os.path.join(ext_dirname, self.dirname)):
             logging.debug('extracting %s' % self.dirname)
             tar = tarfile.open(self.filename, 'r')
             for tarinfo in tar.getmembers():
                 if not os.path.split(tarinfo.name)[0].startswith(self.dirname):
                     continue
                 dest = os.path.join(ext_dirname, tarinfo.name)
-                if os.path.exists(dest):
+                if os.path.exists(dest) and not always_extract:
                     continue
                 if tarinfo.isdir() and not os.path.exists(dest):
                     os.makedirs(dest)
@@ -767,6 +777,13 @@
             tarball_filepath = os.path.join(app.config.output_dir, self.channel,
                     self.modulename, tarball_name)
 
+        base_tarball_name = os.path.basename(self.filename).rsplit('-', 1)[0]
+        if base_tarball_name in app.config.always_extract_and_rebuild or \
+                os.path.basename(self.filename) in app.config.always_extract_and_rebuild:
+            always_rebuild = True
+        else:
+            always_rebuild = False
+
         for lang in doc.languages:
             if lang == 'en':
                 lang_dirname = os.path.join(ext_dirname, self.dirname, 'C')
@@ -781,7 +798,8 @@
 
             xml_index_file = os.path.join(web_output_dir, 'index.xml.%s' % lang)
             skip_html_files = False
-            if not app.rebuild_all and (app.rebuild_language is None or
+            if not app.rebuild_all and not always_rebuild and (
+                    app.rebuild_language is None or
                     lang != app.rebuild_language) and os.path.exists(xml_index_file):
                 mtime = os.stat(xml_index_file)[stat.ST_MTIME]
                 if mtime > max(self.mtime_tarball, self.mtime_xslt_files):
@@ -811,6 +829,14 @@
                         '--stringparam', 'libgo.lang', lang,
                         '--stringparam', 'libgo.channel', self.channel,
                         self.db2html_xsl_file, xml_file]
+                if 'flat-rendering' in quirks:
+                    cmd.insert(5, '--stringparam')
+                    cmd.insert(6, 'db.chunk.max_depth')
+                    cmd.insert(7, '0')
+                if 'languages-in-sidebar' in quirks:
+                    cmd.insert(5, '--stringparam')
+                    cmd.insert(6, 'libgo.languages_in_sidebar')
+                    cmd.insert(7, ','.join(sorted(doc.languages)))
                 logging.debug('executing %s' % ' '.join(cmd))
                 rc = subprocess.call(cmd)
                 if rc != 0:
@@ -843,7 +869,7 @@
                 if os.path.exists(os.path.join(lang_dirname, 'figures')):
                     images_to_copy = [os.path.join('figures', x) for x in \
                             os.listdir(os.path.join(lang_dirname, 'figures')) \
-                            if x.endswith('.png')]
+                            if os.path.splitext(x)[1] in ('.png', '.jpg', '.jpeg')]
                 else:
                     images_to_copy = []
             else:
@@ -1596,6 +1622,11 @@
         else:
             stamp_file = None
 
+        base_tarball_name = os.path.basename(filename).rsplit('-', 1)[0]
+        if base_tarball_name in self.config.always_extract_and_rebuild or \
+                os.path.basename(filename) in self.config.always_extract_and_rebuild:
+            stamp_file = None
+
         if stamp_file and os.path.exists(stamp_file) and not os.path.exists(ext_dirname):
             # file was extracted once, and no doc module were found inside
             return []
@@ -1605,19 +1636,17 @@
             tar = tarfile.open(filename, 'r')
 
         doc_version = os.path.splitext(tar.name)[0].split('-')[-1]
-
-        base_tarball_name = os.path.basename(filename).rsplit('-', 1)[0]
         more_tarball_docs = self.overlay.more_tarball_docs.get(
                 base_tarball_name, [])[:]
 
+        regex_gdu = re.compile(r'include.*gnome-doc-utils.make', re.DOTALL)
         for tarinfo in tar:
             doc = None
             if os.path.split(tarinfo.name)[-1] == 'Makefile.am':
                 fd = tar.extractfile(tarinfo)
                 makefile_am = fd.read()   
                 makefile_am = makefile_am.replace('\\\n', ' ')
-                if 'DOC_MODULE' in makefile_am and \
-                        'include $(top_srcdir)/gnome-doc-utils.make' in makefile_am:
+                if 'DOC_MODULE' in makefile_am and regex_gdu.findall(makefile_am):
                     logging.debug('found usage of gnome-doc-utils in %s' % tarinfo.name)
                     doc = GnomeDocUtilsModule(tar, tarinfo, makefile_am)
                 elif 'include $(top_srcdir)/gtk-doc.make' in makefile_am or \



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