Skip to content

Commit

Permalink
tei->eoatex: tweaking newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
EsGeh authored and EsGeh committed Nov 22, 2019
1 parent f61bb11 commit 0d003ab
Showing 1 changed file with 32 additions and 52 deletions.
84 changes: 32 additions & 52 deletions src/tei2eoatex/eoatex_textparts.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@
<!--
<xsl:template match="tei:div[not(@type = ('chapter', 'indexchapter', 'part', 'chapteroriginal'))]">
-->
<xsl:if test="preceding-sibling::*">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
<xsl:call-template name="begin_paragraph"/>
<xsl:choose>
<xsl:when test="@type='section'">
<xsl:sequence select="eoa:debug(0, 'section: ', @n)"/>
Expand Down Expand Up @@ -71,9 +69,7 @@
</xsl:template>

<xsl:template match="tei:body//tei:quote">
<xsl:if test="preceding-sibling::*">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\begin{EOAquote}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
<xsl:apply-templates/>
Expand All @@ -83,19 +79,15 @@
</xsl:template>

<xsl:template match="tei:body//tei:ab[@type='chapterabstract']">
<xsl:if test="preceding-sibling::*">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\begin{EOAabstract}</xsl:text>
<xsl:apply-templates/>
<xsl:text>\end{EOAabstract}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
</xsl:template>

<xsl:template match="tei:body//tei:ab[@type='theoremdeclaration']">
<xsl:if test="preceding-sibling::*">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\EOAnewtheorem</xsl:text>
<xsl:text>{</xsl:text>
<xsl:value-of select="@xml:id"/>
Expand All @@ -107,9 +99,7 @@
</xsl:template>

<xsl:template match="tei:body//tei:ab[@type='theoreminstance']">
<xsl:if test="preceding-sibling::*">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\begin{</xsl:text>
<xsl:value-of select="substring-after(@corresp, '#')"/>
<xsl:text>}&#x000a;</xsl:text>
Expand All @@ -121,9 +111,7 @@
</xsl:template>

<xsl:template match="tei:body//tei:ab[@type='equation']">
<xsl:if test="preceding-sibling::*">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\begin{EOAequation}</xsl:text>
<xsl:choose>
<xsl:when test="@n='nonumber'">
Expand All @@ -141,9 +129,7 @@
</xsl:template>

<xsl:template match="tei:body//tei:ab[@type='subequations']">
<xsl:if test="preceding-sibling::*">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\begin{EOAsubequations}{</xsl:text>
<xsl:value-of select="./@xml:id"/>
<xsl:text>}&#x000a;\begin{align}&#x000a;</xsl:text>
Expand All @@ -153,9 +139,7 @@
</xsl:template>

<xsl:template match="tei:body//tei:ab[@type='equationarray']">
<xsl:if test="preceding-sibling::*">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\begin{EOAequationarray</xsl:text>
<xsl:choose>
<xsl:when test="@n='nonumber'">
Expand All @@ -178,10 +162,8 @@
<xsl:text>&#x000a;</xsl:text>
</xsl:template>

<xsl:template match="tei:body//tei:p[not(ancestor::tei:note) and not(parent::tei:div[@type = 'letter'])]">
<xsl:if test="preceding-sibling::*">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
<xsl:template match="tei:body//tei:p[not(ancestor::tei:note) and not(parent::tei:div[@type = 'letter']) and not(parent::tei:epigraph)]">
<xsl:call-template name="begin_paragraph"/>
<xsl:if test="
preceding-sibling::*[1][self::tei:figure[not(@type='hionly*')]] and $indentfloats
or preceding-sibling::*[1][self::tei:ab[@type = 'chapterabstract']]
Expand All @@ -194,9 +176,7 @@
</xsl:template>

<xsl:template match="tei:lg[@type = 'verse']">
<xsl:if test="preceding-sibling::*">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\begin{EOAverse}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
<xsl:for-each select="tei:l">
Expand All @@ -216,19 +196,21 @@
</xsl:template>

<xsl:template match="tei:epigraph">
<xsl:if test="preceding-sibling::*">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
<xsl:apply-templates />
</xsl:template>

<xsl:template match="tei:epigraph/tei:p">
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\begin{flushright}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
<xsl:apply-templates />
<xsl:text>&#x000a;</xsl:text>
<xsl:text>\end{flushright}</xsl:text>
<xsl:text>&#x000a;</xsl:text>
</xsl:template>

<xsl:template match="tei:table">
<xsl:if test="preceding-sibling::*">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
<xsl:call-template name="begin_paragraph"/>
<xsl:variable name="number_cells" as="xs:integer*">
<xsl:value-of select="count(./tei:row[1]/tei:cell)"/>
</xsl:variable>
Expand Down Expand Up @@ -335,24 +317,22 @@
</xsl:template>

<xsl:template match="tei:list">
<xsl:if test="preceding-sibling::*">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
<xsl:call-template name="begin_paragraph"/>
<xsl:choose>
<xsl:when test="@type='ordered'">
<xsl:text>\begin{EOAlist}&#x000a;</xsl:text>
<xsl:apply-templates select="./tei:item"/>
<xsl:text>\end{EOAlist}&#x000a;</xsl:text>
<xsl:text>\end{EOAlist}</xsl:text>
</xsl:when>
<xsl:when test="@type='unordered'">
<xsl:text>\begin{EOAitems}&#x000a;</xsl:text>
<xsl:apply-templates select="./tei:item"/>
<xsl:text>\end{EOAitems}&#x000a;</xsl:text>
<xsl:text>\end{EOAitems}</xsl:text>
</xsl:when>
<xsl:when test="@type='gloss'">
<xsl:text>\begin{EOAdescription}&#x000a;</xsl:text>
<xsl:call-template name="description"/>
<xsl:text>\end{EOAdescription}&#x000a;</xsl:text>
<xsl:text>\end{EOAdescription}</xsl:text>
</xsl:when>
</xsl:choose>
<xsl:text>&#x000a;</xsl:text>
Expand All @@ -373,9 +353,7 @@
</xsl:template>

<xsl:template match="//tei:figure">
<xsl:if test="preceding-sibling::*">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
<xsl:call-template name="begin_paragraph"/>
<xsl:choose>
<xsl:when test="not(@type) or @type='hitrue'">
<xsl:text>\EOAfigure</xsl:text>
Expand Down Expand Up @@ -451,9 +429,7 @@
</xsl:template>

<xsl:template match="tei:div[@type='bilingual']">
<xsl:if test="preceding-sibling::*">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\begin{EOAtranscripted}{</xsl:text>
<xsl:apply-templates select="./tei:div[@type='original']/tei:head"/>
<xsl:text>}{</xsl:text>
Expand All @@ -471,9 +447,7 @@
</xsl:template>

<xsl:template match="tei:div[@type='letter']">
<xsl:if test="preceding-sibling::*">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
<xsl:call-template name="begin_paragraph"/>
<xsl:text>\EOAletterhead{</xsl:text>
<xsl:apply-templates select="tei:head"/>
<xsl:if test="tei:opener/tei:date">
Expand Down Expand Up @@ -824,4 +798,10 @@
<xsl:text>|)}</xsl:text>
</xsl:template>

<xsl:template name="begin_paragraph">
<xsl:if test="preceding-sibling::*[not(self::tei:head)]">
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
</xsl:template>

</xsl:stylesheet>

0 comments on commit 0d003ab

Please sign in to comment.