Skip to content

Commit

Permalink
Different bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
glorieux-f committed Aug 16, 2023
1 parent c01d286 commit bb69952
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 79 deletions.
7 changes: 5 additions & 2 deletions tei_latex/tei_figure_latex.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ https://github.com/TEIC/Stylesheets/tree/dev/latex
A light version for XSLT1, with local improvements.
2021, frederic.glorieux@fictif.org
-->
<xsl:param name="tableMaxWidth">0.85</xsl:param>
<xsl:template match="tei:cell">
<xsl:variable name="rend" select="concat(' ', normalize-space(@rend), ' ')"/>
<!-- \tabcellsep -->
Expand Down Expand Up @@ -130,6 +131,7 @@ A light version for XSLT1, with local improvements.
<xsl:if test="@width">
<xsl:variable name="unit" select="translate(@width, '  0123456789', '')"/>
<xsl:choose>
<xsl:when test="@subtype='unit:EMU'"/>
<xsl:when test="$unit = '%'">
<xsl:text>width=</xsl:text>
<xsl:value-of select="number(substring-before(@width,'%')) div 100"/>
Expand Down Expand Up @@ -161,6 +163,7 @@ A light version for XSLT1, with local improvements.
<xsl:if test="@height">
<xsl:variable name="unit" select="translate(@height, '  0123456789', '')"/>
<xsl:choose>
<xsl:when test="@subtype='unit:EMU'"/>
<xsl:when test="$unit = '%'">
<xsl:text>height=</xsl:text>
<xsl:value-of select="number(substring-before(@height,'%')) div 100"/>
Expand Down Expand Up @@ -323,7 +326,7 @@ A light version for XSLT1, with local improvements.
</xsl:if>
<xsl:choose>
<xsl:when test="tei:head and not(contains(@rend, 'display'))">
<xsl:if test="not(ancestor::tei:table or $longtables='false')">
<xsl:if test="not(ancestor::tei:table)">
<xsl:text>\endfirsthead </xsl:text>
<xsl:text>\multicolumn{</xsl:text>
<xsl:value-of select="count(tei:row[1]/tei:cell)"/>
Expand All @@ -345,7 +348,7 @@ A light version for XSLT1, with local improvements.
</xsl:template>
<xsl:template name="tableHline">
<xsl:choose>
<xsl:when test="ancestor::tei:table or $longtables='false' or contains(@rend,'display')"> \hline </xsl:when>
<xsl:when test="ancestor::tei:table or contains(@rend,'display')"> \hline </xsl:when>
<xsl:otherwise> \hline\endfoot\hline\endlastfoot </xsl:otherwise>
</xsl:choose>
</xsl:template>
Expand Down
132 changes: 64 additions & 68 deletions tei_latex/tei_flow_latex.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -319,81 +319,77 @@ for example: abstract.
</xsl:apply-templates>
</xsl:param>
<xsl:variable name="zerend" select="concat(' ', normalize-space($rend), ' ')"/>
<xsl:variable name="decls">
<xsl:choose>
<xsl:when test="contains($zerend, ' i ')">\itshape</xsl:when>
<xsl:when test="contains($zerend, ' it ')">\itshape</xsl:when>
<xsl:when test="contains($zerend, ' ital ')">\itshape</xsl:when>
<xsl:when test="contains($zerend, ' italics ')">\itshape</xsl:when>
<xsl:when test="contains($zerend, ' italique ')">\itshape</xsl:when>
<xsl:when test="self::tei:hi and not(@rend)">\itshape</xsl:when>
</xsl:choose>
<xsl:if test="contains($zerend, ' center ')">\centering</xsl:if>
<xsl:if test="contains($zerend, ' tt ')">\ttfamily</xsl:if>
<xsl:if test="contains($zerend, ' sc ')">\scshape</xsl:if>
<xsl:if test="contains($zerend, ' large ')">\large</xsl:if>
<xsl:if test="contains($zerend, ' larger ')">\larger</xsl:if>
<xsl:if test="contains($zerend, ' right ')">\raggedleft</xsl:if>
<xsl:if test="contains($zerend, ' small ')">\small</xsl:if>
<xsl:if test="contains($zerend, ' smaller ')">\smaller</xsl:if>
<xsl:if test="contains($zerend, ' color')">
<xsl:variable name="color" select="substring-before(substring-after($zerend, ' color'), ' ')"/>
<xsl:text>\color{</xsl:text>
<xsl:value-of select="translate($color, '(}', '')"/>
<xsl:text>}</xsl:text>
</xsl:if>
</xsl:variable>
<xsl:variable name="cmd">
<xsl:if test="contains($zerend, ' allcaps ')">\uppercase{</xsl:if>
<xsl:if test="contains($zerend, ' b ')">\textbf{</xsl:if>
<xsl:if test="contains($zerend, ' bold ')">\textbf{</xsl:if>
<xsl:if test="contains($zerend, ' gothic ')">\textgothic{</xsl:if>
<xsl:if test="contains($zerend, ' noindex ')">\textrm{</xsl:if>
<xsl:if test="contains($zerend, ' plain ')">\textrm{</xsl:if>
<xsl:if test="contains($zerend, ' strong ')">\textbf{</xsl:if>
<xsl:if test="contains($zerend, ' sub ')">\textsubscript{</xsl:if>
<xsl:if test="contains($zerend, ' subscript ')">\textsubscript{</xsl:if>
<xsl:if test="contains($zerend, ' sup ')">\textsuperscript{</xsl:if>
<xsl:if test="contains($zerend, ' superscript ')">\textsuperscript{</xsl:if>
<xsl:if test="contains($zerend, ' uc ')">\MakeUppercase{</xsl:if>
<xsl:if test="contains($zerend, ' underline ')">\uline{</xsl:if>
<xsl:if test="contains($zerend, ' uppercase ')">\MakeUppercase{</xsl:if>
<!--
<xsl:when test=". = 'strike'">\sout{</xsl:when>
<xsl:when test=". = 'overbar'">\textoverbar{</xsl:when>
<xsl:when test=". = 'doubleunderline'">\uuline{</xsl:when>
<xsl:when test=". = 'wavyunderline'">\uwave{</xsl:when>
<xsl:when test=". = 'quoted'">\textquoted{</xsl:when>
<xsl:when test=". = 'calligraphic'">\textcal{</xsl:when>
-->
</xsl:variable>
<xsl:value-of select="$cmd"/>
<xsl:choose>
<xsl:when test="normalize-space($zerend) = ''">
<xsl:when test="$decls = ''">
<xsl:copy-of select="$cont"/>
</xsl:when>
<!-- declaration to enclose -->
<xsl:otherwise>
<xsl:variable name="decls">
<xsl:if test="contains($zerend, ' center ')">\centering</xsl:if>
<xsl:if test="contains($zerend, ' i ')">\itshape</xsl:if>
<xsl:if test="contains($zerend, ' it ')">\itshape</xsl:if>
<xsl:if test="contains($zerend, ' ital ')">\itshape</xsl:if>
<xsl:if test="contains($zerend, ' italics ')">\itshape</xsl:if>
<xsl:if test="contains($zerend, ' italique ')">\itshape</xsl:if>
<xsl:if test="contains($zerend, ' tt ')">\ttfamily</xsl:if>
<xsl:if test="contains($zerend, ' sc ')">\scshape</xsl:if>
<xsl:if test="contains($zerend, ' large ')">\large</xsl:if>
<xsl:if test="contains($zerend, ' larger ')">\larger</xsl:if>
<xsl:if test="contains($zerend, ' right ')">\raggedleft</xsl:if>
<xsl:if test="contains($zerend, ' small ')">\small</xsl:if>
<xsl:if test="contains($zerend, ' smaller ')">\smaller</xsl:if>
<xsl:if test="contains($zerend, ' color')">
<xsl:variable name="color" select="substring-before(substring-after($zerend, ' color'), ' ')"/>
<xsl:text>\color{</xsl:text>
<xsl:value-of select="translate($color, '(}', '')"/>
<xsl:text>}</xsl:text>
</xsl:if>
</xsl:variable>
<xsl:variable name="cmd">
<xsl:if test="contains($zerend, ' allcaps ')">\uppercase{</xsl:if>
<xsl:if test="contains($zerend, ' b ')">\textbf{</xsl:if>
<xsl:if test="contains($zerend, ' bold ')">\textbf{</xsl:if>
<xsl:if test="contains($zerend, ' gothic ')">\textgothic{</xsl:if>
<xsl:if test="contains($zerend, ' noindex ')">\textrm{</xsl:if>
<xsl:if test="contains($zerend, ' plain ')">\textrm{</xsl:if>
<xsl:if test="contains($zerend, ' strong ')">\textbf{</xsl:if>
<xsl:if test="contains($zerend, ' sub ')">\textsubscript{</xsl:if>
<xsl:if test="contains($zerend, ' subscript ')">\textsubscript{</xsl:if>
<xsl:if test="contains($zerend, ' sup ')">\textsuperscript{</xsl:if>
<xsl:if test="contains($zerend, ' superscript ')">\textsuperscript{</xsl:if>
<xsl:if test="contains($zerend, ' uc ')">\MakeUppercase{</xsl:if>
<xsl:if test="contains($zerend, ' underline ')">\uline{</xsl:if>
<xsl:if test="contains($zerend, ' uppercase ')">\MakeUppercase{</xsl:if>
<!--
<xsl:when test=". = 'strike'">\sout{</xsl:when>
<xsl:when test=". = 'overbar'">\textoverbar{</xsl:when>
<xsl:when test=". = 'doubleunderline'">\uuline{</xsl:when>
<xsl:when test=". = 'wavyunderline'">\uwave{</xsl:when>
<xsl:when test=". = 'quoted'">\textquoted{</xsl:when>
<xsl:when test=". = 'calligraphic'">\textcal{</xsl:when>
-->
</xsl:variable>
<xsl:value-of select="$cmd"/>
<xsl:choose>
<xsl:when test="$decls = ''">
<xsl:copy-of select="$cont"/>
</xsl:when>
<!-- declaration to enclose -->
<xsl:otherwise>
<xsl:if test="$cmd = ''">
<xsl:text>{</xsl:text>
</xsl:if>
<xsl:value-of select="$decls"/>
<!-- matches($decls, '[a-z]$') ? -->
<xsl:text> </xsl:text>
<xsl:copy-of select="$cont"/>
<xsl:if test="$cmd = ''">
<xsl:text>}</xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$cmd != ''">
<xsl:value-of select="substring('}}}}}}}}}}}}}}}}}}}}}}}}}', 1, string-length($cmd) - string-length(translate($cmd, '{', '')))"/>
<xsl:if test="$cmd = ''">
<xsl:text>{</xsl:text>
</xsl:if>
<xsl:value-of select="$decls"/>
<!-- matches($decls, '[a-z]$') ? -->
<xsl:text> </xsl:text>
<xsl:copy-of select="$cont"/>
<xsl:if test="$cmd = ''">
<xsl:text>}</xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$cmd != ''">
<xsl:value-of select="substring('}}}}}}}}}}}}}}}}}}}}}}}}}', 1, string-length($cmd) - string-length(translate($cmd, '{', '')))"/>
</xsl:if>
</xsl:template>

<xsl:template match="tei:hi[starts-with(@rend, 'initial')]">
Expand Down
17 changes: 12 additions & 5 deletions tei_latex/tei_linking_latex.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ A light version for XSLT1, with local improvements.
2021, frederic.glorieux@fictif.org
-->
<xsl:template match="tei:anchor">
<!--
<xsl:call-template name="tei:makeHyperTarget"/>
-->
<xsl:message>TOD BUG</xsl:message>
</xsl:template>
<doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
<desc>[latex] <param name="where">where</param> </desc>
Expand Down Expand Up @@ -55,7 +58,7 @@ A light version for XSLT1, with local improvements.
<xsl:template name="makeInternalLink">
<xsl:param name="target"/>
<xsl:param name="class"/>
<xsl:param name="ptr" as="xs:boolean" select="false()"/>
<xsl:param name="ptr" select="false()"/>
<xsl:param name="dest"/>
<xsl:param name="body"/>
<xsl:choose>
Expand Down Expand Up @@ -112,19 +115,23 @@ A light version for XSLT1, with local improvements.
<xsl:text>\textit{\hyperref[</xsl:text>
<xsl:value-of select="$dest"/>
<xsl:text>]{</xsl:text>
<xsl:apply-templates mode="xref" select=".">
<xsl:message>TODO, BUG</xsl:message>
<!--
<xsl:with-param name="minimal" select="$minimalCrossRef"/>
</xsl:apply-templates>
-->
<xsl:apply-templates mode="xref" select="."/>
<xsl:text>}}</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>\hyperref[</xsl:text>
<xsl:value-of select="$dest"/>
<xsl:text>]{</xsl:text>
<xsl:value-of select="$body"/>
<xsl:apply-templates mode="xref" select=".">
<xsl:message>TODO, BUG</xsl:message>
<!--
<xsl:with-param name="minimal" select="$minimalCrossRef"/>
</xsl:apply-templates>
-->
<xsl:apply-templates mode="xref" select="."/>
<xsl:text>}</xsl:text>
</xsl:otherwise>
</xsl:choose>
Expand Down
10 changes: 6 additions & 4 deletions tei_latex/tei_meta_latex.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,18 @@ TEI to LaTeX, metadata for preamble
<xsl:text>\def\elbibl{</xsl:text>
<xsl:if test="$latexAuthor != ''">
<xsl:value-of select="$latexAuthor"/>
<xsl:text>. </xsl:text>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:if test="$latexDate != ''">
<xsl:text>(</xsl:text>
<xsl:value-of select="$latexDate"/>
<xsl:text>. </xsl:text>
<xsl:text>) </xsl:text>
</xsl:if>
<xsl:text>\emph{</xsl:text>
<xsl:apply-templates select="/*/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[not(@type) or @type='main'][1]/node()" mode="meta"/>
<xsl:text>}</xsl:text>
<xsl:text>}&#10;</xsl:text>

<!--
<xsl:variable name="author1">
<xsl:for-each select="(/*/tei:teiHeader/tei:fileDesc/tei:titleStmt)[1]">
Expand Down Expand Up @@ -168,7 +170,7 @@ TEI to LaTeX, metadata for preamble

<xsl:if test="/*/tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:bibl">
<xsl:text>\def\elsource{</xsl:text>
<xsl:apply-templates select="/*/tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:bibl/node()"/>
<xsl:apply-templates select="/*/tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:bibl[1]/node()"/>
<xsl:text>}&#10;</xsl:text>
</xsl:if>

Expand Down Expand Up @@ -318,7 +320,7 @@ TEI to LaTeX, metadata for preamble
<xsl:value-of select="normalize-space(.)"/>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="tei:emph | tei:hi[starts-with(@rend, 'i')] | tei:title" mode="meta">
<xsl:template match="tei:emph | tei:hi[starts-with(@rend, 'i')] | tei:hi[not(@rend)] | tei:title" mode="meta">
<xsl:text>\emph{</xsl:text>
<xsl:apply-templates mode="meta"/>
<xsl:text>}</xsl:text>
Expand Down
4 changes: 4 additions & 0 deletions tei_latex/tei_rahtz_latex.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,9 @@ it is dangerous for docx where nesting may produce lots of surprises
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="$Unit='vol' or $Unit='volume'">
<!-- Why emphasize here ? -->
<xsl:apply-templates/>
<!--
<xsl:call-template name="emphasize">
<xsl:with-param name="class">
<xsl:text>vol</xsl:text>
Expand All @@ -532,6 +535,7 @@ it is dangerous for docx where nesting may produce lots of surprises
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
-->
</xsl:when>
<xsl:when test="$Unit='chap' or $Unit='chapter'">
<!-- TODO Chapter ? -->
Expand Down

0 comments on commit bb69952

Please sign in to comment.