Merge styles
authorFabien Ninoles <fabien@tzone.org>
Tue, 29 Dec 2015 21:32:40 -0500
branchstyles
changeset 24 acf70691eb31
parent 23 8445a48b1679 (current diff)
parent 22 dc2252620c02 (diff)
child 25 ed59e6e7fad0
Merge
print.xsl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Tue Dec 29 21:32:40 2015 -0500
@@ -0,0 +1,1 @@
+install
\ No newline at end of file
--- a/Makefile	Tue Dec 29 21:26:32 2015 -0500
+++ b/Makefile	Tue Dec 29 21:32:40 2015 -0500
@@ -30,3 +30,5 @@
 clean:
 
 purge:
+
+.PHONY: install
--- a/TODO	Tue Dec 29 21:26:32 2015 -0500
+++ b/TODO	Tue Dec 29 21:32:40 2015 -0500
@@ -1,4 +1,4 @@
 * Finir la version imprimable (book)
 * Faire une version 1/pdf/contes.
 * Faire une version HTML-1-PAGE (pour la version texte).
-* Rajouter les xlink, xref, olink, oref...
+* Rajouter les link, xref, olink, oref...
--- a/blog.css	Tue Dec 29 21:26:32 2015 -0500
+++ b/blog.css	Tue Dec 29 21:32:40 2015 -0500
@@ -24,3 +24,5 @@
 .stories strong, .stories b, .stories em { color: blue }
 */
 
+.entry td, .entry th { padding: 5px; border: solid 1pt }
+.entry table { border-collapse: collapse }
--- a/html.xsl	Tue Dec 29 21:26:32 2015 -0500
+++ b/html.xsl	Tue Dec 29 21:32:40 2015 -0500
@@ -59,8 +59,9 @@
     <body class="book">
       <xsl:apply-templates select="docinfo/date"/>
       <xsl:apply-templates/>
+      <p><strong>Table des Matières</strong></p>
       <ul>
-	<xsl:apply-templates mode="book-toc" select="section|story|poetry"/>
+	    <xsl:apply-templates mode="book-toc" select="section|story|poetry"/>
       </ul>
       <hr/>
       <address>
@@ -305,7 +306,7 @@
   <xsl:value-of select="title/text()"/>
 </xsl:template>
 
-<xsl:template match="section|story|poetry" mode="navbar-link">
+<xsl:template match="section|story|poetry" mode="href">
   <xsl:call-template name="get-id"/>
 </xsl:template>
 
@@ -313,7 +314,7 @@
   <xsl:param name="prefix"></xsl:param>
   <a>
     <xsl:attribute name="href">
-      <xsl:apply-templates select="." mode="navbar-link"/>
+      <xsl:apply-templates select="." mode="href"/>
       <xsl:text>.html</xsl:text>
     </xsl:attribute>
     <xsl:value-of select="$prefix"/>
@@ -465,6 +466,17 @@
 
 <xsl:template match="*" mode="xref"/>
 
+<xsl:template match="link">
+  <xsl:variable name="linkend" select="@linkend"/>
+  <a>
+    <xsl:attribute name="href">
+      <xsl:apply-templates select="//*[@id=$linkend]" mode="href"/>
+      <xsl:text>.html</xsl:text>
+    </xsl:attribute>
+    <xsl:apply-templates/>
+  </a>
+</xsl:template>
+
 <xsl:template match="section/title"/>
 <xsl:template match="section/subtitle"/>
 
--- a/poetry_html.xsl	Tue Dec 29 21:26:32 2015 -0500
+++ b/poetry_html.xsl	Tue Dec 29 21:32:40 2015 -0500
@@ -54,25 +54,25 @@
   <ul class="navbar">
     <xsl:for-each select="//xref[@linkend=$my-id]">
       <li>
-	<xsl:variable name="mysection" select="ancestor::section[last()]/@id"/>
-	<xsl:for-each select="ancestor::section">
-	  <xsl:apply-templates select="." mode="xref"/>
-	  <xsl:if test="descendant::section">
-	    <xsl:text> : </xsl:text>
-	  </xsl:if>
-	</xsl:for-each>
-	<ul>
-	  <xsl:if test="preceding::xref[1]/ancestor::section[last()]/@id=$mysection">
-	    <li><xsl:text>Précédent: </xsl:text>
-	    <xsl:apply-templates select="preceding::xref[1]"/>
-	    </li>
-	  </xsl:if>
-	  <xsl:if test="following::xref[1]/ancestor::section[last()]/@id=$mysection">
-	    <li><xsl:text>Suivant: </xsl:text>
-	    <xsl:apply-templates select="following::xref[1]"/>
-	    </li>
-	  </xsl:if>
-	</ul>
+	    <xsl:variable name="mysection" select="ancestor::section[last()]/@id"/>
+	    <xsl:for-each select="ancestor::section">
+	      <xsl:apply-templates select="." mode="xref"/>
+	      <xsl:if test="descendant::section">
+	        <xsl:text> : </xsl:text>
+	      </xsl:if>
+	    </xsl:for-each>
+	    <ul>
+	      <xsl:if test="preceding::xref[1]/ancestor::section[last()]/@id=$mysection">
+	        <li><xsl:text>Précédent: </xsl:text>
+	        <xsl:apply-templates select="preceding::xref[1]"/>
+	        </li>
+	      </xsl:if>
+	      <xsl:if test="following::xref[1]/ancestor::section[last()]/@id=$mysection">
+	        <li><xsl:text>Suivant: </xsl:text>
+	        <xsl:apply-templates select="following::xref[1]"/>
+	        </li>
+	      </xsl:if>
+	    </ul>
       </li>
     </xsl:for-each>
   </ul>
