Skip to content

Commit

Permalink
More titles on cross-references in HTML.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhellingman committed Dec 18, 2024
1 parent 797abaf commit 58f0db3
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 58 deletions.
4 changes: 4 additions & 0 deletions locale/messages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<msg:message name="msgValues">Values</msg:message>
<msg:message name="msgFtpLink">Link to FTP server</msg:message>
<msg:message name="msgLinkToLibraryOfCongress">Link to Library of Congress record</msg:message>
<msg:message name="msgGoToNoteMark">Go to note <msg:param name="mark"/>.</msg:message>
<msg:message name="msgReturnToNoteInText">Return to note in text.</msg:message>
<msg:message name="msgReturnToNoteMarkInText">Return to note <msg:param name="mark"/> in text.</msg:message>

Expand Down Expand Up @@ -344,6 +345,7 @@
<msg:message name="msgText">Text</msg:message>
<msg:message name="msgTitlePage">Title Page</msg:message>
<msg:message name="msgToc">Contents</msg:message>
<msg:message name="msgGoToToc">Go to the table of contents</msg:message>
<msg:message name="msgTranscription">Transcription</msg:message>
<msg:message name="msgTranscriptions">Transcriptions</msg:message>
<msg:message name="msgUnknown">Unknown</msg:message>
Expand Down Expand Up @@ -1266,6 +1268,7 @@
<msg:message name="msgOccurrences">Aantal</msg:message>
<msg:message name="msgOccurrences.abbr">Aant.</msg:message>
<msg:message name="msgValues">Waarden</msg:message>
<msg:message name="msgGoToNoteMark">Ga naar noot <msg:param name="mark"/>.</msg:message>
<msg:message name="msgReturnToNoteInText">Ga terug naar noot in tekst.</msg:message>
<msg:message name="msgReturnToNoteMarkInText">Ga terug naar noot <msg:param name="mark"/> in tekst.</msg:message>

Expand Down Expand Up @@ -1559,6 +1562,7 @@
<msg:message name="msgText">Tekst</msg:message>
<msg:message name="msgTitlePage">Titelpagina</msg:message>
<msg:message name="msgToc">Inhoud</msg:message>
<msg:message name="msgGoToToc">Ga naar de inhoudsopgave</msg:message>
<msg:message name="msgTranscription">Transcriptie</msg:message>
<msg:message name="msgTranscriptions">Transcripties</msg:message>
<msg:message name="msgUnknown">Onbekend</msg:message>
Expand Down
4 changes: 4 additions & 0 deletions modules/block.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@
<xsl:template name="pb-margin">
<xsl:context-item as="element(pb)" use="required"/>
<span class="pageNum" id="{f:generate-id(.)}">
<xsl:if test="f:is-set('aria.enable')">
<xsl:attribute name="aria-hidden" select="'true'"/>
</xsl:if>

<xsl:if test="@n and f:is-set('pageNumbers.show')">
<xsl:value-of select="f:get-setting('pageNumbers.before')"/>
<a href="{f:generate-href(.)}">
Expand Down
2 changes: 2 additions & 0 deletions modules/configuration.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@
<images.maxWidth>720</images.maxWidth> <!-- Warn if image is wider than this number of pixels (after applying images.scale). -->
<images.maxHeight>720</images.maxHeight> <!-- Warn if image is taller than this number of pixels (after applying images.scale). -->

<aria.enable>false</aria.enable> <!-- Enable the generation of ARIA attributes on certain elements. -->

<audio.useControls>false</audio.useControls> <!-- Use controls for links to local audio (MP3, Midi, Ogg) formats (HTML5 only). -->

<text.parentheses>()[]{}</text.parentheses> <!-- Pairs of parentheses, first opening, then closing. -->
Expand Down
6 changes: 6 additions & 0 deletions modules/divisions.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,12 @@
<xsl:variable name="tocEntry" select="(//*[starts-with(@id, 'toc')]//ref[@target = $id])[1]"/>
<xsl:variable name="divGen" select="(//divGen[@id = 'toc'][@type = 'toc'])[1]"/>
<xsl:variable name="maxLevel" select="f:generated-toc-max-level($divGen)"/>

<xsl:if test="f:is-set('aria.enable')">
<xsl:attribute name="aria-label" select="f:message('msgGoToToc')"/>
</xsl:if>

<xsl:attribute name="title" select="f:message('msgGoToToc')"/>

<xsl:attribute name="href" select="
if ($tocEntry)
Expand Down
3 changes: 3 additions & 0 deletions modules/inline.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,9 @@
<xsl:value-of select="@value"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="f:is-set('aria.enable')">
<xsl:attribute name="aria-label" select="@value"/>
</xsl:if>
<xsl:apply-templates/>
</span>
</xsl:template>
Expand Down
25 changes: 19 additions & 6 deletions modules/notes.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,15 @@

