Skip to content

Commit

Permalink
Add some character entities; position figures after trailing matter a…
Browse files Browse the repository at this point in the history
…nd end-notes.
  • Loading branch information
jhellingman committed Jul 8, 2024
1 parent baffbf9 commit 2497dec
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 8 deletions.
17 changes: 14 additions & 3 deletions modules/divisions.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
<xsl:apply-templates/>

<xsl:call-template name="insert-div0-footnotes"/>
<xsl:call-template name="insert-trailing-figure"/>
</div>
</xsl:template>

Expand Down Expand Up @@ -152,11 +153,11 @@
<xsl:if test="not(f:has-rend-value(@rend, 'align-with') or f:has-rend-value(@rend, 'align-with-document'))">
<xsl:call-template name="insert-footnotes"/>
</xsl:if>
<xsl:call-template name="insert-trailing-figure"/>
</div>
</xsl:if>
</xsl:template>


<xd:doc>
<xd:short>Format head element of div1.</xd:short>
<xd:detail>Format a head element for a <code>div1</code>. At this level we still set the running header (for ePub3).</xd:detail>
Expand Down Expand Up @@ -191,6 +192,7 @@
<xsl:with-param name="headingLevel" select="'h2'"/>
</xsl:call-template>
<xsl:call-template name="handle-div"/>
<xsl:call-template name="insert-trailing-figure"/>
</div>
</xsl:if>
</xsl:template>
Expand All @@ -209,6 +211,7 @@
<xsl:call-template name="generate-div-class"/>
<xsl:call-template name="pgComment"/>
<xsl:call-template name="handle-div"/>
<xsl:call-template name="insert-trailing-figure"/>
</div>
</xsl:if>
</xsl:template>
Expand Down Expand Up @@ -252,6 +255,7 @@
<xsl:if test="parent::front | parent::body | parent::back">
<xsl:call-template name="insert-footnotes"/>
</xsl:if>
<xsl:call-template name="insert-trailing-figure"/>
</div>
</xsl:if>
</xsl:template>
Expand Down Expand Up @@ -348,6 +352,13 @@
</xsl:template>


<xsl:template name="insert-trailing-figure">
<xsl:if test="p/figure[f:rend-value(@rend, 'position') = 'belowtrailer']">
<xsl:apply-templates select="p/figure[f:rend-value(@rend, 'position') = 'belowtrailer']"/>
</xsl:if>
</xsl:template>


<xsl:function name="f:is-body-content" as="xs:boolean">
<xsl:param name="node"/>

Expand Down Expand Up @@ -504,10 +515,10 @@


<xd:doc>
<xd:short>Skip images already placed above the chapter heading.</xd:short>
<xd:short>Skip images already placed above the chapter heading or after the trailer.</xd:short>
</xd:doc>

<xsl:template match="p[figure[f:rend-value(@rend, 'position') = 'abovehead']]"/>
<xsl:template match="p[figure[f:rend-value(@rend, 'position') = ('abovehead', 'belowtrailer')]]"/>


<xd:doc>
Expand Down
6 changes: 3 additions & 3 deletions modules/figures.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,8 @@ width:{$width};
<xsl:variable name="filename" select="f:determine-image-filename(.)" as="xs:string"/>

<xsl:if test="f:is-image-included($filename)">
<xsl:if test="not(f:rend-value(@rend, 'position') = 'abovehead')">
<!-- Render a figure outside the paragraph context if its position is 'abovehead'. -->
<xsl:if test="not(f:rend-value(@rend, 'position') = ('abovehead', 'belowtrailer'))">
<!-- Render a figure outside the paragraph context if its position is 'abovehead' or 'belowtrailer'. -->
<xsl:call-template name="closepar"/>
</xsl:if>
<div class="figure">
Expand All @@ -450,7 +450,7 @@ width:{$width};
<xsl:call-template name="figure-annotations-bottom"/>
<xsl:apply-templates/>
</div>
<xsl:if test="not(f:rend-value(@rend, 'position') = 'abovehead')">
<xsl:if test="not(f:rend-value(@rend, 'position') = ('abovehead', 'belowtrailer'))">
<xsl:call-template name="reopenpar"/>
</xsl:if>
</xsl:if>
Expand Down
2 changes: 1 addition & 1 deletion sandbox/normalize-paragraphs.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ in a separate pre-processing step in a pipeline of XSL transformations.
or $node/self::q[@rend = 'block']
or $node/self::letter
or $node/self::list
or $node/self::figure[not(f:is-inline(.) or f:rend-value(@rend, 'position') = 'abovehead')]
or $node/self::figure[not(f:is-inline(.) or f:rend-value(@rend, 'position') = ('abovehead', 'belowtrailer'))]
or $node/self::table[not(f:is-inline(.))]
)
then true()
Expand Down
1 change: 1 addition & 0 deletions tools/SgmlSupport.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1734,6 +1734,7 @@ BEGIN {
$ent{'Rum'} = chr(0xA776); # small capital Rum (r with stroke through tail)

$ent{'Asc'} = chr(0x1D00); # small caps A
$ent{'Ascacute'} = chr(0x1D00) . chr(0x0301); # small caps A with acute (probably typo in Swanton's Haida texts and myths)
$ent{'Dsc'} = chr(0x1D05); # small caps D
$ent{'Esc'} = chr(0x1D07); # small caps E
$ent{'Lsc'} = chr(0x029F); # small caps L
Expand Down
3 changes: 3 additions & 0 deletions tools/ucwords.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1693,6 +1693,9 @@ ($)
tr/\x{0131}\x{0138}\x{013f}\x{0141}\x{0140}\x{0142}/ikLLll/;
tr/\x{014a}\x{0149}\x{014b}\x{00d8}\x{00f8}\x{017f}/NnnOos/;
tr/\x{00de}\x{0166}\x{00fe}\x{0167}/TTtt/;

# Small-caps phonetic letters.
tr/\x{1D00}\x{1D07}\x{00fe}\x{029F}/ael/;
}
return $string;
}
Expand Down
3 changes: 2 additions & 1 deletion xml2kwic.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,8 @@

<xsl:variable name="string" select="fn:replace($string, '&#x1D00;', 'a')"/> <!-- Latin Letter Small Capital A -->
<xsl:variable name="string" select="fn:replace($string, '&#x1D07;', 'e')"/> <!-- Latin Letter Small Capital E -->
<xsl:variable name="string" select="fn:replace($string, '&#x1D0C;', 'l')"/> <!-- Latin Letter Small Capital L -->
<xsl:variable name="string" select="fn:replace($string, '&#x029F;', 'l')"/> <!-- Latin Letter Small Capital L -->
<xsl:variable name="string" select="fn:replace($string, '&#x1D0C;', 'l')"/> <!-- Latin Letter Small Capital L with stroke -->

<!-- Hebrew script -->
<xsl:variable name="string" select="fn:replace($string, '&#xFB21;', '&#x05D0;')"/> <!-- Hebrew letter wide alef -> alef -->
Expand Down

0 comments on commit 2497dec

Please sign in to comment.