--- a/poetry_print.xsl	Tue Dec 29 21:26:32 2015 -0500
+++ b/poetry_print.xsl	Tue Dec 29 21:32:40 2015 -0500
@@ -66,11 +66,17 @@
 	</xsl:with-param>
       </xsl:call-template>
       <xsl:variable name="id">
-	<xsl:call-template name="get-id"/>
+	    <xsl:call-template name="get-id"/>
       </xsl:variable>
       <flow flow-name="xsl-region-body">
-	<block id="{$id}"/>
-	<xsl:apply-templates select="*[name(.)!='section']"/>
+	    <block id="{$id}"/>
+	    <xsl:apply-templates select="*[name(.)!='section']"/>
+        <block space-before="4pt">
+          <inline font-weight="bold">Table des matières</inline>
+          <list-block provisional-distance-between-starts="5mm">
+            <xsl:apply-templates select="section|story|poetry" mode="toc"/>
+          </list-block>
+        </block>
       </flow>
     </page-sequence>
     <xsl:apply-templates select="section"/> 
@@ -100,15 +106,15 @@
     </xsl:variable>
     <flow flow-name="xsl-region-body">
       <block>
-	<xsl:if test="name(.) != 'poetry'">
-	  <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
-	</xsl:if>
-	<xsl:apply-templates select="*[not(poetry)][name(.)!='poetry']"/>
-	<xsl:if test="section[poetry]">
-	<list-block text-indent="15mm" space-before="15pt">
-	  <xsl:apply-templates select="section[poetry]" mode="toc"/>
-	</list-block>
-      </xsl:if>
+	    <xsl:if test="name(.) != 'poetry'">
+	      <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
+	    </xsl:if>
+	    <xsl:apply-templates select="*[not(poetry)][name(.)!='poetry']"/>
+	    <xsl:if test="section[poetry]">
+	      <list-block text-indent="15mm" space-before="15pt">
+	        <xsl:apply-templates select="section[poetry]" mode="toc"/>
+	      </list-block>
+        </xsl:if>
       </block>
     </flow>    
   </page-sequence>
@@ -120,7 +126,7 @@
     <xsl:call-template name="list-label"/>
     <list-item-body start-indent="body-start()">
       <block>
-	<xsl:apply-templates select="." mode="xref"/>
+	    <xsl:apply-templates select="." mode="toc-xref"/>
       </block>
     </list-item-body>
   </list-item>
@@ -233,7 +239,7 @@
   <xsl:apply-templates/>
 </xsl:template>
 
-<xsl:template match="poetry|section" mode="xref">
+<xsl:template match="poetry|section" mode="toc-xref">
   <xsl:variable name="id">
     <xsl:call-template name="get-id"/>
   </xsl:variable>
@@ -244,9 +250,26 @@
     </basic-link>
 </xsl:template>
 
+<xsl:template match="list[@role='toc']/item/xref">
+  <xsl:variable name="linkend" select="@linkend"/>
+  <xsl:apply-templates mode="toc-xref" select="//*[@id=$linkend]"/>
+</xsl:template>
+
 <xsl:template match="xref">
   <xsl:variable name="linkend" select="@linkend"/>
-  <xsl:apply-templates mode="xref" select="//*[@id=$linkend]"/>
+  <xsl:variable name="linkterm">
+    <xsl:choose>
+      <xsl:when test="@linkterm"><xsl:value-of select="@linkterm"/></xsl:when>
+      <xsl:otherwise><xsl:value-of select="@linkend"/></xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+    <basic-link internal-destination="{$linkend}">
+      <xsl:apply-templates mode="xref" select="//*[@id=$linkterm]"/>
+    </basic-link>
+</xsl:template>
+    
+<xsl:template match="poetry|section" mode="xref">
+  <xsl:value-of select="descendant::title[1]"/>
 </xsl:template>
 
 </xsl:stylesheet>
--- a/print.xsl	Tue Dec 29 21:26:32 2015 -0500
+++ b/print.xsl	Tue Dec 29 21:32:40 2015 -0500
@@ -155,6 +155,13 @@
   <inline vertical-align="super" font-size="60%"><xsl:apply-templates/></inline>
 </xsl:template>
 
+<xsl:template match="link">
+  <xsl:variable name="linkend" select="@linkend"/>
+  <basic-link internal-destination="{$linkend}">
+    <xsl:apply-templates/>
+  </basic-link>  
+</xsl:template>
+
 </xsl:stylesheet>
 
 <!-- Keep this comment at the end of the file