Skip to content

Commit

Permalink
accept guillemets instead of double quotes in XE field codes, keep co…
Browse files Browse the repository at this point in the history
  • Loading branch information
gimsieke committed Nov 14, 2023
1 parent 281eb5b commit 7bfef35
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion xsl/index.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<xsl:param name="xe" as="element(XE)"/>
<xsl:variable name="type" as="xs:string?"
select="if(matches($xe/@fldArgs, '\\f'))
then replace($xe/@fldArgs, '^.*\\f\s*[&quot;&#8220;&#x201e;]?(.+?)[&quot;&#8221;&#x201d;]?\s*(\\.*$|$)', '$1')
then replace($xe/@fldArgs, '^.*\\f\s*[&quot;&#8220;&#x201e;»«]?(.+?)[&quot;&#8221;&#x201d;»«]?\s*(\\.*$|$)', '$1')
else
if(some $i in tokenize($xe/@fldArgs,':') satisfies matches($i,'Register§§'))
then replace(tokenize($xe/@fldArgs,':')[matches(.,'.*Register§§')],'.*Register§§(.*)$','$1')
Expand Down
21 changes: 20 additions & 1 deletion xsl/join-runs.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@
<xsl:apply-templates select="." mode="wml-to-dbk"/>
</xsl:template>

<xsl:variable name="quot-like-regex" as="xs:string" select="'&quot;„“”'"/>
<xsl:variable name="quot-like-regex" as="xs:string" select="'&quot;„“”»«'"/>

<xsl:template name="docx2hub:instrText-formatting" match="w:r[@* except @srcpath]/w:instrText/text()" mode="docx2hub:join-instrText-runs_save-formatting">
<!-- This template was originally only called by name in mode docx2hub:join-instrText-runs_render-compound2.
Expand All @@ -1409,6 +1409,7 @@
<xsl:param name="formatting-acceptable" as="xs:boolean?" tunnel="yes"/>
<xsl:param name="indexterm-preprocessing" as="xs:boolean?" tunnel="yes"/>
<xsl:variable name="run-atts" as="attribute(*)*" select="$instrText/parent::w:r/(@* except @srcpath)"/>

<xsl:variable name="prelim" as="item()*">
<xsl:choose>
<xsl:when test="$formatting-acceptable">
Expand Down Expand Up @@ -1508,6 +1509,24 @@
<xsl:sequence select="$prelim"/>
</xsl:template>

<xsl:template match="*:XE/dbk:sep[preceding-sibling::dbk:flag]" mode="wml-to-dbk">
<xsl:choose>
<xsl:when test="exists(preceding-sibling::dbk:phrase[@* except @srcpath] | following-sibling::dbk:phrase[@* except @srcpath])">
<!-- GI 2023-11-14: I found no way to attach these attributes to sep directly in docx2hub:instrText-formatting above.
The $instrText for sep was in a document node while the $instrText for the phrases had w:r parents with CSSa
attributes.
https://redmine.le-tex.de/issues/15824#note-8 -->
<phrase>
<xsl:apply-templates select="(preceding-sibling::dbk:phrase | following-sibling::dbk:phrase)/(@* except @srcpath)" mode="#current"/>
<xsl:text>:</xsl:text>
</phrase>
</xsl:when>
<xsl:otherwise>
<xsl:text>:</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="w:instrText/text()" mode="docx2hub:join-instrText-runs_render-compound2" priority="0.8">
<xsl:call-template name="docx2hub:instrText-formatting">
<xsl:with-param name="instrText" as="element(w:instrText)" select=".."/>
Expand Down

0 comments on commit 7bfef35

Please sign in to comment.