<xsl:template name="insert-note-ref">
<xsl:context-item as="element(note)" use="required"/>
<a class="noteRef" id="{f:generate-id(.)}src" href="{f:generate-footnote-href(.)}">
<xsl:variable name="mark" select="f:note-marker(.)"/>
<a class="noteRef"
id="{f:generate-id(.)}src"
href="{f:generate-footnote-href(.)}"
title="{f:format-message('msgGoToNoteMark', map{'mark': $mark})}">
<xsl:if test="f:is-epub()">
<xsl:attribute name="epub:type" select="'noteref'"/>
</xsl:if>
<xsl:call-template name="footnote-number"/>
<xsl:value-of select="$mark"/>
</a>
</xsl:template>

Expand Down Expand Up @@ -339,9 +343,12 @@

<xsl:template name="footnote-marker">
<xsl:context-item as="element(note)" use="required"/>
<xsl:variable name="mark" select="f:note-marker(.)"/>
<span class="fnlabel">
<a class="noteRef" href="{f:generate-href(.)}src">
<xsl:value-of select="f:note-marker(.)"/>
<a class="noteRef"
href="{f:generate-href(.)}src"
title="{f:format-message('msgReturnToNoteMarkInText', map{'mark': $mark})}">
<xsl:value-of select="$mark"/>
</a>
</span>
<xsl:text> </xsl:text>
Expand Down Expand Up @@ -519,11 +526,17 @@

<xsl:template match="note[f:is-footnote(.)]" mode="noterefnumber">
<xsl:param name="sourceNote" as="element(note)"/>
<a class="pseudoNoteRef" id="{f:generate-id($sourceNote)}src" href="{f:generate-footnote-href(.)}">
<xsl:variable name="mark">
<xsl:call-template name="footnote-number"/>
</xsl:variable>
<a class="pseudoNoteRef"
id="{f:generate-id($sourceNote)}src"
href="{f:generate-footnote-href(.)}"
title="{f:format-message('msgGoToNoteMark', map{'mark': $mark})}">
<xsl:if test="f:is-epub()">
<xsl:attribute name="epub:type" select="'noteref'"/>
</xsl:if>
<xsl:call-template name="footnote-number"/>
<xsl:value-of select="$mark"/>
</a>
</xsl:template>

Expand Down
12 changes: 6 additions & 6 deletions xspec/divisions.xspec
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<h2 id="..." class="main">Division 1</h2>
</div>
<div class="divBody">
<p id="..." class="first">Paragraph 2.1<a class="noteRef" id="n.1src" href="#n.1">1</a></p>
<p id="..." class="first">Paragraph 2.1<a class="noteRef" id="n.1src" href="#n.1" title="Go to note 1.">1</a></p>
<p id="...">Paragraph 2.2</p>
</div>
<div class="footnotes">
Expand All @@ -104,7 +104,7 @@
<div class="fndiv" id="...">
<p class="footnote">
<span class="fnlabel">
<a class="noteRef" href="...">1</a>
<a class="noteRef" href="..." title="Return to note 1 in text.">1</a>
</span> Footnote 1.&nbsp;<a class="fnarrow" href="#n.1src" title="Return to note 1 in text.">&uparrow;</a>
</p>
</div>
Expand Down Expand Up @@ -318,7 +318,7 @@
</tr>
<tr>
<td class="first">
<p id="..." class="first">Paragraph 1.1<a class="noteRef" id="n.1src" href="#n.1">1</a></p>
<p id="..." class="first">Paragraph 1.1<a class="noteRef" id="n.1src" href="#n.1" title="Go to note 1.">1</a></p>
</td>
<td class="second">
<p id="..." class="first">Paragraph 2.1</p>
Expand All @@ -329,7 +329,7 @@
<p id="...">Paragraph 1.2</p>
</td>
<td class="second">
<p id="...">Paragraph 2.2<a class="noteRef" id="n.2src" href="#n.2">1</a></p>
<p id="...">Paragraph 2.2<a class="noteRef" id="n.2src" href="#n.2" title="Go to note 1.">1</a></p>
</td>
</tr>
<tr>
Expand All @@ -341,7 +341,7 @@
id="n.1">
<p class="footnote">
<span class="fnlabel">
<a class="noteRef" href="#n.1src">1</a>
<a class="noteRef" href="#n.1src" title="Return to note 1 in text.">1</a>
</span> Footnote 1.&nbsp;<a class="fnarrow" href="#n.1src" title="Return to note 1 in text.">&uparrow;</a>
</p>
</div>
Expand All @@ -356,7 +356,7 @@
id="n.2">
<p class="footnote">
<span class="fnlabel">
<a class="noteRef" href="#n.2src">1</a>
<a class="noteRef" href="#n.2src" title="Return to note 1 in text.">1</a>
</span> Footnote 2.&nbsp;<a class="fnarrow" href="#n.2src" title="Return to note 1 in text.">&uparrow;</a>
</p>
</div>
Expand Down
Loading

0 comments on commit 58f0db3

Please sign in to comment.