no luck doing logic in latex -- table is broken down in redundant xslt
authorMarcin Koziej <marcin@koziej.info>
Wed, 19 Feb 2014 11:07:15 +0000 (12:07 +0100)
committerMarcin Koziej <marcin@koziej.info>
Wed, 19 Feb 2014 11:07:15 +0000 (12:07 +0100)
librarian/pdf/fnprep.cls
librarian/pdf/wl2tex.xslt

index f290616..3cc56f5 100644 (file)
@@ -769,3 +769,34 @@ Mapping=tex-text
 \newcommand{\link}[2]{\href{#1}{\uline{#2}\footnote{#1}}}
 
 \newcommand{\www}[1]{{\normalfont\href{#1}{#1}}}
+
+% TABELA %
+
+\newenvironment{tabela}[0]%
+{\begin{longtable}{p{40mm}@{\hspace{5mm}}p{65mm}@{\hspace{5mm}}p{65mm}@{\hspace{5mm}}p{65mm}}}%
+{\end{longtable}}
+
+\newcommand{\formatkomnaglowek}[1]% reset format
+             {{\LARGE\headfont\color{headcolor}\MakeTextUppercase{#1}}}
+\newcommand{\formatkompierwsza}[1]% reset format
+             {{\LARGE\headfont\color{graybg}\MakeTextUppercase{#1}}}
+\newcommand{\formatkom}[1]{\scriptsize{}#1} % nop
+
+\newcommand{\tabelanaglowek}[1]{%
+    #1
+    \\[4mm]
+    \endhead
+}
+
+\newcommand{\tabelawiersz}[1]{
+    \cmidrule[0.7pt](r{5mm}){1-1}
+    \cmidrule[0.7pt](r{5mm}){2-2}
+    \cmidrule[0.7pt](r{5mm}){3-3}
+    \cmidrule[0.7pt](r{5mm}){4-4} \\[3mm]
+    #1
+    \\[4mm]
+}
+
+\newcommand{\tabelakomnaglowek}[1]{\formatkomnaglowek{#1}}
+\newcommand{\tabelakompierwsza}[1]{\formatkompierwsza{#1}}
+\newcommand{\tabelakom}[1]{\formatkom{#1}}
index fd14d5c..149fbde 100644 (file)
   </TeXML>
 </xsl:template>
 
+<!-- TODO: this needs parameters, but we need to determine which
+     - cols: number of cols?
+     - first: is first column special?
+
+ -->
+<xls:template match="tabela">
+  <cmd name="begin"><parm>tabela</parm> </cmd>
+  <xsl:apply-templates mode="tabela"/>
+  <cmd name="end"><parm>tabela</parm> </cmd>
+</xls:template>
+
+<xsl:template match="r" mode="tabela">
+  <xsl:choose>
+    <xsl:when test="position() = 1">
+      <cmd name="tabelanaglowek"><parm>
+       <xsl:apply-templates mode="tabelanaglowek"/>
+      </parm></cmd>
+    </xsl:when>
+    <xsl:otherwise>
+      <cmd name="tabelawiersz"><parm>
+       <xsl:apply-templates mode="tabelawiersz"/>
+      </parm></cmd>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="c" mode="tabelanaglowek">
+  <xsl:if test="position() > 1">&amp;</xsl:if>
+  <cmd name="tabelakomnaglowek"><parm>
+    <xsl:apply-templates mode="inline"/>
+  </parm></cmd>
+</xsl:template>
+
+<xsl:template match="c" mode="tabelawiersz">
+  <xsl:choose>
+    <xsl:when test="position() = 1">
+      <cmd name="tabelakompierwsza"><parm>
+       <xsl:apply-templates mode="inline"/>
+      </parm></cmd>
+    </xsl:when>
+    <xsl:otherwise>
+      &amp;<cmd name="tabelakom"><parm>
+       <xsl:apply-templates mode="inline"/>
+      </parm></cmd>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+
+
 
 <xsl:template match="tablewrap">
   <cmd name="begin"><parm>table</parm><opt>h!</opt></cmd>