]> pere.pagekite.me Git - text-madewithcc.git/blobdiff - extra/pdf.xsl
Merge remote-tracking branch 'weblate/master'
[text-madewithcc.git] / extra / pdf.xsl
index 7fc8cecd111e7d639c28e9b131003168607176d5..714f06dfc812697a70b5e9ef48bfd6d75105e84c 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version='1.0' encoding="iso-8859-1"?>
+<?xml version='1.0' encoding="UTF-8"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
 
   <xsl:param name="latex.class.book">myclass</xsl:param>
@@ -25,7 +25,7 @@
 
   <xsl:param name="preface.tocdepth">1</xsl:param>
 
-  <xsl:param name="toc.section.depth">1</xsl:param>
+  <xsl:param name="toc.section.depth">0</xsl:param>
 
   <!-- do not list figures -->
   <xsl:param name="doc.lot.show">example</xsl:param>
@@ -42,6 +42,47 @@ extended distribution with LuLu.
     </xsl:text>
   </xsl:param>
 
+  <!-- Attributions should be italicized, right-aligned -->
+  <xsl:template match="attribution">
+    <xsl:param name="content">
+      <xsl:apply-templates/>
+    </xsl:param>
+    <xsl:text>\begin{flushright}
+    \textit{ </xsl:text>
+    <xsl:copy-of select="$content"/>
+    <xsl:text>}
+    \end{flushright}</xsl:text>
+  </xsl:template>
+
+  <!-- An  attribution's citetitle should be rendered after a line
+       break -->
+  <xsl:template match="citetitle">
+    <xsl:param name="content">
+      <xsl:apply-templates/>
+    </xsl:param>
+    <xsl:text>\\ \quad \hfill </xsl:text>
+    <xsl:copy-of select="$content"/>
+  </xsl:template>
+
+  <!-- Bibliography and acknowledgements are formatted as numberless
+       chapters — And the easiest way to achieve it was abusing the
+       "Appendix" definition. -->
+  <xsl:template match="appendix">
+     <xsl:param name="content">
+      <xsl:apply-templates/>
+     </xsl:param>
+     <xsl:param name="title">
+      <xsl:apply-templates/>
+     </xsl:param>
+     <xsl:text>\chapter*{</xsl:text>
+     <xsl:copy-of select="title"/>
+     <xsl:text>}</xsl:text>
+     <xsl:text>\addcontentsline{toc}{chapter}{</xsl:text>
+     <xsl:copy-of select="title"/>
+     <xsl:text>}</xsl:text>
+     <xsl:copy-of select="$content"/>
+  </xsl:template>
+
   <!-- Place title verso page behind the title page the hard way: put
        colophon content in a file loaded by \maketitle -->
   <xsl:template match="colophon">