library-web r385 - in trunk: . data data/xslt src



Author: fpeters
Date: Sat Mar  1 14:37:05 2008
New Revision: 385
URL: http://svn.gnome.org/viewvc/library-web?rev=385&view=rev

Log:
* data/overlay.xml.in, data/xslt/db2html.xsl, src/lgo.py: always copy
all image files, falling back to those from C locale when necessary,
modified db2html to link to language-qualified figure filenames.



Modified:
   trunk/ChangeLog
   trunk/data/overlay.xml.in
   trunk/data/xslt/db2html.xsl
   trunk/src/lgo.py

Modified: trunk/data/overlay.xml.in
==============================================================================
--- trunk/data/overlay.xml.in	(original)
+++ trunk/data/overlay.xml.in	Sat Mar  1 14:37:05 2008
@@ -642,7 +642,7 @@
     <quirk fixed-in="2.11.90">missing-id-on-top-book-element</quirk>
   </quirks>
   <quirks doc_module="release-notes" channel="misc">
-    <quirk fixed-in="2.22.0">replace-index-by-intro</quirk>
+    <quirk fixed-in="2.22">replace-index-by-intro</quirk>
     <quirk>flat-rendering</quirk>
     <quirk>languages-in-sidebar</quirk>
   </quirks>

Modified: trunk/data/xslt/db2html.xsl
==============================================================================
--- trunk/data/xslt/db2html.xsl	(original)
+++ trunk/data/xslt/db2html.xsl	Sat Mar  1 14:37:05 2008
@@ -214,6 +214,28 @@
     </xsl:choose>
   </xsl:template>
 
+<!-- modified to add a language extension to images -->
+<xsl:template name="db2html.imagedata.src">
+  <xsl:param name="node" select="."/>
+  <xsl:choose>
+    <xsl:when test="$node/@fileref">
+      <!-- FIXME: do this less stupidly, or not at all -->
+      <xsl:choose>
+        <xsl:when test="$node/@format = 'PNG' and
+                        (substring($node/@fileref, string-length($node/@fileref) - 3)
+                          != '.png')">
+          <xsl:value-of select="concat($node/@fileref, '.png.', $libgo.lang)"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="concat($node/@fileref, '.', $libgo.lang)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:when test="$node/@entityref">
+      <xsl:value-of select="unparsed-entity-uri($node/@entityref)"/>
+    </xsl:when>
+  </xsl:choose>
+</xsl:template>
 
 
 </xsl:stylesheet>

Modified: trunk/src/lgo.py
==============================================================================
--- trunk/src/lgo.py	(original)
+++ trunk/src/lgo.py	Sat Mar  1 14:37:05 2008
@@ -751,7 +751,13 @@
             doc_figures = re.findall('DOC_FIGURES\s+=\s+(.*)',
                     self.makefile_am)[0].split()
         except IndexError:
-            doc_figures = 'default'
+            figures_dirname = os.path.join(ext_dirname, self.dirname, 'C', 'figures')
+            if os.path.exists(figures_dirname):
+                doc_figures = [os.path.join('figures', x) for x in \
+                        os.listdir(figures_dirname) \
+                        if os.path.splitext(x)[1] in ('.png', '.jpg', '.jpeg')]
+            else:
+                doc_figures = []
 
         doc_linguas.sort()
 
@@ -827,7 +833,6 @@
                 # Release notes had <sect1 id="index"><title>Introduction...
                 # instead of <sect1 id="intro"><title>Introduction... and that
                 # prevented a correct id="index" on top <article>
-                print 'XXX:, fixing stuff'
                 t = open(xml_file).read()
                 open(xml_file + '.fixed', 'w').write(
                         t.replace('\n<article ', '\n<article id="index" '
@@ -874,26 +879,16 @@
                 if rc != 0:
                     logging.warn('%s failed with error %d' % (' '.join(cmd), rc))
 
-            if type(doc_figures) is list:
-                images_to_copy = doc_figures
-            elif doc_figures == 'default':
-                # default is to copy to copy figures/*.png
-                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 os.path.splitext(x)[1] in ('.png', '.jpg', '.jpeg')]
-                else:
-                    images_to_copy = []
-            else:
-                images_to_copy = []
-
-            if images_to_copy:
+            if doc_figures:
                 # and copy images/
                 logging.debug('copying figures')
-                for doc_figure in images_to_copy:
+                for doc_figure in doc_figures:
                     src = os.path.join(lang_dirname, doc_figure)
                     if not os.path.exists(src):
-                        continue
+                        # fallback to image from C locale.
+                        src = os.path.join(ext_dirname, self.dirname, 'C', doc_figure)
+                        if not os.path.exists(src):
+                            continue
                     dst = os.path.join(web_output_dir, doc_figure + '.%s' % lang)
                     if not os.path.exists(os.path.split(dst)[0]):
                         os.makedirs(os.path.split(dst)[0])



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