@pretextbook/pretext-html 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +160 -0
- package/assets/preview-html.xsl +230 -0
- package/assets/upstream.json +7 -0
- package/assets/xsl/README.md +31 -0
- package/assets/xsl/entities.ent +154 -0
- package/assets/xsl/extract-asymptote.xsl +68 -0
- package/assets/xsl/extract-biblio-csl.xsl +327 -0
- package/assets/xsl/extract-datafile.xsl +71 -0
- package/assets/xsl/extract-dynamic.xsl +139 -0
- package/assets/xsl/extract-identity.xsl +136 -0
- package/assets/xsl/extract-interactive.xsl +81 -0
- package/assets/xsl/extract-latex-image.xsl +118 -0
- package/assets/xsl/extract-mermaid.xsl +58 -0
- package/assets/xsl/extract-mom.xsl +63 -0
- package/assets/xsl/extract-pg.xsl +2897 -0
- package/assets/xsl/extract-prefigure.xsl +157 -0
- package/assets/xsl/extract-qrcode.xsl +100 -0
- package/assets/xsl/extract-runestone-page-template.xsl +139 -0
- package/assets/xsl/extract-sageplot.xsl +166 -0
- package/assets/xsl/extract-stack.xsl +56 -0
- package/assets/xsl/extract-trace.xsl +134 -0
- package/assets/xsl/extract-youtube.xsl +63 -0
- package/assets/xsl/html-symbols.xsl +3344 -0
- package/assets/xsl/latex/pretext-latex-AIM.xsl +56 -0
- package/assets/xsl/latex/pretext-latex-CLP.xsl +148 -0
- package/assets/xsl/latex/pretext-latex-chaos.xsl +317 -0
- package/assets/xsl/latex/pretext-latex-dyslexic-font.xsl +76 -0
- package/assets/xsl/latex/pretext-latex-guide.xsl +104 -0
- package/assets/xsl/latex/pretext-latex-texstyle.xsl +862 -0
- package/assets/xsl/localizations/README.md +56 -0
- package/assets/xsl/localizations/af-ZA.xml +276 -0
- package/assets/xsl/localizations/bg-BG.xml +276 -0
- package/assets/xsl/localizations/ca-ES.xml +285 -0
- package/assets/xsl/localizations/cs-CZ.xml +280 -0
- package/assets/xsl/localizations/de-DE.xml +281 -0
- package/assets/xsl/localizations/en-US.xml +427 -0
- package/assets/xsl/localizations/es-ES.xml +287 -0
- package/assets/xsl/localizations/fi-FI.xml +275 -0
- package/assets/xsl/localizations/fr-CA.xml +276 -0
- package/assets/xsl/localizations/fr-FR.xml +280 -0
- package/assets/xsl/localizations/hu-HU.xml +280 -0
- package/assets/xsl/localizations/it-IT.xml +276 -0
- package/assets/xsl/localizations/ku-CKB.xml +275 -0
- package/assets/xsl/localizations/localizations.xml +48 -0
- package/assets/xsl/localizations/nl-NL.xml +275 -0
- package/assets/xsl/localizations/pt-BR.xml +288 -0
- package/assets/xsl/localizations/pt-PT.xml +292 -0
- package/assets/xsl/localizations/zh-HANS.xml +269 -0
- package/assets/xsl/pretext-assembly.xsl +4795 -0
- package/assets/xsl/pretext-basic-html.xsl +86 -0
- package/assets/xsl/pretext-beamer.xsl +662 -0
- package/assets/xsl/pretext-braille-preprint.xsl +2249 -0
- package/assets/xsl/pretext-common.xsl +12018 -0
- package/assets/xsl/pretext-dynamic.xsl +65 -0
- package/assets/xsl/pretext-epub.xsl +1483 -0
- package/assets/xsl/pretext-fo.xsl +4593 -0
- package/assets/xsl/pretext-html.xsl +14791 -0
- package/assets/xsl/pretext-json-manifest.xsl +150 -0
- package/assets/xsl/pretext-jupyter.xsl +868 -0
- package/assets/xsl/pretext-latex-classic.xsl +952 -0
- package/assets/xsl/pretext-latex-common.xsl +11563 -0
- package/assets/xsl/pretext-latex.xsl +47 -0
- package/assets/xsl/pretext-litprog.xsl +105 -0
- package/assets/xsl/pretext-merge.xsl +41 -0
- package/assets/xsl/pretext-numbers.xsl +875 -0
- package/assets/xsl/pretext-revealjs.xsl +522 -0
- package/assets/xsl/pretext-runestone-fitb.xsl +1233 -0
- package/assets/xsl/pretext-runestone-static.xsl +1438 -0
- package/assets/xsl/pretext-runestone.xsl +3083 -0
- package/assets/xsl/pretext-sage-doctest.xsl +289 -0
- package/assets/xsl/pretext-smc.xsl +492 -0
- package/assets/xsl/pretext-solution-manual-latex.xsl +323 -0
- package/assets/xsl/pretext-text-utilities.xsl +1217 -0
- package/assets/xsl/pretext-text.xsl +392 -0
- package/assets/xsl/pretext-units.xsl +195 -0
- package/assets/xsl/pretext-view-source.xsl +157 -0
- package/assets/xsl/pretext-ww-problem-sets.xsl +391 -0
- package/assets/xsl/publisher-variables.xsl +4756 -0
- package/assets/xsl/support/README.md +22 -0
- package/assets/xsl/support/extract-math.xsl +256 -0
- package/assets/xsl/support/package-math.xsl +141 -0
- package/assets/xsl/support/play-button/README.md +46 -0
- package/assets/xsl/support/play-button/play-button.png +0 -0
- package/assets/xsl/support/play-button/play-button.svg +3 -0
- package/assets/xsl/support/pretext-pg-macros.xsl +110 -0
- package/assets/xsl/support/webpack_static_imports.xml +14 -0
- package/assets/xsl/tests/README.md +24 -0
- package/assets/xsl/tests/null.xml +4 -0
- package/assets/xsl/tests/pretext-text-utilities-test.xsl +334 -0
- package/assets/xsl/utilities/README.md +31 -0
- package/assets/xsl/utilities/author-report.xsl +107 -0
- package/assets/xsl/utilities/deprecate-autoname.sed +18 -0
- package/assets/xsl/utilities/deprecate-index.sed +33 -0
- package/assets/xsl/utilities/fix-deprecations.xsl +663 -0
- package/assets/xsl/utilities/pretext-enhanced-source.xsl +112 -0
- package/assets/xsl/utilities/report-publisher-variables.xsl +162 -0
- package/assets/xsl/xml-to-json.xsl +326 -0
- package/assets/xsl/xml-to-string.xsl +328 -0
- package/cli.mjs +29 -0
- package/dist/cli-C6tfAVvi.js +553 -0
- package/dist/cli.d.ts +10 -0
- package/dist/cli.js +7 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +10 -0
- package/dist/mounts.d.ts +23 -0
- package/dist/publication.d.ts +16 -0
- package/dist/renderer.d.ts +84 -0
- package/dist/sourcemap.d.ts +41 -0
- package/dist/xinclude.d.ts +45 -0
- package/package.json +52 -0
|
@@ -0,0 +1,2249 @@
|
|
|
1
|
+
<?xml version='1.0'?>
|
|
2
|
+
|
|
3
|
+
<!--********************************************************************
|
|
4
|
+
Copyright 2018 Robert A. Beezer
|
|
5
|
+
|
|
6
|
+
This file is part of MathBook XML.
|
|
7
|
+
|
|
8
|
+
MathBook XML is free software: you can redistribute it and/or modify
|
|
9
|
+
it under the terms of the GNU General Public License as published by
|
|
10
|
+
the Free Software Foundation, either version 2 or version 3 of the
|
|
11
|
+
License (at your option).
|
|
12
|
+
|
|
13
|
+
MathBook XML is distributed in the hope that it will be useful,
|
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
GNU General Public License for more details.
|
|
17
|
+
|
|
18
|
+
You should have received a copy of the GNU General Public License
|
|
19
|
+
along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*********************************************************************-->
|
|
21
|
+
|
|
22
|
+
<!-- http://pimpmyxslt.com/articles/entity-tricks-part2/ -->
|
|
23
|
+
<!DOCTYPE xsl:stylesheet [
|
|
24
|
+
<!ENTITY % entities SYSTEM "entities.ent">
|
|
25
|
+
%entities;
|
|
26
|
+
]>
|
|
27
|
+
|
|
28
|
+
<!-- Identify as a stylesheet -->
|
|
29
|
+
<!-- We choose to not include a default namespace -->
|
|
30
|
+
<!-- (in particular http://www.w3.org/1999/xhtml), -->
|
|
31
|
+
<!-- even if this complicates adding namespaces onto -->
|
|
32
|
+
<!-- derivatives, such as HTML destined for EPUB output -->
|
|
33
|
+
<!-- xmlns="http://www.w3.org/1999/xhtml" -->
|
|
34
|
+
<xsl:stylesheet
|
|
35
|
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
|
36
|
+
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
|
37
|
+
xmlns:pi="http://pretextbook.org/2020/pretext/internal"
|
|
38
|
+
xmlns:exsl="http://exslt.org/common"
|
|
39
|
+
xmlns:date="http://exslt.org/dates-and-times"
|
|
40
|
+
xmlns:str="http://exslt.org/strings"
|
|
41
|
+
extension-element-prefixes="pi exsl date str"
|
|
42
|
+
>
|
|
43
|
+
|
|
44
|
+
<!-- Standard conversion groundwork -->
|
|
45
|
+
<xsl:import href="./publisher-variables.xsl"/>
|
|
46
|
+
<xsl:import href="./pretext-assembly.xsl"/>
|
|
47
|
+
<xsl:import href="./pretext-common.xsl"/>
|
|
48
|
+
|
|
49
|
+
<!-- With @indent="yes" the (intermediate) file is much easier to study -->
|
|
50
|
+
<!-- and debug, but it introduces whitespace we can not (or do not want -->
|
|
51
|
+
<!-- to) control for. The situation is a single isolated sentence that -->
|
|
52
|
+
<!-- is entirely a font change. Here "isolated" means it becomes an -->
|
|
53
|
+
<!-- entire "segment", such as being between two "displays" when breaking -->
|
|
54
|
+
<!-- up a paragraph. For example, an entire sentence could be in italics, -->
|
|
55
|
+
<!-- thus leading to a "segment" with a child "italic" and nothing else. -->
|
|
56
|
+
<!-- The indentation provided introduces whitespace where we are expecting -->
|
|
57
|
+
<!-- mixed content. In old parlance, we expect a "segment" to be "tight". -->
|
|
58
|
+
<!-- We saw this just twice in all of AATA (2023-04-07) where a lone "m" -->
|
|
59
|
+
<!-- (plus absorbed punctuation) was caught between displays in a -->
|
|
60
|
+
<!-- paragraph, and the whitespace bled into a diff when the previous -->
|
|
61
|
+
<!-- commit led to the @indent suddenly being effective. -->
|
|
62
|
+
|
|
63
|
+
<xsl:output method="xml" indent="no" encoding="UTF-8"/>
|
|
64
|
+
|
|
65
|
+
<xsl:variable name="exercise-style" select="'static'"/>
|
|
66
|
+
|
|
67
|
+
<!-- Not so much "include" as "manipulate" -->
|
|
68
|
+
<xsl:param name="math.punctuation.include" select="'all'"/>
|
|
69
|
+
|
|
70
|
+
<!-- ############################## -->
|
|
71
|
+
<!-- Incorporate (Meld) Mathematics -->
|
|
72
|
+
<!-- ############################## -->
|
|
73
|
+
|
|
74
|
+
<!-- We do a pass (similar to those in the "pretext-assembly.xsl" -->
|
|
75
|
+
<!-- stylesheet. Purpose is to incorporate Nemeth braille versions -->
|
|
76
|
+
<!-- of mathematics, produced by MathJax/Speech RTule Engine. -->
|
|
77
|
+
|
|
78
|
+
<!-- Necessary to get pre-constructed Nemeth braille for math elements. -->
|
|
79
|
+
<!-- This file of math representations will come from another process -->
|
|
80
|
+
<!-- that involves mathJax and Speech Rule Engine (SRE). -->
|
|
81
|
+
<!-- Note: this is a manual step during development. -->
|
|
82
|
+
<xsl:param name="mathfile" select="''"/>
|
|
83
|
+
<xsl:variable name="math-repr" select="document($mathfile)/pi:math-representations"/>
|
|
84
|
+
|
|
85
|
+
<!-- Default xerox machine for "meld-math" pass -->
|
|
86
|
+
<xsl:template match="node()|@*" mode="meld-math">
|
|
87
|
+
<xsl:copy>
|
|
88
|
+
<xsl:apply-templates select="node()|@*" mode="meld-math"/>
|
|
89
|
+
</xsl:copy>
|
|
90
|
+
</xsl:template>
|
|
91
|
+
|
|
92
|
+
<!-- $math-repr is a "global" variable with "pi:math" elements -->
|
|
93
|
+
<xsl:key name="math-elts" match="pi:math" use="@id"/>
|
|
94
|
+
|
|
95
|
+
<!-- Replace math elements with a substructure: -->
|
|
96
|
+
<!-- math-original: the guts, simply xeroxed, necessary for -->
|
|
97
|
+
<!-- examining simple situations which do not require a -->
|
|
98
|
+
<!-- switch to Nemeth, or use simpler indicators -->
|
|
99
|
+
<!-- math-nemeth: unicode from SRE -->
|
|
100
|
+
<!-- NB: after a md[mrow] goes through MathJax/SRE there is -->
|
|
101
|
+
<!-- no "mrow" left. So they are absent in "math-nemeth". They -->
|
|
102
|
+
<!-- *are* present in "math-original" but that introduces a new -->
|
|
103
|
+
<!-- element in-between "md" and "mrow", so matches on -->
|
|
104
|
+
<!-- "md[mrow]" can be problematic here (and perhaps elsewhere). -->
|
|
105
|
+
<xsl:template match="m|md" mode="meld-math">
|
|
106
|
+
<!-- preserve author's element -->
|
|
107
|
+
<xsl:copy>
|
|
108
|
+
<!-- preserve attributes -->
|
|
109
|
+
<xsl:apply-templates select="@*" mode="meld-math"/>
|
|
110
|
+
<!-- get braille from representations file -->
|
|
111
|
+
<xsl:variable name="id">
|
|
112
|
+
<xsl:apply-templates select="." mode="unique-id"/>
|
|
113
|
+
</xsl:variable>
|
|
114
|
+
<math-original>
|
|
115
|
+
<xsl:apply-templates select="node()|@*" mode="meld-math"/>
|
|
116
|
+
</math-original>
|
|
117
|
+
<math-nemeth>
|
|
118
|
+
<xsl:for-each select="$math-repr">
|
|
119
|
+
<xsl:value-of select="key('math-elts', $id)/div[@class = 'braille']"/>
|
|
120
|
+
</xsl:for-each>
|
|
121
|
+
</math-nemeth>
|
|
122
|
+
</xsl:copy>
|
|
123
|
+
</xsl:template>
|
|
124
|
+
|
|
125
|
+
<!-- An additional pass melds math markup, starting from $root, the -->
|
|
126
|
+
<!-- final tree from -assembly. This stylesheet then works from the -->
|
|
127
|
+
<!-- melded tree, $melded-root, for its $docinfo and $document-root. -->
|
|
128
|
+
<xsl:variable name="math-meld-rtf">
|
|
129
|
+
<xsl:apply-templates select="$root" mode="meld-math"/>
|
|
130
|
+
</xsl:variable>
|
|
131
|
+
<xsl:variable name="melded-math" select="exsl:node-set($math-meld-rtf)"/>
|
|
132
|
+
|
|
133
|
+
<xsl:variable name="melded-root" select="$melded-math/pretext"/>
|
|
134
|
+
<xsl:variable name="docinfo" select="$melded-root/docinfo"/>
|
|
135
|
+
<xsl:variable name="document-root" select="$melded-root/*[not(self::docinfo)]"/>
|
|
136
|
+
|
|
137
|
+
<!-- Source analysis -->
|
|
138
|
+
|
|
139
|
+
<!-- We need to determine "how deep" the division hierarchy goes, so -->
|
|
140
|
+
<!-- we probe for depths of four and five. Note how specialized -->
|
|
141
|
+
<!-- divisions result in additional depth beyond traditional divisions. -->
|
|
142
|
+
<!-- (exercises|worksheet|handout|reading-questions|solutions|references|glossary) -->
|
|
143
|
+
|
|
144
|
+
<xsl:variable name="b-has-level-four" select="boolean(
|
|
145
|
+
$document-root//subsubsection
|
|
146
|
+
| $document-root//subsection/exercises
|
|
147
|
+
| $document-root//subsection/worksheet
|
|
148
|
+
| $document-root//subsection/handout
|
|
149
|
+
| $document-root//subsection/reading-questions
|
|
150
|
+
| $document-root//subsection/solutions
|
|
151
|
+
| $document-root//subsection/references
|
|
152
|
+
| $document-root//subsection/glossary)"/>
|
|
153
|
+
|
|
154
|
+
<xsl:variable name="b-has-level-five" select="boolean(
|
|
155
|
+
$document-root//subsubsection/exercises
|
|
156
|
+
| $document-root//subsubsection/worksheet
|
|
157
|
+
| $document-root//subsubsection/handout
|
|
158
|
+
| $document-root//subsubsection/reading-questions
|
|
159
|
+
| $document-root//subsubsection/solutions
|
|
160
|
+
| $document-root//subsubsection/references
|
|
161
|
+
| $document-root//subsubsection/glossary)"/>
|
|
162
|
+
|
|
163
|
+
<!-- And anything less -->
|
|
164
|
+
<xsl:variable name="b-has-level-three-or-less" select="not($b-has-level-four) and not($b-has-level-five)"/>
|
|
165
|
+
|
|
166
|
+
<!-- ###################### -->
|
|
167
|
+
<!-- Conversion to Segments -->
|
|
168
|
+
<!-- ###################### -->
|
|
169
|
+
|
|
170
|
+
<!-- A "segment" is a chunk of text that begins on a new line and finishes -->
|
|
171
|
+
<!-- with a partial line followed by a newline, ready for another segment. -->
|
|
172
|
+
<!-- Various properties, akin to the main tools of braille formatting, -->
|
|
173
|
+
<!-- affect how it is formatted into a BRF. The XSL analyzes the nature of -->
|
|
174
|
+
<!-- the text and its surrounding from preTeXt markup, so then Python gets -->
|
|
175
|
+
<!-- something that just describes how it should be formatted. -->
|
|
176
|
+
<!-- -->
|
|
177
|
+
<!-- This documents much of the transition from PreTeXt XML to an XML meant -->
|
|
178
|
+
<!-- only for Python text processing. -->
|
|
179
|
+
<!-- -->
|
|
180
|
+
<!-- Here we do not write anything when a default is correct, and then -->
|
|
181
|
+
<!-- Python (lxml) will interpret a "missing" attribute as the default, -->
|
|
182
|
+
<!-- and create something of the correct datatype for Python. -->
|
|
183
|
+
<!-- -->
|
|
184
|
+
<!-- @newpage - default: no, else yes -->
|
|
185
|
+
<!-- @centered - default: no, else yes -->
|
|
186
|
+
<!-- @breakable - default: yes, else no -->
|
|
187
|
+
<!-- @indentation - default: 0, else positive integer -->
|
|
188
|
+
<!-- @runover - default: 0, else positive integer -->
|
|
189
|
+
<!-- @lines-before - default: 0, else positive integer -->
|
|
190
|
+
<!-- @lines-after - default: 0, else positive integer -->
|
|
191
|
+
<!-- @lines-following - default: 0, else positive integer -->
|
|
192
|
+
|
|
193
|
+
<!-- This is the main event, hidden within the formulation of a -->
|
|
194
|
+
<!-- variable holding an RTF. This is formed by the totality of -->
|
|
195
|
+
<!-- non-modal templates. It will be converted into a node set, -->
|
|
196
|
+
<!-- for a post-processing step to incorporate "runin" -->
|
|
197
|
+
<!-- title/heading elements into a subsequent segment. -->
|
|
198
|
+
<xsl:variable name="segmented-rtf">
|
|
199
|
+
<xsl:call-template name="warning-unimplemented"/>
|
|
200
|
+
<xsl:call-template name="missing-warning"/>
|
|
201
|
+
<xsl:apply-templates select="$melded-root"/>
|
|
202
|
+
</xsl:variable>
|
|
203
|
+
|
|
204
|
+
<!-- And we sneak in a warning that this conversion is underway, but not complete. -->
|
|
205
|
+
<xsl:template name="warning-unimplemented">
|
|
206
|
+
<xsl:message>** Some PreTeXt elements lack full implementation in the braille conversion.</xsl:message>
|
|
207
|
+
<xsl:message>** Smaller items will simply be missing from your output.</xsl:message>
|
|
208
|
+
<xsl:message>** Larger items may have all-caps placeholders in your output.</xsl:message>
|
|
209
|
+
<xsl:message>** These will all be reported as "Overlooked" in the log.</xsl:message>
|
|
210
|
+
<xsl:message>** Please report the complete list in the PreTeXt support forum,</xsl:message>
|
|
211
|
+
<xsl:message>** so we can prioritize making the output for your project complete.</xsl:message>
|
|
212
|
+
</xsl:template>
|
|
213
|
+
|
|
214
|
+
<!-- The entry template "waits" for the "$math-meld-rtf" and -->
|
|
215
|
+
<!-- "$segmented-rtf" global variables to form, then the actual -->
|
|
216
|
+
<!-- output is a run of modal "meld-runin" templates as a sort -->
|
|
217
|
+
<!-- of post-processing step. -->
|
|
218
|
+
<xsl:template match="/">
|
|
219
|
+
<xsl:apply-templates select="exsl:node-set($segmented-rtf)/brf" mode="meld-runin"/>
|
|
220
|
+
</xsl:template>
|
|
221
|
+
|
|
222
|
+
<!-- Process segments here, looking for run-in titles/headings -->
|
|
223
|
+
<xsl:template match="segment" mode="meld-runin">
|
|
224
|
+
<!-- Look for "run-in" material just prior -->
|
|
225
|
+
<xsl:variable name="adjacent-runin" select="preceding-sibling::*[1][self::runin]"/>
|
|
226
|
+
<xsl:copy>
|
|
227
|
+
<xsl:apply-templates select="@*" mode="meld-runin"/>
|
|
228
|
+
<xsl:apply-templates select="$adjacent-runin/@indentation|$adjacent-runin/@lines-before" mode="meld-runin"/>
|
|
229
|
+
<xsl:apply-templates select="$adjacent-runin/node()" mode="meld-runin"/>
|
|
230
|
+
<xsl:value-of select="$adjacent-runin/@separator"/>
|
|
231
|
+
<xsl:apply-templates select="node()" mode="meld-runin"/>
|
|
232
|
+
</xsl:copy>
|
|
233
|
+
</xsl:template>
|
|
234
|
+
|
|
235
|
+
<!-- It is entirely possible for a segment to be preceded by -->
|
|
236
|
+
<!-- consecutive "runin" elements. Three examples: -->
|
|
237
|
+
<!-- -->
|
|
238
|
+
<!-- "proof" then "case" -->
|
|
239
|
+
<!-- "hint" then "li" (and other SOLUTION-LIKE) -->
|
|
240
|
+
<!-- "exercise" then "li" (but should probably be "task"?) -->
|
|
241
|
+
<!-- -->
|
|
242
|
+
<!-- Likely a structure with an immediate "p" with an immediate -->
|
|
243
|
+
<!-- list could result in a run-in title for the structure and -->
|
|
244
|
+
<!-- a run-in title for the first list item. Experimentation on -->
|
|
245
|
+
<!-- 2023-04-05 with Judson's AATA did not reveal any runs of -->
|
|
246
|
+
<!-- three (or more) consecutive "runin" elements. So our -->
|
|
247
|
+
<!-- solution is ad-hoc for the double case, with a bug report -->
|
|
248
|
+
<!-- for three or more. -->
|
|
249
|
+
<!-- We convert the first "runin" to a "segment" (rather than -->
|
|
250
|
+
<!-- killing it) and let the second "runin" get absorbed by the -->
|
|
251
|
+
<!-- subsequent "segment". -->
|
|
252
|
+
<xsl:template match="runin[following-sibling::*[1][self::runin]]" mode="meld-runin">
|
|
253
|
+
<segment>
|
|
254
|
+
<xsl:apply-templates select="@*|node()" mode="meld-runin"/>
|
|
255
|
+
</segment>
|
|
256
|
+
<xsl:if test="following-sibling::*[2][self::runin]">
|
|
257
|
+
<xsl:message>BUG: the braille conversion has encountered three "run-in" titles in a row,</xsl:message>
|
|
258
|
+
<xsl:message>which we had not expected. Please report me. Thank-you.</xsl:message>
|
|
259
|
+
<xsl:message>First: <xsl:value-of select="."/></xsl:message>
|
|
260
|
+
<xsl:message>Second: <xsl:value-of select="following-sibling::*[1][self::runin]"/></xsl:message>
|
|
261
|
+
<xsl:message>Third: <xsl:value-of select="following-sibling::*[2][self::runin]"/></xsl:message>
|
|
262
|
+
</xsl:if>
|
|
263
|
+
</xsl:template>
|
|
264
|
+
|
|
265
|
+
<!-- Every "runin" has been absorbed into a trailing "segment" or -->
|
|
266
|
+
<!-- perhaps converted into a "segment". This will prevent the -->
|
|
267
|
+
<!-- absorbed ones from persisting. -->
|
|
268
|
+
<xsl:template match="runin" mode="meld-runin"/>
|
|
269
|
+
|
|
270
|
+
<!-- Xerox machine -->
|
|
271
|
+
<xsl:template match="@*|node()" mode="meld-runin">
|
|
272
|
+
<xsl:copy>
|
|
273
|
+
<xsl:apply-templates select="@*|node()" mode="meld-runin"/>
|
|
274
|
+
</xsl:copy>
|
|
275
|
+
</xsl:template>
|
|
276
|
+
|
|
277
|
+
<!-- with /, so a plain generator can match others -->
|
|
278
|
+
<xsl:template match="/pretext">
|
|
279
|
+
<!-- Need an overall container -->
|
|
280
|
+
<!-- Maybe copy a language code? -->
|
|
281
|
+
<brf>
|
|
282
|
+
<!-- centered heading on line 1 -->
|
|
283
|
+
<segment centered="yes" lines-after="1">Transcriber Notes</segment>
|
|
284
|
+
<!-- Literal text for each note, control whitespace, -->
|
|
285
|
+
<!-- etc here, since it will not be handled otherwise -->
|
|
286
|
+
<xsl:if test="//c">
|
|
287
|
+
<!-- See "c" template for explanation -->
|
|
288
|
+
<segment indentation="2">
|
|
289
|
+
<xsl:text>Literal, or verbatim, computer code used in sentences is indicated by a set of transcriber-defined emphasis given by the following indicators, which all begin with the two cells dot-4 and dot-3456. Single letter: 4-3456-23. Begin, end word: 4-3456-2, 4-3456-3. Begin, end phrase: 4-3456-2356, 4-3456-3.</xsl:text>
|
|
290
|
+
</segment>
|
|
291
|
+
</xsl:if>
|
|
292
|
+
<!-- -->
|
|
293
|
+
<xsl:if test="//image">
|
|
294
|
+
<segment indentation="2">
|
|
295
|
+
<xsl:text>Images are replaced by authors' descriptions, and then in an embossed version, a full (numbered) page comes next, which can be manually replaced by a tactile version of the image.</xsl:text>
|
|
296
|
+
</segment>
|
|
297
|
+
</xsl:if>
|
|
298
|
+
<!-- -->
|
|
299
|
+
<xsl:if test="//sidebyside">
|
|
300
|
+
<segment indentation="2">
|
|
301
|
+
<xsl:text>A "side-by-side" is a horizontal layout of document elements. The components of a side-by-side are called "panels". Typically panels are images or figures, but can also be items like program listings, tables, or paragraphs. For braille, we let each panel use the full width of the page, so we announce the start, indicating the total number of panels. Then we preface each panel with its number in the sequence. Finally we announce the end because it may be hard to distinguish a final panel from the ensuing text.</xsl:text>
|
|
302
|
+
</segment>
|
|
303
|
+
</xsl:if>
|
|
304
|
+
<!-- -->
|
|
305
|
+
<!-- automatically infers we have a note already for "sidebyside" -->
|
|
306
|
+
<xsl:if test="//sbsgroup">
|
|
307
|
+
<segment indentation="2">
|
|
308
|
+
<xsl:text>A "side-by-side group" is a sequence down the page of "side-by-side" (see previous note). We announce the start with the number of side-by-side in the group to expect, and let the beginning and ending notes for each side-by-side delineate the sequence.</xsl:text>
|
|
309
|
+
</segment>
|
|
310
|
+
</xsl:if>
|
|
311
|
+
<!-- mention how "tabular" are implenented and suggest possible improvements-->
|
|
312
|
+
<xsl:if test="//tabular">
|
|
313
|
+
<segment indentation="2">
|
|
314
|
+
<xsl:text>Tabular material is always implemented using a "linear table format". A human transcriber may be able to improve small tables, or larger tables that could use multiple pages when embossed, by using a different format.</xsl:text>
|
|
315
|
+
</segment>
|
|
316
|
+
</xsl:if>
|
|
317
|
+
<!-- process segments and blocks of "brf" -->
|
|
318
|
+
<xsl:apply-templates select="*"/>
|
|
319
|
+
</brf>
|
|
320
|
+
</xsl:template>
|
|
321
|
+
|
|
322
|
+
<!-- ######### -->
|
|
323
|
+
<!-- Divisions -->
|
|
324
|
+
<!-- ######### -->
|
|
325
|
+
|
|
326
|
+
<!-- [BANA, 2016] 4.2.1 -->
|
|
327
|
+
<!-- As a general rule, centered headings are used to represent -->
|
|
328
|
+
<!-- the print headings of major sections of the text, and cell-5 -->
|
|
329
|
+
<!-- and cell-7 headings are used to represent the print headings -->
|
|
330
|
+
<!-- for subsections shown within major sections. When there are -->
|
|
331
|
+
<!-- more than three distinct heading levels in print, cell-7 -->
|
|
332
|
+
<!-- headings are applied only to the lowest hierarchy level; the -->
|
|
333
|
+
<!-- use of centered headings is extended to one or more subsection -->
|
|
334
|
+
<!-- levels as necessary. -->
|
|
335
|
+
|
|
336
|
+
<!-- Braille division headings are centered, indented 4 cells ("cell-5"), -->
|
|
337
|
+
<!-- or indented 6 cells ("cell-7"), along with blank lines possibly -->
|
|
338
|
+
<!-- before and after. Cell-7 is always terminal and is only used at one -->
|
|
339
|
+
<!-- level. To "fill" when there are more than three levels, centered -->
|
|
340
|
+
<!-- headings get extended. At the chapter level of a book, we start at -->
|
|
341
|
+
<!-- the top of a page, which somewhat distinguishes the centered style -->
|
|
342
|
+
<!-- of a chapter. From PreTeXt, division numbers (if used) are -->
|
|
343
|
+
<!-- unambiguous indicators of levels. -->
|
|
344
|
+
<!-- -->
|
|
345
|
+
<!-- Level book article -->
|
|
346
|
+
<!-- 1 chapter center center center -->
|
|
347
|
+
<!-- 2 section cell-5 center center center center center -->
|
|
348
|
+
<!-- 3 subsection cell-7 cell-5 center cell-7 cell-5 center -->
|
|
349
|
+
<!-- 4 subsubsection cell-7 cell-5 cell-7 cell-5 -->
|
|
350
|
+
<!-- 5 (specialized) cell-7 cell-7 -->
|
|
351
|
+
|
|
352
|
+
<!-- Divisions apparent in a rendered BRF. -->
|
|
353
|
+
<xsl:template match="chapter|appendix|index[index-list]|index-part|preface|acknowledgement|biography|foreword|dedication|colophon|section|subsection|subsubsection|slide|exercises|worksheet|handout|reading-questions|solutions|references|glossary">
|
|
354
|
+
|
|
355
|
+
<!-- Determine: newpage, centered, cell5, cell7 -->
|
|
356
|
+
<xsl:variable name="heading-style">
|
|
357
|
+
<xsl:apply-templates select="." mode="heading-style"/>
|
|
358
|
+
</xsl:variable>
|
|
359
|
+
|
|
360
|
+
<segment breakable="no" lines-following="1">
|
|
361
|
+
<!-- various attributes are fixed (above) or -->
|
|
362
|
+
<!-- vary according to the heading-style -->
|
|
363
|
+
<xsl:attribute name="newpage">
|
|
364
|
+
<xsl:choose>
|
|
365
|
+
<xsl:when test="$heading-style = 'newpage'">
|
|
366
|
+
<xsl:text>yes</xsl:text>
|
|
367
|
+
</xsl:when>
|
|
368
|
+
<xsl:otherwise>
|
|
369
|
+
<!-- Explicit defaults for Python, partially to get types right -->
|
|
370
|
+
<xsl:text>no</xsl:text>
|
|
371
|
+
</xsl:otherwise>
|
|
372
|
+
</xsl:choose>
|
|
373
|
+
</xsl:attribute>
|
|
374
|
+
<!-- -->
|
|
375
|
+
<xsl:attribute name="centered">
|
|
376
|
+
<xsl:choose>
|
|
377
|
+
<xsl:when test="($heading-style = 'newpage') or ($heading-style = 'centered')">
|
|
378
|
+
<xsl:text>yes</xsl:text>
|
|
379
|
+
</xsl:when>
|
|
380
|
+
<!-- Explicit defaults for Python, partially to get types right -->
|
|
381
|
+
<xsl:otherwise>
|
|
382
|
+
<xsl:text>no</xsl:text>
|
|
383
|
+
</xsl:otherwise>
|
|
384
|
+
</xsl:choose>
|
|
385
|
+
</xsl:attribute>
|
|
386
|
+
<!-- -->
|
|
387
|
+
<xsl:variable name="indentation">
|
|
388
|
+
<xsl:choose>
|
|
389
|
+
<xsl:when test="$heading-style = 'cell5'">
|
|
390
|
+
<xsl:text>4</xsl:text>
|
|
391
|
+
</xsl:when>
|
|
392
|
+
<xsl:when test="$heading-style = 'cell7'">
|
|
393
|
+
<xsl:text>6</xsl:text>
|
|
394
|
+
</xsl:when>
|
|
395
|
+
<!-- Explicit defaults for Python, partially to get types right -->
|
|
396
|
+
<xsl:otherwise>
|
|
397
|
+
<xsl:text>0</xsl:text>
|
|
398
|
+
</xsl:otherwise>
|
|
399
|
+
</xsl:choose>
|
|
400
|
+
</xsl:variable>
|
|
401
|
+
<!-- -->
|
|
402
|
+
<xsl:attribute name="indentation">
|
|
403
|
+
<xsl:value-of select="$indentation"/>
|
|
404
|
+
</xsl:attribute>
|
|
405
|
+
<!-- -->
|
|
406
|
+
<xsl:attribute name="runover">
|
|
407
|
+
<xsl:value-of select="$indentation"/>
|
|
408
|
+
</xsl:attribute>
|
|
409
|
+
<!-- Indicate a "line-before" whenever necessary for an -->
|
|
410
|
+
<!-- electronic version. Page formatting for an embossed -->
|
|
411
|
+
<!-- version will not include these at the start of a page. -->
|
|
412
|
+
<xsl:attribute name="lines-before">
|
|
413
|
+
<xsl:choose>
|
|
414
|
+
<xsl:when test="$heading-style = 'newpage'">
|
|
415
|
+
<xsl:text>1</xsl:text>
|
|
416
|
+
</xsl:when>
|
|
417
|
+
<!-- [BANA 2016], 4.4.1 -->
|
|
418
|
+
<!-- A centered heading is preceded and followed by a blank line. -->
|
|
419
|
+
<xsl:when test="$heading-style = 'centered'">
|
|
420
|
+
<xsl:text>1</xsl:text>
|
|
421
|
+
</xsl:when>
|
|
422
|
+
<xsl:when test="$heading-style = 'cell5'">
|
|
423
|
+
<xsl:text>1</xsl:text>
|
|
424
|
+
</xsl:when>
|
|
425
|
+
<xsl:when test="$heading-style = 'cell7'">
|
|
426
|
+
<xsl:text>1</xsl:text>
|
|
427
|
+
</xsl:when>
|
|
428
|
+
</xsl:choose>
|
|
429
|
+
</xsl:attribute>
|
|
430
|
+
<!-- -->
|
|
431
|
+
<xsl:attribute name="lines-after">
|
|
432
|
+
<xsl:choose>
|
|
433
|
+
<xsl:when test="$heading-style = 'newpage'">
|
|
434
|
+
<xsl:text>1</xsl:text>
|
|
435
|
+
</xsl:when>
|
|
436
|
+
<!-- [BANA 2016], 4.4.1 -->
|
|
437
|
+
<!-- A centered heading is preceded and followed by a blank line. -->
|
|
438
|
+
<xsl:when test="$heading-style = 'centered'">
|
|
439
|
+
<xsl:text>1</xsl:text>
|
|
440
|
+
</xsl:when>
|
|
441
|
+
<xsl:when test="$heading-style = 'cell5'">
|
|
442
|
+
<xsl:text>0</xsl:text>
|
|
443
|
+
</xsl:when>
|
|
444
|
+
<xsl:when test="$heading-style = 'cell7'">
|
|
445
|
+
<xsl:text>0</xsl:text>
|
|
446
|
+
</xsl:when>
|
|
447
|
+
</xsl:choose>
|
|
448
|
+
</xsl:attribute>
|
|
449
|
+
<!-- division headings go to the Table of Contents -->
|
|
450
|
+
<xsl:attribute name="heading-id">
|
|
451
|
+
<xsl:apply-templates select="." mode="unique-id"/>
|
|
452
|
+
</xsl:attribute>
|
|
453
|
+
<!-- TODO: record heading levels for indentation/runover in ToC -->
|
|
454
|
+
<!-- -->
|
|
455
|
+
<!-- Finally, the heading content itself -->
|
|
456
|
+
<xsl:variable name="the-number">
|
|
457
|
+
<xsl:apply-templates select="." mode="number"/>
|
|
458
|
+
</xsl:variable>
|
|
459
|
+
<xsl:if test="not($the-number = '')">
|
|
460
|
+
<xsl:value-of select="$the-number"/>
|
|
461
|
+
<xsl:text> </xsl:text>
|
|
462
|
+
</xsl:if>
|
|
463
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
464
|
+
</segment>
|
|
465
|
+
<!-- end heading segment, recurse into the -->
|
|
466
|
+
<!-- contents of the (structured) division -->
|
|
467
|
+
<xsl:apply-templates select="*"/>
|
|
468
|
+
</xsl:template>
|
|
469
|
+
|
|
470
|
+
<!-- Overall document "types/classes", level 0/-1 -->
|
|
471
|
+
<!-- Normalize so that: "chapter" is always level 1, "section" -->
|
|
472
|
+
<!-- is always level 2. We do not ever consult these specific -->
|
|
473
|
+
<!-- values for the document type/class, they are not imporant. -->
|
|
474
|
+
<!-- Also, the climb up the tree ends here. -->
|
|
475
|
+
<xsl:template match="book|article|slideshow|letter|memo" mode="braille-level">
|
|
476
|
+
<xsl:choose>
|
|
477
|
+
<!-- "book" with parts, make "part" level 0 -->
|
|
478
|
+
<xsl:when test="$b-has-parts">
|
|
479
|
+
<xsl:text>-1</xsl:text>
|
|
480
|
+
</xsl:when>
|
|
481
|
+
<xsl:otherwise>
|
|
482
|
+
<xsl:text>0</xsl:text>
|
|
483
|
+
</xsl:otherwise>
|
|
484
|
+
</xsl:choose>
|
|
485
|
+
</xsl:template>
|
|
486
|
+
|
|
487
|
+
<!-- Containiers, inherit from parent -->
|
|
488
|
+
<xsl:template match="frontmatter|backmatter" mode="braille-level">
|
|
489
|
+
<xsl:apply-templates select="parent::*" mode="braille-level"/>
|
|
490
|
+
</xsl:template>
|
|
491
|
+
|
|
492
|
+
<!-- True divisions, +1 from parent -->
|
|
493
|
+
<xsl:template match="part|chapter|appendix|index[index-list]|index-part|preface|acknowledgement|biography|foreword|dedication|colophon|section|subsection|subsubsection|slide|exercises|worksheet|handout|reading-questions|solutions|references|glossary" mode="braille-level">
|
|
494
|
+
<xsl:variable name="parent-level">
|
|
495
|
+
<xsl:apply-templates select="parent::*" mode="braille-level"/>
|
|
496
|
+
</xsl:variable>
|
|
497
|
+
<xsl:value-of select="$parent-level + 1"/>
|
|
498
|
+
</xsl:template>
|
|
499
|
+
|
|
500
|
+
<!-- Divisions apparent in a BRF. Four headings styles, -->
|
|
501
|
+
<!-- which we use to "define" how headings are formatted. -->
|
|
502
|
+
<!-- Specialized divisions can appear at many levels, but will -->
|
|
503
|
+
<!-- be formatted according to their level in the hierarchy. -->
|
|
504
|
+
<!-- See table above for explanation of choices here. -->
|
|
505
|
+
<xsl:template match="chapter|appendix|index[index-list]|index-part|preface|acknowledgement|biography|foreword|dedication|colophon|section|subsection|subsubsection|slide|exercises|worksheet|handout|reading-questions|solutions|references|glossary" mode="heading-style">
|
|
506
|
+
<xsl:variable name="braille-level">
|
|
507
|
+
<xsl:apply-templates select="." mode="braille-level"/>
|
|
508
|
+
</xsl:variable>
|
|
509
|
+
<xsl:choose>
|
|
510
|
+
<!-- chapters (of books) -->
|
|
511
|
+
<xsl:when test="$braille-level = 1">
|
|
512
|
+
<xsl:text>newpage</xsl:text>
|
|
513
|
+
</xsl:when>
|
|
514
|
+
<!-- sections (of books or articles) -->
|
|
515
|
+
<xsl:when test="$braille-level = 2">
|
|
516
|
+
<xsl:choose>
|
|
517
|
+
<xsl:when test="$b-has-level-three-or-less and $b-is-book">
|
|
518
|
+
<xsl:text>cell5</xsl:text>
|
|
519
|
+
</xsl:when>
|
|
520
|
+
<xsl:otherwise>
|
|
521
|
+
<xsl:text>centered</xsl:text>
|
|
522
|
+
</xsl:otherwise>
|
|
523
|
+
</xsl:choose>
|
|
524
|
+
</xsl:when>
|
|
525
|
+
<!-- -->
|
|
526
|
+
<xsl:when test="$braille-level = 3">
|
|
527
|
+
<xsl:choose>
|
|
528
|
+
<xsl:when test="$b-has-level-five">
|
|
529
|
+
<xsl:text>centered</xsl:text>
|
|
530
|
+
</xsl:when>
|
|
531
|
+
<xsl:when test="$b-has-level-four">
|
|
532
|
+
<xsl:text>cell5</xsl:text>
|
|
533
|
+
</xsl:when>
|
|
534
|
+
<xsl:otherwise>
|
|
535
|
+
<xsl:text>cell7</xsl:text>
|
|
536
|
+
</xsl:otherwise>
|
|
537
|
+
</xsl:choose>
|
|
538
|
+
</xsl:when>
|
|
539
|
+
<!-- -->
|
|
540
|
+
<xsl:when test="$braille-level = 4">
|
|
541
|
+
<xsl:choose>
|
|
542
|
+
<xsl:when test="$b-has-level-five">
|
|
543
|
+
<xsl:text>cell5</xsl:text>
|
|
544
|
+
</xsl:when>
|
|
545
|
+
<xsl:otherwise>
|
|
546
|
+
<xsl:text>cell7</xsl:text>
|
|
547
|
+
</xsl:otherwise>
|
|
548
|
+
</xsl:choose>
|
|
549
|
+
</xsl:when>
|
|
550
|
+
<!-- -->
|
|
551
|
+
<xsl:when test="$braille-level = 5">
|
|
552
|
+
<xsl:text>cell7</xsl:text>
|
|
553
|
+
</xsl:when>
|
|
554
|
+
<!-- -->
|
|
555
|
+
<xsl:otherwise>
|
|
556
|
+
<xsl:text>UNDEFINED</xsl:text>
|
|
557
|
+
</xsl:otherwise>
|
|
558
|
+
</xsl:choose>
|
|
559
|
+
</xsl:template>
|
|
560
|
+
|
|
561
|
+
<!-- ###################### -->
|
|
562
|
+
<!-- Exceptional Containers -->
|
|
563
|
+
<!-- ###################### -->
|
|
564
|
+
|
|
565
|
+
<!-- A special division: "paragraphs" -->
|
|
566
|
+
<xsl:template match="paragraphs">
|
|
567
|
+
<!-- Should be run-in with automatic space afterward -->
|
|
568
|
+
<xsl:if test="title">
|
|
569
|
+
<segment lines-before="1">
|
|
570
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
571
|
+
</segment>
|
|
572
|
+
</xsl:if>
|
|
573
|
+
<xsl:apply-templates select="*"/>
|
|
574
|
+
</xsl:template>
|
|
575
|
+
|
|
576
|
+
<!-- Very lightweight, title is optional, -->
|
|
577
|
+
<!-- and does not default to "SubExercises". -->
|
|
578
|
+
<xsl:template match="subexercises">
|
|
579
|
+
<xsl:if test="title">
|
|
580
|
+
<segment lines-before="1">
|
|
581
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
582
|
+
</segment>
|
|
583
|
+
</xsl:if>
|
|
584
|
+
<xsl:apply-templates select="introduction"/>
|
|
585
|
+
<xsl:apply-templates select="exercise|exercisegroup"/>
|
|
586
|
+
<xsl:apply-templates select="conclusion"/>
|
|
587
|
+
</xsl:template>
|
|
588
|
+
|
|
589
|
+
<!-- An "exercisegroup" is very visual, so -->
|
|
590
|
+
<!-- we delimit it with a transcriber note. -->
|
|
591
|
+
<xsl:template match="exercisegroup">
|
|
592
|
+
<xsl:apply-templates select="." mode="transcriber-note">
|
|
593
|
+
<xsl:with-param name="message">
|
|
594
|
+
<xsl:text>An exercise group follows. </xsl:text>
|
|
595
|
+
<!-- optional, so with trailing space -->
|
|
596
|
+
<xsl:if test="introduction">
|
|
597
|
+
<xsl:text>It begins with an introduction. </xsl:text>
|
|
598
|
+
</xsl:if>
|
|
599
|
+
<xsl:text>The exercises run from number </xsl:text>
|
|
600
|
+
<xsl:apply-templates select="exercise[1]" mode="serial-number"/>
|
|
601
|
+
<xsl:text> to number </xsl:text>
|
|
602
|
+
<xsl:apply-templates select="exercise[last()]" mode="serial-number"/>
|
|
603
|
+
<xsl:text>.</xsl:text>
|
|
604
|
+
<!-- optional, so with leading space -->
|
|
605
|
+
<xsl:if test="conclusion">
|
|
606
|
+
<xsl:text> It finishes with a conclusion.</xsl:text>
|
|
607
|
+
</xsl:if>
|
|
608
|
+
</xsl:with-param>
|
|
609
|
+
</xsl:apply-templates>
|
|
610
|
+
<!-- -->
|
|
611
|
+
<xsl:apply-templates select="introduction"/>
|
|
612
|
+
<xsl:apply-templates select="exercise"/>
|
|
613
|
+
<xsl:apply-templates select="conclusion"/>
|
|
614
|
+
</xsl:template>
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
<!-- ###### -->
|
|
618
|
+
<!-- Blocks -->
|
|
619
|
+
<!-- ###### -->
|
|
620
|
+
|
|
621
|
+
<!-- "Blocks" are major components of PreTeXt output. Typically -->
|
|
622
|
+
<!-- numbered, titled, set-off, and sometimes with subsidiary -->
|
|
623
|
+
<!-- pieces hanging off them. For braille, they might not -->
|
|
624
|
+
<!-- cross page boundaries, and may have box lines, etc. -->
|
|
625
|
+
<!-- -->
|
|
626
|
+
<!-- We handle the title as a heading of sorts, which might not -->
|
|
627
|
+
<!-- cross a page boundary, and which might be "stuck" on a -->
|
|
628
|
+
<!-- certain number of following lines. See the discussion below -->
|
|
629
|
+
<!-- about titles. -->
|
|
630
|
+
|
|
631
|
+
<!-- "Regular" blocks, including inline "exercise" (aka "Checkpoint") -->
|
|
632
|
+
<xsl:template match="&DEFINITION-LIKE;|&THEOREM-LIKE;|&AXIOM-LIKE;|&REMARK-LIKE;|&COMPUTATION-LIKE;|&ASIDE-LIKE;|&EXAMPLE-LIKE;|&PROJECT-LIKE;|&GOAL-LIKE;|&OPENPROBLEM-LIKE;|exercise[&INLINE-EXERCISE-FILTER;]|assemblage">
|
|
633
|
+
<block breakable="no" box="standard" lines-before="1" lines-after="1">
|
|
634
|
+
<xsl:apply-templates select="." mode="block-title"/>
|
|
635
|
+
<xsl:apply-templates select="*[not(self::title)]"/>
|
|
636
|
+
</block>
|
|
637
|
+
</xsl:template>
|
|
638
|
+
|
|
639
|
+
<!-- "Other" exercises (in "exercises" divisions, in "reading questions", -->
|
|
640
|
+
<!-- in worksheets) are not as prominent and have run-in titles -->
|
|
641
|
+
<xsl:template match="exercise[not(&INLINE-EXERCISE-FILTER;)]">
|
|
642
|
+
<xsl:apply-templates select="." mode="block-title"/>
|
|
643
|
+
<xsl:apply-templates select="*[not(self::title)]"/>
|
|
644
|
+
</xsl:template>
|
|
645
|
+
|
|
646
|
+
<!-- The appendages are not yet blocks, they live inside blocks -->
|
|
647
|
+
<!-- NOTE: if these become contained blocks, that is a structural change -->
|
|
648
|
+
<!-- that will require changes in the Python lxml which assumes otherwise -->
|
|
649
|
+
<xsl:template match="&PROOF-LIKE;|&SOLUTION-LIKE;|&DISCUSSION-LIKE;">
|
|
650
|
+
<xsl:apply-templates select="." mode="block-title"/>
|
|
651
|
+
<xsl:apply-templates select="*[not(self::title)]"/>
|
|
652
|
+
</xsl:template>
|
|
653
|
+
|
|
654
|
+
<!-- A "case" is a further division of a PROOF-LIKE -->
|
|
655
|
+
<xsl:template match="case">
|
|
656
|
+
<runin indentation="2" separator=" ">
|
|
657
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
658
|
+
</runin>
|
|
659
|
+
<xsl:apply-templates select="*"/>
|
|
660
|
+
</xsl:template>
|
|
661
|
+
|
|
662
|
+
<!-- Titles of blocks can be an entire "segment" if they finish with a -->
|
|
663
|
+
<!-- newline. Other titles are "runin" and are consolidated in a final -->
|
|
664
|
+
<!-- post-processing step. -->
|
|
665
|
+
|
|
666
|
+
<xsl:template match="&DEFINITION-LIKE;|&THEOREM-LIKE;|&AXIOM-LIKE;|&REMARK-LIKE;|&COMPUTATION-LIKE;|&ASIDE-LIKE;|&EXAMPLE-LIKE;|&PROJECT-LIKE;|&OPENPROBLEM-LIKE;|exercise[&INLINE-EXERCISE-FILTER;]" mode="block-title">
|
|
667
|
+
<segment lines-before="0">
|
|
668
|
+
<!-- -->
|
|
669
|
+
<xsl:apply-templates select="." mode="type-name"/>
|
|
670
|
+
<!-- -->
|
|
671
|
+
<xsl:variable name="the-number">
|
|
672
|
+
<xsl:apply-templates select="." mode="number"/>
|
|
673
|
+
</xsl:variable>
|
|
674
|
+
<xsl:if test="not($the-number = '')">
|
|
675
|
+
<xsl:text> </xsl:text>
|
|
676
|
+
<xsl:value-of select="$the-number"/>
|
|
677
|
+
</xsl:if>
|
|
678
|
+
<!-- -->
|
|
679
|
+
<xsl:if test="title">
|
|
680
|
+
<xsl:text> </xsl:text>
|
|
681
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
682
|
+
</xsl:if>
|
|
683
|
+
<!-- -->
|
|
684
|
+
</segment>
|
|
685
|
+
</xsl:template>
|
|
686
|
+
|
|
687
|
+
<!-- An assemblage is not numbered, it is just a box. The title is optional. -->
|
|
688
|
+
<xsl:template match="assemblage" mode="block-title">
|
|
689
|
+
<xsl:if test="title">
|
|
690
|
+
<segment lines-before="0">
|
|
691
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
692
|
+
</segment>
|
|
693
|
+
</xsl:if>
|
|
694
|
+
</xsl:template>
|
|
695
|
+
|
|
696
|
+
<!-- Should be run-in with automatic space afterward -->
|
|
697
|
+
<!-- There may be multiple proofs, but we do not number them at birth, -->
|
|
698
|
+
<!-- the number only gets used in a cross-reference. Maybe standalone -->
|
|
699
|
+
<!-- is different?? -->
|
|
700
|
+
<!-- TENTATIVE: DISCUSSION-LIKE may be identical -->
|
|
701
|
+
<xsl:template match="&PROOF-LIKE;|&DISCUSSION-LIKE;" mode="block-title">
|
|
702
|
+
<runin indentation="0" lines-before="1" separator=" ">
|
|
703
|
+
<!-- -->
|
|
704
|
+
<xsl:apply-templates select="." mode="type-name"/>
|
|
705
|
+
<xsl:text>.</xsl:text>
|
|
706
|
+
<!-- -->
|
|
707
|
+
<xsl:if test="title">
|
|
708
|
+
<xsl:text> </xsl:text>
|
|
709
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
710
|
+
</xsl:if>
|
|
711
|
+
<!-- -->
|
|
712
|
+
</runin>
|
|
713
|
+
</xsl:template>
|
|
714
|
+
|
|
715
|
+
<!-- Should be run-in with automatic space afterward -->
|
|
716
|
+
<xsl:template match="exercise[not(&INLINE-EXERCISE-FILTER;)]" mode="block-title">
|
|
717
|
+
<runin indentation="0" lines-before="1" separator=" ">
|
|
718
|
+
<xsl:apply-templates select="." mode="serial-number"/>
|
|
719
|
+
<xsl:text>.</xsl:text>
|
|
720
|
+
<!-- -->
|
|
721
|
+
<xsl:if test="title">
|
|
722
|
+
<xsl:text> (</xsl:text>
|
|
723
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
724
|
+
<xsl:text>)</xsl:text>
|
|
725
|
+
</xsl:if>
|
|
726
|
+
<!-- -->
|
|
727
|
+
</runin>
|
|
728
|
+
</xsl:template>
|
|
729
|
+
|
|
730
|
+
<!-- Should be run-in with automatic space afterward -->
|
|
731
|
+
<xsl:template match="&SOLUTION-LIKE;" mode="block-title">
|
|
732
|
+
<runin indentation="0" lines-before="1" separator=" ">
|
|
733
|
+
<!-- -->
|
|
734
|
+
<xsl:apply-templates select="." mode="type-name"/>
|
|
735
|
+
<!-- -->
|
|
736
|
+
<xsl:variable name="the-number">
|
|
737
|
+
<xsl:apply-templates select="." mode="non-singleton-number"/>
|
|
738
|
+
</xsl:variable>
|
|
739
|
+
<xsl:if test="not($the-number = '')">
|
|
740
|
+
<xsl:text> </xsl:text>
|
|
741
|
+
<xsl:value-of select="$the-number"/>
|
|
742
|
+
</xsl:if>
|
|
743
|
+
<xsl:text>.</xsl:text>
|
|
744
|
+
<!-- -->
|
|
745
|
+
<xsl:if test="title">
|
|
746
|
+
<xsl:text> (</xsl:text>
|
|
747
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
748
|
+
<xsl:text>)</xsl:text>
|
|
749
|
+
</xsl:if>
|
|
750
|
+
<!-- -->
|
|
751
|
+
</runin>
|
|
752
|
+
</xsl:template>
|
|
753
|
+
|
|
754
|
+
<!-- Print is "Type: Title", no number, since there is only one per -->
|
|
755
|
+
<!-- division and the number is implicitly that of the parent division. -->
|
|
756
|
+
<xsl:template match="&GOAL-LIKE;" mode="block-title">
|
|
757
|
+
<segment lines-before="0">
|
|
758
|
+
<!-- -->
|
|
759
|
+
<xsl:apply-templates select="." mode="type-name"/>
|
|
760
|
+
<!-- -->
|
|
761
|
+
<xsl:if test="title">
|
|
762
|
+
<xsl:text>: </xsl:text>
|
|
763
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
764
|
+
</xsl:if>
|
|
765
|
+
<!-- -->
|
|
766
|
+
</segment>
|
|
767
|
+
</xsl:template>
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
<!-- ########### -->
|
|
771
|
+
<!-- FIGURE-LIKE -->
|
|
772
|
+
<!-- ########### -->
|
|
773
|
+
|
|
774
|
+
<!-- [BANA, 2016] 6.2.2 -->
|
|
775
|
+
<!-- 7-5 margins for captions of "Illustrative Materials" -->
|
|
776
|
+
<!-- We generalize to titles of "table" and "list" blocks -->
|
|
777
|
+
|
|
778
|
+
<!-- [BANA, 2016] 6.2.2(e) -->
|
|
779
|
+
<!-- When both a print caption and a transcriber-generated description -->
|
|
780
|
+
<!-- are needed, begin the description (enclosed in transcriber's note -->
|
|
781
|
+
<!-- indicators) on the line following the caption. -->
|
|
782
|
+
<!-- Figures are treated different for the case where their contents are -->
|
|
783
|
+
<!-- images (thus requiring a tactile graphic page to follow the figure). -->
|
|
784
|
+
<xsl:template match="figure[image]">
|
|
785
|
+
<block breakable="no" box="standard" lines-before="1" lines-after="1">
|
|
786
|
+
<segment indentation="6" runover="4">
|
|
787
|
+
<xsl:apply-templates select="." mode="block-title"/>
|
|
788
|
+
</segment>
|
|
789
|
+
<xsl:apply-templates select="*[not(self::image)]"/>
|
|
790
|
+
<xsl:apply-templates select="image" mode="braille-representation"/>
|
|
791
|
+
</block>
|
|
792
|
+
<!-- Form a page to be replaced by tactile version -->
|
|
793
|
+
<block ownpage="yes">
|
|
794
|
+
<xsl:apply-templates select="." mode="transcriber-note">
|
|
795
|
+
<xsl:with-param name="message">
|
|
796
|
+
<xsl:text>Replace this page with </xsl:text>
|
|
797
|
+
<xsl:apply-templates select="." mode="block-title"/>
|
|
798
|
+
</xsl:with-param>
|
|
799
|
+
</xsl:apply-templates>
|
|
800
|
+
</block>
|
|
801
|
+
</xsl:template>
|
|
802
|
+
|
|
803
|
+
<!-- Other FIGURE-LIKE can be handled together -->
|
|
804
|
+
<xsl:template match="&FIGURE-LIKE;">
|
|
805
|
+
<block breakable="no" box="standard" lines-before="1" lines-after="1">
|
|
806
|
+
<segment indentation="6" runover="4">
|
|
807
|
+
<!-- [BANA, 2016, 11.17.1a] "Leave a blank line after the title." -->
|
|
808
|
+
<!-- Guidance for tables, we mimic for PTX "list" block. -->
|
|
809
|
+
<xsl:if test="self::table or self::list">
|
|
810
|
+
<xsl:attribute name="lines-after">
|
|
811
|
+
<xsl:text>1</xsl:text>
|
|
812
|
+
</xsl:attribute>
|
|
813
|
+
</xsl:if>
|
|
814
|
+
<xsl:apply-templates select="." mode="block-title"/>
|
|
815
|
+
</segment>
|
|
816
|
+
<xsl:apply-templates select="*"/>
|
|
817
|
+
</block>
|
|
818
|
+
</xsl:template>
|
|
819
|
+
|
|
820
|
+
<!-- Caption/title, with label, number, etc. "caption" and -->
|
|
821
|
+
<!-- "title" elements are metadata, killed in -common, -->
|
|
822
|
+
<!-- obtained as needed via modal templates. -->
|
|
823
|
+
<xsl:template match="&FIGURE-LIKE;" mode="block-title">
|
|
824
|
+
<xsl:apply-templates select="." mode="type-name"/>
|
|
825
|
+
<!-- -->
|
|
826
|
+
<xsl:variable name="the-number">
|
|
827
|
+
<xsl:apply-templates select="." mode="number"/>
|
|
828
|
+
</xsl:variable>
|
|
829
|
+
<xsl:if test="not($the-number = '')">
|
|
830
|
+
<xsl:text> </xsl:text>
|
|
831
|
+
<xsl:value-of select="$the-number"/>
|
|
832
|
+
</xsl:if>
|
|
833
|
+
<xsl:text>. </xsl:text>
|
|
834
|
+
<xsl:choose>
|
|
835
|
+
<xsl:when test="self::figure">
|
|
836
|
+
<xsl:apply-templates select="." mode="caption-full"/>
|
|
837
|
+
</xsl:when>
|
|
838
|
+
<xsl:when test="self::table|self::list|self::listing">
|
|
839
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
840
|
+
</xsl:when>
|
|
841
|
+
</xsl:choose>
|
|
842
|
+
</xsl:template>
|
|
843
|
+
|
|
844
|
+
<!-- ###### -->
|
|
845
|
+
<!-- Images -->
|
|
846
|
+
<!-- ###### -->
|
|
847
|
+
|
|
848
|
+
<!-- A bare image becomes a transcriber note with a small amount -->
|
|
849
|
+
<!-- of identification, and then generates a replacement page. -->
|
|
850
|
+
<xsl:template match="image">
|
|
851
|
+
<!-- A "segment" with the ID of the image to identify it, -->
|
|
852
|
+
<xsl:apply-templates select="." mode="transcriber-note">
|
|
853
|
+
<xsl:with-param name="message">
|
|
854
|
+
<xsl:apply-templates select="." mode="block-title"/>
|
|
855
|
+
</xsl:with-param>
|
|
856
|
+
</xsl:apply-templates>
|
|
857
|
+
<!-- Then the author's descriptions -->
|
|
858
|
+
<xsl:apply-templates select="." mode="braille-representation"/>
|
|
859
|
+
<!-- Form a page to be replaced by tactile version -->
|
|
860
|
+
<block ownpage="yes">
|
|
861
|
+
<xsl:apply-templates select="." mode="transcriber-note">
|
|
862
|
+
<xsl:with-param name="message">
|
|
863
|
+
<xsl:text>Replace this page with </xsl:text>
|
|
864
|
+
<xsl:apply-templates select="." mode="block-title"/>
|
|
865
|
+
</xsl:with-param>
|
|
866
|
+
</xsl:apply-templates>
|
|
867
|
+
</block>
|
|
868
|
+
</xsl:template>
|
|
869
|
+
|
|
870
|
+
<!-- A transcriber note replacing an image when included -->
|
|
871
|
+
<!-- in some other (identifying) structure. -->
|
|
872
|
+
<xsl:template match="image" mode="braille-representation">
|
|
873
|
+
<!-- A "segment" with the author's "shortdescription" -->
|
|
874
|
+
<xsl:if test="shortdescription">
|
|
875
|
+
<xsl:apply-templates select="." mode="transcriber-note">
|
|
876
|
+
<xsl:with-param name="message">
|
|
877
|
+
<xsl:apply-templates select="shortdescription"/>
|
|
878
|
+
</xsl:with-param>
|
|
879
|
+
</xsl:apply-templates>
|
|
880
|
+
</xsl:if>
|
|
881
|
+
</xsl:template>
|
|
882
|
+
|
|
883
|
+
<!-- Not really a title, but a repeated identification of an image -->
|
|
884
|
+
<!-- to coordinate text and manually inserted tactile versions. -->
|
|
885
|
+
<xsl:template match="image" mode="block-title">
|
|
886
|
+
<xsl:text>Image: </xsl:text>
|
|
887
|
+
<xsl:apply-templates select="." mode="visible-id"/>
|
|
888
|
+
<xsl:text>.</xsl:text>
|
|
889
|
+
</xsl:template>
|
|
890
|
+
|
|
891
|
+
<!-- ############ -->
|
|
892
|
+
<!-- Side-by-Side -->
|
|
893
|
+
<!-- ############ -->
|
|
894
|
+
|
|
895
|
+
<!-- We delimit the panels of a "sidebyside" with an introductory -->
|
|
896
|
+
<!-- transcriber note and a concluding note. Each panel is preceded -->
|
|
897
|
+
<!-- by a very short transcriber note giving its number in the sequence. -->
|
|
898
|
+
<!-- An "sbsgroup" only announces its start, but each "sidebyside" -->
|
|
899
|
+
<!-- introduction provides the number within the group. -->
|
|
900
|
+
<!-- -->
|
|
901
|
+
<!-- Otherwise, a "sidebyside" is just "linearized" and strung out down -->
|
|
902
|
+
<!-- pages, rather than across, since horizontal real estate is limited -->
|
|
903
|
+
<!-- and images are going full (own) page. -->
|
|
904
|
+
<!-- From discussion with Michael Cantino and Al Maneki, 2023-03-30 -->
|
|
905
|
+
|
|
906
|
+
<xsl:template match="sidebyside">
|
|
907
|
+
<xsl:variable name="npanels" select="count(*)"/>
|
|
908
|
+
<!-- Intro -->
|
|
909
|
+
<!-- At a 40-character width, this will fit on one line with -->
|
|
910
|
+
<!-- two cells to spare when the count is single-digit. -->
|
|
911
|
+
<xsl:apply-templates select="." mode="transcriber-note">
|
|
912
|
+
<xsl:with-param name="message">
|
|
913
|
+
<xsl:text>side-by-side: </xsl:text>
|
|
914
|
+
<!-- panels are simply child elements -->
|
|
915
|
+
<xsl:value-of select="$npanels"/>
|
|
916
|
+
<xsl:text> panels</xsl:text>
|
|
917
|
+
</xsl:with-param>
|
|
918
|
+
</xsl:apply-templates>
|
|
919
|
+
<!-- Panels -->
|
|
920
|
+
<xsl:for-each select="*">
|
|
921
|
+
<xsl:variable name="number" select="count(preceding-sibling::*) + 1"/>
|
|
922
|
+
<xsl:apply-templates select="." mode="transcriber-note">
|
|
923
|
+
<xsl:with-param name="message">
|
|
924
|
+
<xsl:text>panel: </xsl:text>
|
|
925
|
+
<xsl:value-of select="$number"/>
|
|
926
|
+
<xsl:text>/</xsl:text>
|
|
927
|
+
<xsl:value-of select="$npanels"/>
|
|
928
|
+
</xsl:with-param>
|
|
929
|
+
</xsl:apply-templates>
|
|
930
|
+
<!-- context switch, so self -->
|
|
931
|
+
<xsl:apply-templates select="."/>
|
|
932
|
+
</xsl:for-each>
|
|
933
|
+
<!-- Outro -->
|
|
934
|
+
<!-- This message mimics the format of the opening note -->
|
|
935
|
+
<xsl:apply-templates select="." mode="transcriber-note">
|
|
936
|
+
<xsl:with-param name="message">
|
|
937
|
+
<xsl:text>side-by-side: end</xsl:text>
|
|
938
|
+
</xsl:with-param>
|
|
939
|
+
</xsl:apply-templates>
|
|
940
|
+
</xsl:template>
|
|
941
|
+
|
|
942
|
+
<xsl:template match="sbsgroup">
|
|
943
|
+
<xsl:variable name="nsbs" select="count(sidebyside)"/>
|
|
944
|
+
<xsl:apply-templates select="." mode="transcriber-note">
|
|
945
|
+
<xsl:with-param name="message">
|
|
946
|
+
<xsl:text>side-by-side group: </xsl:text>
|
|
947
|
+
<xsl:value-of select="$nsbs"/>
|
|
948
|
+
<xsl:text> sbs</xsl:text>
|
|
949
|
+
</xsl:with-param>
|
|
950
|
+
</xsl:apply-templates>
|
|
951
|
+
<xsl:apply-templates select="*"/>
|
|
952
|
+
</xsl:template>
|
|
953
|
+
|
|
954
|
+
<!-- A "stack" is strictly a side-by-side panel and we just -->
|
|
955
|
+
<!-- process its children. No need to get carried away for -->
|
|
956
|
+
<!-- braille, and maybe an "apply-imports" (or nothing at -->
|
|
957
|
+
<!-- all) is the right thing to do. -->
|
|
958
|
+
<xsl:template match="stack">
|
|
959
|
+
<xsl:apply-templates select="*"/>
|
|
960
|
+
</xsl:template>
|
|
961
|
+
|
|
962
|
+
<!-- ##### -->
|
|
963
|
+
<!-- Lists -->
|
|
964
|
+
<!-- ##### -->
|
|
965
|
+
|
|
966
|
+
<!-- Lists are containers full of list items. All by -->
|
|
967
|
+
<!-- themselves they have no real impact on the braille -->
|
|
968
|
+
<!-- output. The list items are another matter. -->
|
|
969
|
+
<!-- 2023-04-06: very prelimnary, e.g. no runover -->
|
|
970
|
+
<!-- 2023-04-10: excessive nesting => excessive run-in -->
|
|
971
|
+
<xsl:template match="ul|ol|dl">
|
|
972
|
+
<xsl:apply-templates select="li"/>
|
|
973
|
+
</xsl:template>
|
|
974
|
+
|
|
975
|
+
<xsl:template match="li">
|
|
976
|
+
<!-- Marker as a "runin" element -->
|
|
977
|
+
<runin indentation="0" separator=" ">
|
|
978
|
+
<xsl:choose>
|
|
979
|
+
<xsl:when test="parent::ol">
|
|
980
|
+
<xsl:apply-templates select="." mode="item-number"/>
|
|
981
|
+
<xsl:text>.</xsl:text>
|
|
982
|
+
</xsl:when>
|
|
983
|
+
<xsl:when test="parent::ul">
|
|
984
|
+
<xsl:apply-templates select="." mode="unicode-list-marker"/>
|
|
985
|
+
<xsl:text>.</xsl:text>
|
|
986
|
+
</xsl:when>
|
|
987
|
+
<xsl:when test="parent::dl">
|
|
988
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
989
|
+
</xsl:when>
|
|
990
|
+
</xsl:choose>
|
|
991
|
+
</runin>
|
|
992
|
+
<xsl:apply-templates select="node()"/>
|
|
993
|
+
</xsl:template>
|
|
994
|
+
|
|
995
|
+
<xsl:template match="ul/li" mode="unicode-list-marker">
|
|
996
|
+
<xsl:variable name="format-code">
|
|
997
|
+
<xsl:apply-templates select="parent::ul" mode="format-code"/>
|
|
998
|
+
</xsl:variable>
|
|
999
|
+
<!-- The list label. The file en-ueb-chardefs.uti -->
|
|
1000
|
+
<!-- associates these Unicode values with the indicated -->
|
|
1001
|
+
<!-- dot patterns. This jibes with [BANA-2016, 8.6.2], -->
|
|
1002
|
+
<!-- which says the open circle needs a Grade 1 indicator. -->
|
|
1003
|
+
<!-- The file en-ueb-g2.ctb lists x25cb and x24a0 as -->
|
|
1004
|
+
<!-- both being "contraction" and so needing a -->
|
|
1005
|
+
<!-- Grade 1 indicator. -->
|
|
1006
|
+
<xsl:choose>
|
|
1007
|
+
<!-- Unicode Character 'BULLET' (U+2022) -->
|
|
1008
|
+
<!-- Dot pattern: 456-256 -->
|
|
1009
|
+
<xsl:when test="$format-code = 'disc'">
|
|
1010
|
+
<xsl:text>• </xsl:text>
|
|
1011
|
+
</xsl:when>
|
|
1012
|
+
<!-- Unicode Character 'WHITE CIRCLE' (U+25CB) -->
|
|
1013
|
+
<!-- Dot pattern: 1246-123456 -->
|
|
1014
|
+
<xsl:when test="$format-code = 'circle'">
|
|
1015
|
+
<xsl:text>○ </xsl:text>
|
|
1016
|
+
</xsl:when>
|
|
1017
|
+
<!-- Unicode Character 'BLACK SQUARE' (U+25A0) -->
|
|
1018
|
+
<!-- Dot pattern: 456-1246-3456-145 -->
|
|
1019
|
+
<xsl:when test="$format-code = 'square'">
|
|
1020
|
+
<xsl:text>■ </xsl:text>
|
|
1021
|
+
</xsl:when>
|
|
1022
|
+
<!-- a bad idea for Braille -->
|
|
1023
|
+
<xsl:when test="$format-code = 'none'">
|
|
1024
|
+
<xsl:text/>
|
|
1025
|
+
</xsl:when>
|
|
1026
|
+
</xsl:choose>
|
|
1027
|
+
</xsl:template>
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
<!-- ####################### -->
|
|
1031
|
+
<!-- Tabular (table content) -->
|
|
1032
|
+
<!-- ####################### -->
|
|
1033
|
+
|
|
1034
|
+
<!-- Simple tables can be realized nicely in braille by a human transcriber. -->
|
|
1035
|
+
<!-- We are not even sure how to identify a table as being "simple enough." -->
|
|
1036
|
+
<!-- -->
|
|
1037
|
+
<!-- So we implement "Wide Tables: Linear Table Format" [BANA, 2016, 11.17], -->
|
|
1038
|
+
<!-- which is never wrong, and is more or less sympatico with our markup. -->
|
|
1039
|
+
<!-- -->
|
|
1040
|
+
<!-- TODO: Suppose a transcriber *does* replace one of our tables with -->
|
|
1041
|
+
<!-- something better? We could perhaps capture the BRF version in a new -->
|
|
1042
|
+
<!-- "braille" element that lived in source and which was used -->
|
|
1043
|
+
<!-- preferentially once discovered. -->
|
|
1044
|
+
|
|
1045
|
+
<xsl:template match="tabular">
|
|
1046
|
+
<xsl:variable name="n-column-headings" select="count(row[(@header = 'yes') or (@header = 'vertical')])"/>
|
|
1047
|
+
<xsl:variable name="b-column-headings" select="$n-column-headings > 0"/>
|
|
1048
|
+
<xsl:variable name="b-row-headings" select="@row-headers = 'yes'"/>
|
|
1049
|
+
<block breakable="no">
|
|
1050
|
+
<!-- Transcriber note, if necessary to explain headings -->
|
|
1051
|
+
<xsl:if test="$b-column-headings or $b-row-headings">
|
|
1052
|
+
<xsl:apply-templates select="." mode="transcriber-note">
|
|
1053
|
+
<xsl:with-param name="message">
|
|
1054
|
+
<xsl:if test="$b-column-headings">
|
|
1055
|
+
<xsl:text>The first </xsl:text>
|
|
1056
|
+
<xsl:value-of select="$n-column-headings"/>
|
|
1057
|
+
<xsl:text> rows are columm headings, described next.</xsl:text>
|
|
1058
|
+
</xsl:if>
|
|
1059
|
+
<!-- separate two sentences, if we have both -->
|
|
1060
|
+
<xsl:if test="$b-column-headings and $b-row-headings">
|
|
1061
|
+
<xsl:text> </xsl:text>
|
|
1062
|
+
</xsl:if>
|
|
1063
|
+
<xsl:if test="$b-row-headings">
|
|
1064
|
+
<xsl:text>The first column of this table contains headings for the rows.</xsl:text>
|
|
1065
|
+
</xsl:if>
|
|
1066
|
+
</xsl:with-param>
|
|
1067
|
+
</xsl:apply-templates>
|
|
1068
|
+
<!-- [BANA, 2016] 11.17.1e "Leave a blank line after the note." -->
|
|
1069
|
+
<segment lines-after="1"/>
|
|
1070
|
+
</xsl:if>
|
|
1071
|
+
<!-- enforce header row(s) first -->
|
|
1072
|
+
<!-- BANA says put column headings inside the transcriber note, -->
|
|
1073
|
+
<!-- but switch to 1-3 margins. We ignore this and write the -->
|
|
1074
|
+
<!-- column headings out just tlike all the other rows. One -->
|
|
1075
|
+
<!-- concession: a blank line separator. -->
|
|
1076
|
+
<xsl:apply-templates select="row[(@header = 'yes') or (@header = 'vertical')]"/>
|
|
1077
|
+
<xsl:if test="$b-column-headings">
|
|
1078
|
+
<segment lines-after="1"/>
|
|
1079
|
+
</xsl:if>
|
|
1080
|
+
<!-- now the "regular" lines, possibly with row-headings -->
|
|
1081
|
+
<xsl:apply-templates select="row[not((@header = 'yes') or (@header = 'vertical'))]"/>
|
|
1082
|
+
</block>
|
|
1083
|
+
</xsl:template>
|
|
1084
|
+
|
|
1085
|
+
<!-- [BANA, 2016] 11.17.1f Each row has 1-3 margins -->
|
|
1086
|
+
<!-- [BANA, 2016] 11.17.1g "Do not divide a row between braille pages." -->
|
|
1087
|
+
<xsl:template match="tabular/row">
|
|
1088
|
+
<segment breakable="no" indentation="0" runover="2">
|
|
1089
|
+
<xsl:choose>
|
|
1090
|
+
<xsl:when test="(@header = 'yes') or (@header = 'vertical')">
|
|
1091
|
+
<xsl:apply-templates select="cell[1]" mode="describe-column-headings"/>
|
|
1092
|
+
</xsl:when>
|
|
1093
|
+
<xsl:otherwise>
|
|
1094
|
+
<xsl:apply-templates select="cell"/>
|
|
1095
|
+
</xsl:otherwise>
|
|
1096
|
+
</xsl:choose>
|
|
1097
|
+
</segment>
|
|
1098
|
+
</xsl:template>
|
|
1099
|
+
|
|
1100
|
+
<!-- "Regular" cells in non-header rows (more typical) -->
|
|
1101
|
+
<xsl:template match="tabular/row/cell">
|
|
1102
|
+
<xsl:apply-templates/>
|
|
1103
|
+
<xsl:choose>
|
|
1104
|
+
<!-- First cell, trailed by a colon -->
|
|
1105
|
+
<xsl:when test="not(preceding-sibling::cell)">
|
|
1106
|
+
<xsl:text>: </xsl:text>
|
|
1107
|
+
</xsl:when>
|
|
1108
|
+
<!-- Last cell, trailed by nothing -->
|
|
1109
|
+
<xsl:when test="not(following-sibling::cell)"/>
|
|
1110
|
+
<!-- Interior cells, trailed by semi-colons -->
|
|
1111
|
+
<xsl:otherwise>
|
|
1112
|
+
<xsl:text>; </xsl:text>
|
|
1113
|
+
</xsl:otherwise>
|
|
1114
|
+
</xsl:choose>
|
|
1115
|
+
<xsl:if test="@colspan">
|
|
1116
|
+
<xsl:call-template name="duplicate-string">
|
|
1117
|
+
<xsl:with-param name="count" select="@colspan - 1"/>
|
|
1118
|
+
<xsl:with-param name="text" select="';'"/>
|
|
1119
|
+
</xsl:call-template>
|
|
1120
|
+
</xsl:if>
|
|
1121
|
+
</xsl:template>
|
|
1122
|
+
|
|
1123
|
+
<xsl:template match="tabular/row/cell" mode="describe-column-headings">
|
|
1124
|
+
<xsl:param name="prior-column-number" select="0"/>
|
|
1125
|
+
|
|
1126
|
+
<!-- Analyze @colspan implications. Note this is correct for -->
|
|
1127
|
+
<!-- no attribute at all and a (silly) attribute value of 1. -->
|
|
1128
|
+
<xsl:variable name="first-column" select="$prior-column-number + 1"/>
|
|
1129
|
+
<xsl:variable name="n-columns">
|
|
1130
|
+
<xsl:choose>
|
|
1131
|
+
<xsl:when test="@colspan">
|
|
1132
|
+
<xsl:value-of select="@colspan"/>
|
|
1133
|
+
</xsl:when>
|
|
1134
|
+
<xsl:otherwise>
|
|
1135
|
+
<xsl:text>1</xsl:text>
|
|
1136
|
+
</xsl:otherwise>
|
|
1137
|
+
</xsl:choose>
|
|
1138
|
+
</xsl:variable>
|
|
1139
|
+
<xsl:variable name="last-column" select="$prior-column-number + $n-columns"/>
|
|
1140
|
+
<xsl:variable name="b-multicolumns" select="$last-column > $first-column"/>
|
|
1141
|
+
|
|
1142
|
+
<xsl:text>Column</xsl:text>
|
|
1143
|
+
<xsl:if test="$b-multicolumns">
|
|
1144
|
+
<xsl:text>s</xsl:text>
|
|
1145
|
+
</xsl:if>
|
|
1146
|
+
<xsl:text> </xsl:text>
|
|
1147
|
+
<xsl:value-of select="$first-column"/>
|
|
1148
|
+
<xsl:if test="$b-multicolumns">
|
|
1149
|
+
<xsl:text> - </xsl:text>
|
|
1150
|
+
<xsl:value-of select="$last-column"/>
|
|
1151
|
+
</xsl:if>
|
|
1152
|
+
<xsl:text> </xsl:text>
|
|
1153
|
+
<xsl:apply-templates/>
|
|
1154
|
+
<xsl:choose>
|
|
1155
|
+
<!-- First cell, trailed by a colon -->
|
|
1156
|
+
<xsl:when test="not(preceding-sibling::cell)">
|
|
1157
|
+
<xsl:text>: </xsl:text>
|
|
1158
|
+
</xsl:when>
|
|
1159
|
+
<!-- Last cell, trailed by nothing -->
|
|
1160
|
+
<xsl:when test="not(following-sibling::cell)"/>
|
|
1161
|
+
<!-- Interior cells, trailed by semi-colons -->
|
|
1162
|
+
<xsl:otherwise>
|
|
1163
|
+
<xsl:text>; </xsl:text>
|
|
1164
|
+
</xsl:otherwise>
|
|
1165
|
+
</xsl:choose>
|
|
1166
|
+
<!-- recurse if there is more to do -->
|
|
1167
|
+
<xsl:if test="following-sibling::cell">
|
|
1168
|
+
<xsl:apply-templates select="following-sibling::cell" mode="describe-column-headings">
|
|
1169
|
+
<xsl:with-param name="prior-column-number" select="$last-column"/>
|
|
1170
|
+
</xsl:apply-templates>
|
|
1171
|
+
</xsl:if>
|
|
1172
|
+
</xsl:template>
|
|
1173
|
+
|
|
1174
|
+
<!-- A "p" normally becomes a "segment". But an entire row of a "tabular" -->
|
|
1175
|
+
<!-- is a segment and we can't nest them. So we just dribble out the -->
|
|
1176
|
+
<!-- entire "p" without any indentation or anything, so it becomes one -->
|
|
1177
|
+
<!-- very long cell in the braille. Worse, two "p" in a cell will just -->
|
|
1178
|
+
<!-- get concatenated and the distinction between the two will be lost. -->
|
|
1179
|
+
<xsl:template match="cell/p">
|
|
1180
|
+
<xsl:apply-templates select="node()"/>
|
|
1181
|
+
<!-- At least provide a space between consecutive "p" -->
|
|
1182
|
+
<xsl:if test="following-sibling::p">
|
|
1183
|
+
<xsl:text>
</xsl:text>
|
|
1184
|
+
</xsl:if>
|
|
1185
|
+
</xsl:template>
|
|
1186
|
+
|
|
1187
|
+
|
|
1188
|
+
<!-- ########## -->
|
|
1189
|
+
<!-- References -->
|
|
1190
|
+
<!-- ########## -->
|
|
1191
|
+
|
|
1192
|
+
<!-- Bibliography [BANA-2016, 22.2.1] -->
|
|
1193
|
+
<!-- Bibliographic items in a "references" division have a -->
|
|
1194
|
+
<!-- bracketed number leading each new entry, then two spaces -->
|
|
1195
|
+
<!-- of indentation for the remainder . -->
|
|
1196
|
+
<!-- TODO: expand to accomodate annotations ("note"), BANA 22.3 -->
|
|
1197
|
+
<xsl:template match="biblio[@type='raw']">
|
|
1198
|
+
<runin indentation="0" separator=" ">
|
|
1199
|
+
<xsl:text>[</xsl:text>
|
|
1200
|
+
<xsl:apply-templates select="." mode="serial-number"/>
|
|
1201
|
+
<xsl:text>]</xsl:text>
|
|
1202
|
+
</runin>
|
|
1203
|
+
<segment indentation="0" runover="2">
|
|
1204
|
+
<xsl:apply-templates/>
|
|
1205
|
+
</segment>
|
|
1206
|
+
</xsl:template>
|
|
1207
|
+
|
|
1208
|
+
<!-- Override usual killing of title, but perhaps a generic -->
|
|
1209
|
+
<!-- template (without punctuation!) would be saner? -->
|
|
1210
|
+
<xsl:template match="biblio/title">
|
|
1211
|
+
<italic>
|
|
1212
|
+
<xsl:apply-templates/>
|
|
1213
|
+
</italic>
|
|
1214
|
+
</xsl:template>
|
|
1215
|
+
|
|
1216
|
+
<xsl:template match="volume">
|
|
1217
|
+
<bold>
|
|
1218
|
+
<xsl:apply-templates/>
|
|
1219
|
+
</bold>
|
|
1220
|
+
</xsl:template>
|
|
1221
|
+
|
|
1222
|
+
<!-- Generators -->
|
|
1223
|
+
|
|
1224
|
+
<xsl:template match="pretext">
|
|
1225
|
+
<xsl:text>PreTeXt</xsl:text>
|
|
1226
|
+
</xsl:template>
|
|
1227
|
+
|
|
1228
|
+
<xsl:template match="tex">
|
|
1229
|
+
<xsl:text>TeX</xsl:text>
|
|
1230
|
+
</xsl:template>
|
|
1231
|
+
|
|
1232
|
+
<xsl:template match="latex">
|
|
1233
|
+
<xsl:text>LaTeX</xsl:text>
|
|
1234
|
+
</xsl:template>
|
|
1235
|
+
|
|
1236
|
+
<!-- static, all "webwork" as problems are gone -->
|
|
1237
|
+
<xsl:template match="webwork">
|
|
1238
|
+
<xsl:text>WeBWorK</xsl:text>
|
|
1239
|
+
</xsl:template>
|
|
1240
|
+
|
|
1241
|
+
<xsl:template match="ie">
|
|
1242
|
+
<xsl:text>i.e.</xsl:text>
|
|
1243
|
+
</xsl:template>
|
|
1244
|
+
|
|
1245
|
+
<xsl:template match="etc">
|
|
1246
|
+
<xsl:text>etc.</xsl:text>
|
|
1247
|
+
</xsl:template>
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
<!-- Empty Elements, Characters -->
|
|
1251
|
+
|
|
1252
|
+
<!-- Generally Unicode values get translated into UEB equivalents -->
|
|
1253
|
+
<!-- by liblouis. This is based on a reading of -->
|
|
1254
|
+
<!-- -->
|
|
1255
|
+
<!-- /usr/share/liblouis/tables/en-ueb-chardefs.uti -->
|
|
1256
|
+
<!-- -->
|
|
1257
|
+
<!-- which is incorporated via the English-UEB Grade 1 and Grade 2 -->
|
|
1258
|
+
<!-- tables. As of 2023-05-12. We document the Unicode character -->
|
|
1259
|
+
<!-- and the cells described in the liblouis table. -->
|
|
1260
|
+
<!-- -->
|
|
1261
|
+
<!-- N.B. there is no attempt here to provide localizations, such -->
|
|
1262
|
+
<!-- as quotation mark styles, since we are limited ourselves to -->
|
|
1263
|
+
<!-- English language documents by larger decisions elsewhere. -->
|
|
1264
|
+
|
|
1265
|
+
<!-- Unicode Character 'NO-BREAK SPACE' (U+00A0) -->
|
|
1266
|
+
<!-- yields a template for "nbsp" in -common -->
|
|
1267
|
+
<!-- liblouis seems to pass this through in-kind -->
|
|
1268
|
+
<!-- Used in the manufacture of a cross-reference, -->
|
|
1269
|
+
<!-- we will want to strip just before it ends up -->
|
|
1270
|
+
<!-- in BRF . -->
|
|
1271
|
+
<xsl:template name="nbsp-character">
|
|
1272
|
+
<xsl:text> </xsl:text>
|
|
1273
|
+
</xsl:template>
|
|
1274
|
+
|
|
1275
|
+
<!-- Unicode Character 'EN DASH' (U+2013) -->
|
|
1276
|
+
<!-- Liblouis: 6-36 -->
|
|
1277
|
+
<xsl:template name="ndash-character">
|
|
1278
|
+
<xsl:text>–</xsl:text>
|
|
1279
|
+
</xsl:template>
|
|
1280
|
+
|
|
1281
|
+
<!-- Unicode Character 'EM DASH' (U+2014) -->
|
|
1282
|
+
<!-- Liblouis: 6-36 -->
|
|
1283
|
+
<xsl:template name="mdash-character">
|
|
1284
|
+
<xsl:text>—</xsl:text>
|
|
1285
|
+
</xsl:template>
|
|
1286
|
+
|
|
1287
|
+
<!-- Unicode Character 'COPYRIGHT SIGN' (U+00A9) -->
|
|
1288
|
+
<!-- Liblouis: 45-14 -->
|
|
1289
|
+
<xsl:template name="copyright-character">
|
|
1290
|
+
<xsl:text>©</xsl:text>
|
|
1291
|
+
</xsl:template>
|
|
1292
|
+
|
|
1293
|
+
<!-- Unicode Character 'REGISTERED SIGN' (U+00AE) -->
|
|
1294
|
+
<!-- Liblouis: 45-1235 -->
|
|
1295
|
+
<xsl:template name="registered-character">
|
|
1296
|
+
<xsl:text>®</xsl:text>
|
|
1297
|
+
</xsl:template>
|
|
1298
|
+
|
|
1299
|
+
<!-- Unicode Character 'TRADE MARK SIGN' (U+2122) -->
|
|
1300
|
+
<!-- Liblouis: 45-2345 -->
|
|
1301
|
+
<xsl:template name="trademark-character">
|
|
1302
|
+
<xsl:text>™</xsl:text>
|
|
1303
|
+
</xsl:template>
|
|
1304
|
+
|
|
1305
|
+
<!-- Unicode Character 'DEGREE SIGN' (U+00B0) -->
|
|
1306
|
+
<!-- Liblouis: 45-245 -->
|
|
1307
|
+
<xsl:template name="degree-character">
|
|
1308
|
+
<xsl:text>°</xsl:text>
|
|
1309
|
+
</xsl:template>
|
|
1310
|
+
|
|
1311
|
+
<!-- Unicode Character 'PRIME' (U+2032) -->
|
|
1312
|
+
<!-- Liblouis: 2356 -->
|
|
1313
|
+
<xsl:template name="prime-character">
|
|
1314
|
+
<xsl:text>′</xsl:text>
|
|
1315
|
+
</xsl:template>
|
|
1316
|
+
|
|
1317
|
+
<!-- Unicode Character 'DOUBLE PRIME' (U+2033) -->
|
|
1318
|
+
<!-- Liblouis: 2356-2356 -->
|
|
1319
|
+
<xsl:template name="dblprime-character">
|
|
1320
|
+
<xsl:text>″</xsl:text>
|
|
1321
|
+
</xsl:template>
|
|
1322
|
+
|
|
1323
|
+
<!-- Unicode Character 'LEFT SINGLE QUOTATION MARK' (U+2018) -->
|
|
1324
|
+
<!-- Liblouis: 6-236 -->
|
|
1325
|
+
<xsl:template match="*" mode="lsq-character">
|
|
1326
|
+
<xsl:text>‘</xsl:text>
|
|
1327
|
+
</xsl:template>
|
|
1328
|
+
|
|
1329
|
+
<!-- Unicode Character 'RIGHT SINGLE QUOTATION MARK' (U+2019) -->
|
|
1330
|
+
<!-- Liblouis: 6-356 -->
|
|
1331
|
+
<xsl:template match="*" mode="rsq-character">
|
|
1332
|
+
<xsl:text>’</xsl:text>
|
|
1333
|
+
</xsl:template>
|
|
1334
|
+
|
|
1335
|
+
<!-- Unicode Character 'LEFT DOUBLE QUOTATION MARK' (U+201C) -->
|
|
1336
|
+
<!-- Liblouis: 236 -->
|
|
1337
|
+
<xsl:template match="*" mode="lq-character">
|
|
1338
|
+
<xsl:text>“</xsl:text>
|
|
1339
|
+
</xsl:template>
|
|
1340
|
+
|
|
1341
|
+
<!-- Unicode Character 'RIGHT DOUBLE QUOTATION MARK' (U+201D) -->
|
|
1342
|
+
<!-- Liblouis: 356 -->
|
|
1343
|
+
<xsl:template match="*" mode="rq-character">
|
|
1344
|
+
<xsl:text>”</xsl:text>
|
|
1345
|
+
</xsl:template>
|
|
1346
|
+
|
|
1347
|
+
<!-- Unicode Character 'LEFT ANGLE BRACKET' (U+3008) -->
|
|
1348
|
+
<!-- Liblouis: 4-126 -->
|
|
1349
|
+
<xsl:template name="langle-character">
|
|
1350
|
+
<xsl:text>〈</xsl:text>
|
|
1351
|
+
</xsl:template>
|
|
1352
|
+
|
|
1353
|
+
<!-- Unicode Character 'RIGHT ANGLE BRACKET' (U+3009) -->
|
|
1354
|
+
<!-- Liblouis: 4-345 -->
|
|
1355
|
+
<xsl:template name="rangle-character">
|
|
1356
|
+
<xsl:text>〉</xsl:text>
|
|
1357
|
+
</xsl:template>
|
|
1358
|
+
|
|
1359
|
+
<!-- Unicode Character 'HORIZONTAL ELLIPSIS' (U+2026) -->
|
|
1360
|
+
<!-- Liblouis: 256-256-256 -->
|
|
1361
|
+
<!-- [BANA-2016] Appendix G, UEB is three periods/256 -->
|
|
1362
|
+
<xsl:template name="ellipsis-character">
|
|
1363
|
+
<xsl:text>…</xsl:text>
|
|
1364
|
+
</xsl:template>
|
|
1365
|
+
|
|
1366
|
+
<!-- Unicode Character 'MIDDLE DOT' (U+00B7) -->
|
|
1367
|
+
<!-- Liblouis: 4-16 -->
|
|
1368
|
+
<xsl:template name="midpoint-character">
|
|
1369
|
+
<xsl:text>·</xsl:text>
|
|
1370
|
+
</xsl:template>
|
|
1371
|
+
|
|
1372
|
+
<!-- Unicode Character 'SWUNG DASH' (U+2053) -->
|
|
1373
|
+
<!-- instead faking it with -->
|
|
1374
|
+
<!-- Unicode Character 'TILDE' (U+007E) -->
|
|
1375
|
+
<xsl:template name="swungdash-character">
|
|
1376
|
+
<xsl:text>~</xsl:text>
|
|
1377
|
+
</xsl:template>
|
|
1378
|
+
|
|
1379
|
+
<!-- Unicode Character 'PILCROW SIGN' (U+00B6) -->
|
|
1380
|
+
<!-- Liblouis: 45-1234 -->
|
|
1381
|
+
<xsl:template name="pilcrow-character">
|
|
1382
|
+
<xsl:text>¶</xsl:text>
|
|
1383
|
+
</xsl:template>
|
|
1384
|
+
|
|
1385
|
+
<!-- Unicode Character 'SECTION SIGN' (U+00A7) -->
|
|
1386
|
+
<!-- Liblouis: 45-234 -->
|
|
1387
|
+
<xsl:template name="section-mark-character">
|
|
1388
|
+
<xsl:text>§</xsl:text>
|
|
1389
|
+
</xsl:template>
|
|
1390
|
+
|
|
1391
|
+
<!-- Unicode Character 'MINUS SIGN' (U+2212) -->
|
|
1392
|
+
<!-- Liblouis: 5-36 -->
|
|
1393
|
+
<xsl:template name="minus-character">
|
|
1394
|
+
<xsl:text>−</xsl:text>
|
|
1395
|
+
</xsl:template>
|
|
1396
|
+
|
|
1397
|
+
<!-- Unicode Character 'MULTIPLICATION SIGN' (U+00D7) -->
|
|
1398
|
+
<!-- Liblouis: 5-236 -->
|
|
1399
|
+
<xsl:template name="times-character">
|
|
1400
|
+
<xsl:text>×</xsl:text>
|
|
1401
|
+
</xsl:template>
|
|
1402
|
+
|
|
1403
|
+
<!-- Unicode Character 'FRACTION SLASH' (U+2044) -->
|
|
1404
|
+
<!-- instead faking it with -->
|
|
1405
|
+
<!-- Unicode Character 'SOLIDUS' (U+002F) -->
|
|
1406
|
+
<xsl:template name="solidus-character">
|
|
1407
|
+
<xsl:text>/</xsl:text>
|
|
1408
|
+
</xsl:template>
|
|
1409
|
+
|
|
1410
|
+
<!-- Unicode Character 'DIVISION SIGN' (U+00F7) -->
|
|
1411
|
+
<!-- Liblouis: 5-34 -->
|
|
1412
|
+
<xsl:template name="obelus-character">
|
|
1413
|
+
<xsl:text>÷</xsl:text>
|
|
1414
|
+
</xsl:template>
|
|
1415
|
+
|
|
1416
|
+
<!-- Unicode Character 'PLUS-MINUS SIGN' (U+00B1) -->
|
|
1417
|
+
<!-- Liblouis: 456-235 -->
|
|
1418
|
+
<xsl:template name="plusminus-character">
|
|
1419
|
+
<xsl:text>±</xsl:text>
|
|
1420
|
+
</xsl:template>
|
|
1421
|
+
|
|
1422
|
+
<!-- Icons -->
|
|
1423
|
+
<!-- Just the four arrows, unsure about the rest -->
|
|
1424
|
+
<!-- Arrows are in liblouis table -->
|
|
1425
|
+
|
|
1426
|
+
<xsl:template match="icon">
|
|
1427
|
+
<xsl:choose>
|
|
1428
|
+
<xsl:when test="@name = 'arrow-left'">
|
|
1429
|
+
<xsl:text>←</xsl:text>
|
|
1430
|
+
</xsl:when>
|
|
1431
|
+
<xsl:when test="@name ='arrow-up'">
|
|
1432
|
+
<xsl:text>↑</xsl:text>
|
|
1433
|
+
</xsl:when>
|
|
1434
|
+
<xsl:when test="@name = 'arrow-right'">
|
|
1435
|
+
<xsl:text>→</xsl:text>
|
|
1436
|
+
</xsl:when>
|
|
1437
|
+
<xsl:when test="@name ='arrow-down'">
|
|
1438
|
+
<xsl:text>↓</xsl:text>
|
|
1439
|
+
</xsl:when>
|
|
1440
|
+
<xsl:otherwise>
|
|
1441
|
+
<xsl:message>WARNING: "icon" with @name attribute value "<xsl:value-of select="@name"/>" does not have an implementation for braille.</xsl:message>
|
|
1442
|
+
</xsl:otherwise>
|
|
1443
|
+
</xsl:choose>
|
|
1444
|
+
</xsl:template>
|
|
1445
|
+
|
|
1446
|
+
|
|
1447
|
+
<!-- ############ -->
|
|
1448
|
+
<!-- Font Changes -->
|
|
1449
|
+
<!-- ############ -->
|
|
1450
|
+
|
|
1451
|
+
<!-- Certain PreTeXt groupings in running text naturally yield just -->
|
|
1452
|
+
<!-- a font change. Braille and liblouis have facilities for italic -->
|
|
1453
|
+
<!-- and bold. This is "internal" markup that eventually gets -->
|
|
1454
|
+
<!-- interpreted by lxml in Python. -->
|
|
1455
|
+
|
|
1456
|
+
<!-- Italics -->
|
|
1457
|
+
<xsl:template match="em|foreign|articletitle|pubtitle">
|
|
1458
|
+
<!-- Python will assume "italic" as element name -->
|
|
1459
|
+
<italic>
|
|
1460
|
+
<xsl:apply-templates select="node()"/>
|
|
1461
|
+
</italic>
|
|
1462
|
+
</xsl:template>
|
|
1463
|
+
|
|
1464
|
+
<!-- Bold -->
|
|
1465
|
+
<xsl:template match="term|alert">
|
|
1466
|
+
<!-- Python will assume "bold" as element name -->
|
|
1467
|
+
<bold>
|
|
1468
|
+
<xsl:apply-templates select="node()"/>
|
|
1469
|
+
</bold>
|
|
1470
|
+
</xsl:template>
|
|
1471
|
+
|
|
1472
|
+
<!-- Biological Names -->
|
|
1473
|
+
<xsl:template match="taxon">
|
|
1474
|
+
<!-- In italic font -->
|
|
1475
|
+
<italic>
|
|
1476
|
+
<xsl:choose>
|
|
1477
|
+
<!-- both substructures -->
|
|
1478
|
+
<xsl:when test="genus and species">
|
|
1479
|
+
<xsl:apply-templates select="genus"/>
|
|
1480
|
+
<xsl:text> </xsl:text>
|
|
1481
|
+
<xsl:apply-templates select="species"/>
|
|
1482
|
+
</xsl:when>
|
|
1483
|
+
<!-- just one -->
|
|
1484
|
+
<xsl:when test="genus">
|
|
1485
|
+
<xsl:apply-templates select="genus"/>
|
|
1486
|
+
</xsl:when>
|
|
1487
|
+
<!-- just the other one -->
|
|
1488
|
+
<xsl:when test="species">
|
|
1489
|
+
<xsl:apply-templates select="species"/>
|
|
1490
|
+
</xsl:when>
|
|
1491
|
+
<!-- not structured, use content -->
|
|
1492
|
+
<xsl:otherwise>
|
|
1493
|
+
<xsl:apply-templates/>
|
|
1494
|
+
</xsl:otherwise>
|
|
1495
|
+
</xsl:choose>
|
|
1496
|
+
</italic>
|
|
1497
|
+
</xsl:template>
|
|
1498
|
+
|
|
1499
|
+
<!-- Code -->
|
|
1500
|
+
<!-- Accomplished in UEB Grade 2, but with transcriber emphasis scheme 1 -->
|
|
1501
|
+
<!-- from liblouis (where is this defined?). See liblouis table -->
|
|
1502
|
+
<!-- "en-ueb-g1.ctb" for exact definition of emphasis code "trans1". -->
|
|
1503
|
+
<!-- -->
|
|
1504
|
+
<!-- emphletter trans1 4-3456-23 -->
|
|
1505
|
+
<!-- begemphword trans1 4-3456-2 -->
|
|
1506
|
+
<!-- endemphword trans1 4-3456-3 -->
|
|
1507
|
+
<!-- lenemphphrase trans1 3 -->
|
|
1508
|
+
<!-- begemphphrase trans1 4-3456-2356 -->
|
|
1509
|
+
<!-- endemphphrase trans1 after 4-3456-3 -->
|
|
1510
|
+
<xsl:template name="code-wrapper">
|
|
1511
|
+
<xsl:param name="content"/>
|
|
1512
|
+
|
|
1513
|
+
<code>
|
|
1514
|
+
<xsl:value-of select="$content"/>
|
|
1515
|
+
</code>
|
|
1516
|
+
</xsl:template>
|
|
1517
|
+
|
|
1518
|
+
<!-- Pass-through/Dropped -->
|
|
1519
|
+
<xsl:template match="abbr|acro|init">
|
|
1520
|
+
<xsl:apply-templates select="node()"/>
|
|
1521
|
+
</xsl:template>
|
|
1522
|
+
|
|
1523
|
+
<!-- "idx" must be dealt with from source otherwise during -->
|
|
1524
|
+
<!-- index construction, but when encountered in a paragraph -->
|
|
1525
|
+
<!-- or a block they should just be killed. Should never -->
|
|
1526
|
+
<!-- reach an interior "h". Entirely similar for "notation" -->
|
|
1527
|
+
<!-- and an interior "usage", and "description". -->
|
|
1528
|
+
|
|
1529
|
+
<xsl:template match="idx|notation"/>
|
|
1530
|
+
|
|
1531
|
+
<!-- Documenting PreText itself -->
|
|
1532
|
+
|
|
1533
|
+
<xsl:template match="tag">
|
|
1534
|
+
<xsl:text><</xsl:text>
|
|
1535
|
+
<xsl:value-of select="."/>
|
|
1536
|
+
<xsl:text>></xsl:text>
|
|
1537
|
+
</xsl:template>
|
|
1538
|
+
|
|
1539
|
+
<xsl:template match="tage">
|
|
1540
|
+
<xsl:text><</xsl:text>
|
|
1541
|
+
<xsl:value-of select="."/>
|
|
1542
|
+
<xsl:text>/></xsl:text>
|
|
1543
|
+
</xsl:template>
|
|
1544
|
+
|
|
1545
|
+
<xsl:template match="attr">
|
|
1546
|
+
<xsl:text>@</xsl:text>
|
|
1547
|
+
<xsl:value-of select="."/>
|
|
1548
|
+
</xsl:template>
|
|
1549
|
+
|
|
1550
|
+
<!-- #### -->
|
|
1551
|
+
<!-- Math -->
|
|
1552
|
+
<!-- #### -->
|
|
1553
|
+
|
|
1554
|
+
<xsl:template match="m[not(contains(math-nemeth, '
'))]">
|
|
1555
|
+
<!-- Unicode braille cells from Speech Rule Engine (SRE) -->
|
|
1556
|
+
<!-- Not expecting any markup, so "value-of" is everything -->
|
|
1557
|
+
<xsl:variable name="raw-braille">
|
|
1558
|
+
<xsl:value-of select="math-nemeth"/>
|
|
1559
|
+
</xsl:variable>
|
|
1560
|
+
<!-- We investigate actual source for very simple math -->
|
|
1561
|
+
<!-- such as one-letter variable names as Latin letters -->
|
|
1562
|
+
<!-- or positive integers, so we process the orginal -->
|
|
1563
|
+
<!-- content outside of a MathJax/SRE translation (which -->
|
|
1564
|
+
<!-- could have "xref", etc) -->
|
|
1565
|
+
<xsl:variable name="content">
|
|
1566
|
+
<xsl:value-of select="math-original/node()"/>
|
|
1567
|
+
</xsl:variable>
|
|
1568
|
+
<xsl:variable name="original-content" select="normalize-space($content)"/>
|
|
1569
|
+
<!-- Note: this mark is *always* removed from the trailing text node, -->
|
|
1570
|
+
<!-- so we need to *always* restore it. In other wordds, we usually -->
|
|
1571
|
+
<!-- put it into an attribute to get picked up by lxml in the Python. -->
|
|
1572
|
+
<!-- But if we short-circuit that process here by turning integers into -->
|
|
1573
|
+
<!-- digits or making single-letter variables unadorned, then we need to -->
|
|
1574
|
+
<!-- restore the mark in this template. -->
|
|
1575
|
+
<xsl:variable name="clause-ending-mark">
|
|
1576
|
+
<xsl:apply-templates select="." mode="get-clause-punctuation-mark"/>
|
|
1577
|
+
</xsl:variable>
|
|
1578
|
+
<!-- Various cases, more specific first -->
|
|
1579
|
+
<xsl:choose>
|
|
1580
|
+
<!-- Inline math with just one Latin letter. No formatting, -->
|
|
1581
|
+
<!-- no italics, according to BANA rules via Michael Cantino -->
|
|
1582
|
+
<!-- (2023-01-26) so drop-in $original. C'est la vie. -->
|
|
1583
|
+
<xsl:when test="(string-length($original-content) = 1) and contains(&ALPHABET;, $original-content)">
|
|
1584
|
+
<xsl:value-of select="$original-content"/>
|
|
1585
|
+
<!-- restore clause-ending punctuation -->
|
|
1586
|
+
<xsl:value-of select="$clause-ending-mark"/>
|
|
1587
|
+
</xsl:when>
|
|
1588
|
+
<!-- Test is true for non-negative integers, which we drop into -->
|
|
1589
|
+
<!-- the stream as if they were never authored as math anyway -->
|
|
1590
|
+
<xsl:when test="translate($original-content, &DIGIT; ,'') = ''">
|
|
1591
|
+
<xsl:value-of select="$original-content"/>
|
|
1592
|
+
<!-- restore clause-ending punctuation -->
|
|
1593
|
+
<xsl:value-of select="$clause-ending-mark"/>
|
|
1594
|
+
</xsl:when>
|
|
1595
|
+
<!-- We construct a fragment for the Python formatter. -->
|
|
1596
|
+
<!-- SRE may convert inline "m" into a spatial layout, -->
|
|
1597
|
+
<!-- such as a fraction or column vector authored inline -->
|
|
1598
|
+
<!-- We treat this elsewhere, more like "md" elements -->
|
|
1599
|
+
<xsl:otherwise>
|
|
1600
|
+
<math>
|
|
1601
|
+
<!-- Add punctuation as an attribute conditionally. -->
|
|
1602
|
+
<!-- We could probably just add an empty string -->
|
|
1603
|
+
<!-- routinely and push that through to the closing -->
|
|
1604
|
+
<!-- Nemeth indicator, but we take a bit more care. -->
|
|
1605
|
+
<xsl:if test="not($clause-ending-mark = '')">
|
|
1606
|
+
<xsl:attribute name="punctuation">
|
|
1607
|
+
<xsl:value-of select="$clause-ending-mark"/>
|
|
1608
|
+
</xsl:attribute>
|
|
1609
|
+
</xsl:if>
|
|
1610
|
+
<xsl:value-of select="$raw-braille"/>
|
|
1611
|
+
</math>
|
|
1612
|
+
</xsl:otherwise>
|
|
1613
|
+
</xsl:choose>
|
|
1614
|
+
</xsl:template>
|
|
1615
|
+
|
|
1616
|
+
<xsl:template match="m[contains(math-nemeth, '
')]|md">
|
|
1617
|
+
<xsl:variable name="nemeth">
|
|
1618
|
+
<xsl:value-of select="math-nemeth"/>
|
|
1619
|
+
<xsl:text>
</xsl:text>
|
|
1620
|
+
</xsl:variable>
|
|
1621
|
+
<block breakable="no" box="nemeth">
|
|
1622
|
+
<xsl:attribute name="punctuation">
|
|
1623
|
+
<xsl:apply-templates select="." mode="get-clause-punctuation-mark"/>
|
|
1624
|
+
</xsl:attribute>
|
|
1625
|
+
<xsl:call-template name="segmentize-display-math">
|
|
1626
|
+
<xsl:with-param name="display-math" select="$nemeth"/>
|
|
1627
|
+
</xsl:call-template>
|
|
1628
|
+
</block>
|
|
1629
|
+
</xsl:template>
|
|
1630
|
+
|
|
1631
|
+
<xsl:template name="segmentize-display-math">
|
|
1632
|
+
<xsl:param name="display-math"/>
|
|
1633
|
+
|
|
1634
|
+
<xsl:choose>
|
|
1635
|
+
<!-- done, nothing left to work on -->
|
|
1636
|
+
<xsl:when test="$display-math = ''"/>
|
|
1637
|
+
<xsl:otherwise>
|
|
1638
|
+
<!-- first line into a segment -->
|
|
1639
|
+
<segment>
|
|
1640
|
+
<xsl:call-template name="trim-nemeth-trailing-whitespace">
|
|
1641
|
+
<xsl:with-param name="text" select="substring-before($display-math, '
')"/>
|
|
1642
|
+
</xsl:call-template>
|
|
1643
|
+
</segment>
|
|
1644
|
+
<!-- recurse on remainder -->
|
|
1645
|
+
<xsl:call-template name="segmentize-display-math">
|
|
1646
|
+
<xsl:with-param name="display-math" select="substring-after($display-math, '
')"/>
|
|
1647
|
+
</xsl:call-template>
|
|
1648
|
+
</xsl:otherwise>
|
|
1649
|
+
</xsl:choose>
|
|
1650
|
+
</xsl:template>
|
|
1651
|
+
|
|
1652
|
+
|
|
1653
|
+
<!-- ################ -->
|
|
1654
|
+
<!-- Cross-References -->
|
|
1655
|
+
<!-- ################ -->
|
|
1656
|
+
|
|
1657
|
+
<!-- Simple implementations of the basic -->
|
|
1658
|
+
<!-- components of a cross-reference -->
|
|
1659
|
+
|
|
1660
|
+
<!-- This device is just for the LaTeX conversion -->
|
|
1661
|
+
<xsl:template match="*" mode="xref-number">
|
|
1662
|
+
<xsl:apply-templates select="." mode="number"/>
|
|
1663
|
+
</xsl:template>
|
|
1664
|
+
|
|
1665
|
+
<!-- Nothing much to be done, we just -->
|
|
1666
|
+
<!-- xerox the text representation -->
|
|
1667
|
+
<xsl:template match="*" mode="xref-link">
|
|
1668
|
+
<xsl:param name="target" />
|
|
1669
|
+
<xsl:param name="content" />
|
|
1670
|
+
|
|
1671
|
+
<xsl:copy-of select="$content"/>
|
|
1672
|
+
</xsl:template>
|
|
1673
|
+
|
|
1674
|
+
<!-- #### -->
|
|
1675
|
+
<!-- URLs -->
|
|
1676
|
+
<!-- #### -->
|
|
1677
|
+
|
|
1678
|
+
<!-- Some technical debt: these to variables (or at least one) should -->
|
|
1679
|
+
<!-- perhaps be placed in -common rather than duplicating them. -->
|
|
1680
|
+
|
|
1681
|
+
<!-- 2023-03-06: these two vraiables have been copied verbatim from the HTML conversion -->
|
|
1682
|
+
|
|
1683
|
+
<xsl:template match="url|dataurl">
|
|
1684
|
+
<!-- link/reference/location may be external -->
|
|
1685
|
+
<!-- (@href) or internal (dataurl[@source]) -->
|
|
1686
|
+
<xsl:variable name="uri">
|
|
1687
|
+
<xsl:choose>
|
|
1688
|
+
<!-- "url" and "dataurl" both support external @href -->
|
|
1689
|
+
<xsl:when test="@href">
|
|
1690
|
+
<xsl:value-of select="@href"/>
|
|
1691
|
+
</xsl:when>
|
|
1692
|
+
<!-- a "dataurl" might be local, @source is -->
|
|
1693
|
+
<!-- indication, so prefix with a local path/URI -->
|
|
1694
|
+
<xsl:when test="self::dataurl and @source">
|
|
1695
|
+
<!-- empty when not using managed directories -->
|
|
1696
|
+
<xsl:value-of select="$external-directory"/>
|
|
1697
|
+
<xsl:value-of select="@source"/>
|
|
1698
|
+
</xsl:when>
|
|
1699
|
+
<!-- empty will be non-functional -->
|
|
1700
|
+
<xsl:otherwise/>
|
|
1701
|
+
</xsl:choose>
|
|
1702
|
+
</xsl:variable>
|
|
1703
|
+
<!-- visible portion of HTML is the URL itself, -->
|
|
1704
|
+
<!-- formatted as code, or content of PTX element -->
|
|
1705
|
+
<xsl:variable name="visible-text">
|
|
1706
|
+
<xsl:choose>
|
|
1707
|
+
<xsl:when test="node()">
|
|
1708
|
+
<xsl:apply-templates/>
|
|
1709
|
+
</xsl:when>
|
|
1710
|
+
<xsl:otherwise>
|
|
1711
|
+
<code class="code-inline tex2jax_ignore">
|
|
1712
|
+
<xsl:choose>
|
|
1713
|
+
<xsl:when test="@visual">
|
|
1714
|
+
<xsl:value-of select="@visual"/>
|
|
1715
|
+
</xsl:when>
|
|
1716
|
+
<xsl:otherwise>
|
|
1717
|
+
<xsl:value-of select="$uri"/>
|
|
1718
|
+
</xsl:otherwise>
|
|
1719
|
+
</xsl:choose>
|
|
1720
|
+
</code>
|
|
1721
|
+
</xsl:otherwise>
|
|
1722
|
+
</xsl:choose>
|
|
1723
|
+
</xsl:variable>
|
|
1724
|
+
|
|
1725
|
+
<xsl:value-of select="$visible-text"/>
|
|
1726
|
+
</xsl:template>
|
|
1727
|
+
|
|
1728
|
+
|
|
1729
|
+
<!-- ######### -->
|
|
1730
|
+
<!-- Footnotes -->
|
|
1731
|
+
<!-- ######### -->
|
|
1732
|
+
|
|
1733
|
+
<!-- Drop a mark at sight, Need to devise an -->
|
|
1734
|
+
<!-- add-on to division-processing to make endnotes -->
|
|
1735
|
+
<!-- [BANA-2016] 16.1.4(g): (print observations) -->
|
|
1736
|
+
<!-- In a note section, either at the end of each -->
|
|
1737
|
+
<!-- chapter or at the back of the book. -->
|
|
1738
|
+
<!-- [BANA-2016] 16.1.5(c): (braille placement) -->
|
|
1739
|
+
<!-- At the end of the chapter or volume. -->
|
|
1740
|
+
|
|
1741
|
+
<!-- BANA 16.2.2: superscripted number -->
|
|
1742
|
+
<!-- (two-cell indicator, number sign, number). -->
|
|
1743
|
+
<!-- TODO: collect footnote *content* at division ends -->
|
|
1744
|
+
<xsl:template match="fn">
|
|
1745
|
+
<!-- 5-6 3-5 -->
|
|
1746
|
+
<xsl:text>⠰⠔</xsl:text>
|
|
1747
|
+
<!-- A number sign is supplied by liblouis translation -->
|
|
1748
|
+
<!-- 2-4-5-6 U+283C -->
|
|
1749
|
+
<xsl:apply-templates select="." mode="number"/>
|
|
1750
|
+
<!-- trailing space necessary to end superscript? -->
|
|
1751
|
+
<!-- will get merged with any that already exists? -->
|
|
1752
|
+
<xsl:text> </xsl:text>
|
|
1753
|
+
</xsl:template>
|
|
1754
|
+
|
|
1755
|
+
|
|
1756
|
+
<!-- ################# -->
|
|
1757
|
+
<!-- Verbatim, Program -->
|
|
1758
|
+
<!-- ################# -->
|
|
1759
|
+
|
|
1760
|
+
<!-- Various templates elsewhere manipulate large chunks of verbatim text, -->
|
|
1761
|
+
<!-- such as for a "program". We leverage those as much as possible. -->
|
|
1762
|
+
<!-- Ideally we easily get a chunk of text, given as a sequence of lines -->
|
|
1763
|
+
<!-- defined by newline characters. The recursive "braille-source-code" -->
|
|
1764
|
+
<!-- template makes a "segment" for each line, this will allow for runover -->
|
|
1765
|
+
<!-- and *code* indentation without any ambiguity. So most of the braille -->
|
|
1766
|
+
<!-- formatting happens in this template. -->
|
|
1767
|
+
<!-- -->
|
|
1768
|
+
<!-- IMPORTANT: ensure that $text has a final newline character. -->
|
|
1769
|
+
|
|
1770
|
+
<xsl:template name="braille-source-code">
|
|
1771
|
+
<xsl:param name="text"/>
|
|
1772
|
+
|
|
1773
|
+
<xsl:choose>
|
|
1774
|
+
<!-- $text always ends in a newline, so final recursive call will -->
|
|
1775
|
+
<!-- have an empty string. This is the indication that we are done. -->
|
|
1776
|
+
<xsl:when test="$text = ''"/>
|
|
1777
|
+
<!-- Nonempty $text, so split it, and recurse -->
|
|
1778
|
+
<xsl:otherwise>
|
|
1779
|
+
<segment indentation="0" runover="0">
|
|
1780
|
+
<code>
|
|
1781
|
+
<xsl:value-of select="substring-before($text, '
')"/>
|
|
1782
|
+
</code>
|
|
1783
|
+
</segment>
|
|
1784
|
+
<xsl:call-template name="braille-source-code">
|
|
1785
|
+
<xsl:with-param name="text" select="substring-after($text, '
')"/>
|
|
1786
|
+
</xsl:call-template>
|
|
1787
|
+
</xsl:otherwise>
|
|
1788
|
+
</xsl:choose>
|
|
1789
|
+
</xsl:template>
|
|
1790
|
+
|
|
1791
|
+
<!-- A "cd" is structured with "cline" or not. We do not sanitize, that -->
|
|
1792
|
+
<!-- tis what the "cline"element is for - control over leading whitespace. -->
|
|
1793
|
+
<!-- We provide a final newline here for a bare "cd", otherwise the -->
|
|
1794
|
+
<!-- "cline" template provides it. -->
|
|
1795
|
+
<xsl:template match="cd">
|
|
1796
|
+
<block breakable="no">
|
|
1797
|
+
<xsl:call-template name="braille-source-code">
|
|
1798
|
+
<xsl:with-param name="text">
|
|
1799
|
+
<xsl:choose>
|
|
1800
|
+
<xsl:when test="cline">
|
|
1801
|
+
<xsl:apply-templates select="cline"/>
|
|
1802
|
+
</xsl:when>
|
|
1803
|
+
<xsl:otherwise>
|
|
1804
|
+
<xsl:value-of select="."/>
|
|
1805
|
+
<xsl:text>
</xsl:text>
|
|
1806
|
+
</xsl:otherwise>
|
|
1807
|
+
</xsl:choose>
|
|
1808
|
+
</xsl:with-param>
|
|
1809
|
+
</xsl:call-template>
|
|
1810
|
+
</block>
|
|
1811
|
+
</xsl:template>
|
|
1812
|
+
|
|
1813
|
+
<!-- "pre" and "pre[cline]" are handled by the "interior" -->
|
|
1814
|
+
<!-- modal template in -common. -->
|
|
1815
|
+
<!-- "pre" uses "sanitize-text", which provides a final -->
|
|
1816
|
+
<!-- newline, while "pre[cline]" uses the base "cline" -->
|
|
1817
|
+
<!-- template, which also provides a final newline. -->
|
|
1818
|
+
<xsl:template match="pre">
|
|
1819
|
+
<block breakable="no">
|
|
1820
|
+
<xsl:call-template name="braille-source-code">
|
|
1821
|
+
<xsl:with-param name="text">
|
|
1822
|
+
<xsl:apply-templates select="." mode="interior"/>
|
|
1823
|
+
</xsl:with-param>
|
|
1824
|
+
</xsl:call-template>
|
|
1825
|
+
</block>
|
|
1826
|
+
</xsl:template>
|
|
1827
|
+
|
|
1828
|
+
<!-- A "program" gets a lot of treatment in other formats to recognize -->
|
|
1829
|
+
<!-- the language an author specifies and then do some sort of syntax -->
|
|
1830
|
+
<!-- highlighting with fonts and colors. That would be hard in braille, -->
|
|
1831
|
+
<!-- and we don't know of a good tool anyway. So we just echo the -->
|
|
1832
|
+
<!-- "input" portion. -->
|
|
1833
|
+
<!-- "sanitize-text" provides a final newline, always -->
|
|
1834
|
+
<xsl:template match="program">
|
|
1835
|
+
<!-- build up full program text so we can apply sanitize-text to entire blob -->
|
|
1836
|
+
<!-- and thus allow relative indentation for preamble/code/postamble -->
|
|
1837
|
+
<xsl:variable name="program-text">
|
|
1838
|
+
<xsl:variable name="program-text">
|
|
1839
|
+
<xsl:if test="preamble[not(@visible = 'no')]">
|
|
1840
|
+
<xsl:call-template name="substring-before-last">
|
|
1841
|
+
<xsl:with-param name="input" select="preamble" />
|
|
1842
|
+
<xsl:with-param name="substr" select="'
'" />
|
|
1843
|
+
</xsl:call-template>
|
|
1844
|
+
</xsl:if>
|
|
1845
|
+
<xsl:call-template name="substring-before-last">
|
|
1846
|
+
<xsl:with-param name="input" select="code" />
|
|
1847
|
+
<xsl:with-param name="substr" select="'
'" />
|
|
1848
|
+
</xsl:call-template>
|
|
1849
|
+
<xsl:text>
</xsl:text>
|
|
1850
|
+
<xsl:if test="postamble[not(@visible = 'no')]">
|
|
1851
|
+
<xsl:value-of select="substring-after(postamble,'
')" />
|
|
1852
|
+
</xsl:if>
|
|
1853
|
+
</xsl:variable>
|
|
1854
|
+
</xsl:variable>
|
|
1855
|
+
<block breakable="no">
|
|
1856
|
+
<xsl:call-template name="braille-source-code">
|
|
1857
|
+
<xsl:with-param name="text">
|
|
1858
|
+
<xsl:call-template name="sanitize-text">
|
|
1859
|
+
<xsl:with-param name="text" select="$program-text" />
|
|
1860
|
+
</xsl:call-template>
|
|
1861
|
+
</xsl:with-param>
|
|
1862
|
+
</xsl:call-template>
|
|
1863
|
+
</block>
|
|
1864
|
+
</xsl:template>
|
|
1865
|
+
|
|
1866
|
+
<!-- For a "console" session, we work hardest on the "input", pulling in -->
|
|
1867
|
+
<!-- a preceding prompt, and considering the possibility of no "output". -->
|
|
1868
|
+
<!-- For "output", if extant, we provide necessary separators. -->
|
|
1869
|
+
|
|
1870
|
+
<xsl:template match="console">
|
|
1871
|
+
<!-- entire session as a block -->
|
|
1872
|
+
<block breakable="no" lines-before="1" lines-after="1">
|
|
1873
|
+
<!-- respect authored order, so don't split these -->
|
|
1874
|
+
<xsl:apply-templates select="input|output"/>
|
|
1875
|
+
</block>
|
|
1876
|
+
</xsl:template>
|
|
1877
|
+
|
|
1878
|
+
<xsl:template match="console/input">
|
|
1879
|
+
<xsl:variable name="console-input">
|
|
1880
|
+
<!-- prompt first, if provided; author provides -->
|
|
1881
|
+
<!-- any space that prompt would create -->
|
|
1882
|
+
<xsl:value-of select="preceding-sibling::*[1][self::prompt]"/>
|
|
1883
|
+
<!-- remainder of the input -->
|
|
1884
|
+
<xsl:call-template name="sanitize-text">
|
|
1885
|
+
<xsl:with-param name="text" select="."/>
|
|
1886
|
+
</xsl:call-template>
|
|
1887
|
+
</xsl:variable>
|
|
1888
|
+
<!-- now feed to braille-ification -->
|
|
1889
|
+
<xsl:call-template name="braille-source-code">
|
|
1890
|
+
<xsl:with-param name="text" select="$console-input"/>
|
|
1891
|
+
</xsl:call-template>
|
|
1892
|
+
<!-- add a blank line, only when not provided by the output -->
|
|
1893
|
+
<xsl:if test="not(following-sibling::*[1][self::output])">
|
|
1894
|
+
<segment lines-before="1"/>
|
|
1895
|
+
</xsl:if>
|
|
1896
|
+
</xsl:template>
|
|
1897
|
+
|
|
1898
|
+
<xsl:template match="console/output">
|
|
1899
|
+
<xsl:variable name="console-output">
|
|
1900
|
+
<!-- separate from the input -->
|
|
1901
|
+
<!-- NB: newline here necessary for textual version -->
|
|
1902
|
+
<xsl:text>---------------
</xsl:text>
|
|
1903
|
+
<!-- remainder of the input -->
|
|
1904
|
+
<xsl:call-template name="sanitize-text">
|
|
1905
|
+
<xsl:with-param name="text" select="."/>
|
|
1906
|
+
</xsl:call-template>
|
|
1907
|
+
</xsl:variable>
|
|
1908
|
+
<!-- now feed to braille-ification -->
|
|
1909
|
+
<xsl:call-template name="braille-source-code">
|
|
1910
|
+
<xsl:with-param name="text" select="$console-output"/>
|
|
1911
|
+
</xsl:call-template>
|
|
1912
|
+
<!-- and a blank line to help with session -->
|
|
1913
|
+
<segment lines-before="1"/>
|
|
1914
|
+
</xsl:template>
|
|
1915
|
+
|
|
1916
|
+
<!-- Sage cells rely on per-conversion overrides of presumed -->
|
|
1917
|
+
<!-- abstract templates, to handle the numerous possibilities. -->
|
|
1918
|
+
<!-- Using a long line to simulate input/output split -->
|
|
1919
|
+
|
|
1920
|
+
<xsl:template match="sage" mode="sage-active-markup">
|
|
1921
|
+
<xsl:param name="in" />
|
|
1922
|
+
<xsl:param name="out" />
|
|
1923
|
+
|
|
1924
|
+
<block breakable="no" lines-before="1" lines-after="1">
|
|
1925
|
+
<xsl:call-template name="braille-source-code">
|
|
1926
|
+
<xsl:with-param name="text" select="$in"/>
|
|
1927
|
+
</xsl:call-template>
|
|
1928
|
+
|
|
1929
|
+
<xsl:if test="not($out = '')">
|
|
1930
|
+
<segment>
|
|
1931
|
+
<xsl:text>-----------------</xsl:text>
|
|
1932
|
+
</segment>
|
|
1933
|
+
<xsl:call-template name="braille-source-code">
|
|
1934
|
+
<xsl:with-param name="text" select="$out"/>
|
|
1935
|
+
</xsl:call-template>
|
|
1936
|
+
</xsl:if>
|
|
1937
|
+
</block>
|
|
1938
|
+
</xsl:template>
|
|
1939
|
+
|
|
1940
|
+
<!-- Display only, just input -->
|
|
1941
|
+
<xsl:template name="sage-display-markup">
|
|
1942
|
+
<xsl:param name="in" />
|
|
1943
|
+
|
|
1944
|
+
<block breakable="no" lines-before="1" lines-after="1">
|
|
1945
|
+
<xsl:call-template name="braille-source-code">
|
|
1946
|
+
<xsl:with-param name="text" select="$in"/>
|
|
1947
|
+
</xsl:call-template>
|
|
1948
|
+
</block>
|
|
1949
|
+
</xsl:template>
|
|
1950
|
+
|
|
1951
|
+
|
|
1952
|
+
<!-- ############# -->
|
|
1953
|
+
<!-- Miscellaneous -->
|
|
1954
|
+
<!-- ############# -->
|
|
1955
|
+
|
|
1956
|
+
<!-- Containers that have zero metadata (no title, etc.) -->
|
|
1957
|
+
<xsl:template match="statement|introduction|conclusion">
|
|
1958
|
+
<xsl:apply-templates select="*"/>
|
|
1959
|
+
</xsl:template>
|
|
1960
|
+
|
|
1961
|
+
<!-- Just text nodes, but might have a WeBWorK -->
|
|
1962
|
+
<!-- "var", so process all children -->
|
|
1963
|
+
<xsl:template match="shortdescription">
|
|
1964
|
+
<xsl:apply-templates/>
|
|
1965
|
+
</xsl:template>
|
|
1966
|
+
|
|
1967
|
+
<!-- fillin blanks, outside math -->
|
|
1968
|
+
<!-- A fillin inside math will have disappeared on us by now, -->
|
|
1969
|
+
<!-- it was mixed into some LaTeX syntax and has been gobbled -->
|
|
1970
|
+
<!-- up by MathJax by now. So the conditional here is really -->
|
|
1971
|
+
<!-- moot and not necessary. -->
|
|
1972
|
+
<!-- [BANA, 2016] 10.6.2 and Michael Cantino: an underscore -->
|
|
1973
|
+
<!-- Seems to translate as a "sign": 46-36 in liblouis table -->
|
|
1974
|
+
<xsl:template match="fillin[not(parent::m or parent::mrow)]">
|
|
1975
|
+
<xsl:text>_</xsl:text>
|
|
1976
|
+
</xsl:template>
|
|
1977
|
+
|
|
1978
|
+
<!-- Fillin blanks, inside math -->
|
|
1979
|
+
<!-- For math see https://nemeth.aphtech.org/lesson3.5 4x U+2824 -->
|
|
1980
|
+
|
|
1981
|
+
<!-- ############ -->
|
|
1982
|
+
<!-- EXPERIMENTAL -->
|
|
1983
|
+
<!-- ############ -->
|
|
1984
|
+
|
|
1985
|
+
<!-- A paragraph without "displays" is straightforward and -->
|
|
1986
|
+
<!-- we can bypass the more complicated procedure next. -->
|
|
1987
|
+
<xsl:template match="p">
|
|
1988
|
+
<segment>
|
|
1989
|
+
<xsl:attribute name="indentation">
|
|
1990
|
+
<xsl:choose>
|
|
1991
|
+
<xsl:when test="@pi:indent = 'no'">
|
|
1992
|
+
<xsl:text>0</xsl:text>
|
|
1993
|
+
</xsl:when>
|
|
1994
|
+
<xsl:otherwise>
|
|
1995
|
+
<xsl:text>2</xsl:text>
|
|
1996
|
+
</xsl:otherwise>
|
|
1997
|
+
</xsl:choose>
|
|
1998
|
+
</xsl:attribute>
|
|
1999
|
+
<xsl:apply-templates select="node()"/>
|
|
2000
|
+
</segment>
|
|
2001
|
+
</xsl:template>
|
|
2002
|
+
|
|
2003
|
+
<!-- Two-dimensional displayed itmes will get their own segment and -->
|
|
2004
|
+
<!-- we will explode the rest of a "p" into pieces that are segments. -->
|
|
2005
|
+
<!-- But with indentation only on the first piece. -->
|
|
2006
|
+
<!-- Note: leading with a display in a "p" means no indentation. -->
|
|
2007
|
+
<!-- Note: this is derived from a similar template in the HTML -->
|
|
2008
|
+
<!-- conversion. -->
|
|
2009
|
+
<xsl:template match="p[ol|ul|dl|m[contains(math-nemeth, '
')]|md|cd]">
|
|
2010
|
+
<!-- will later loop over displays within paragraph -->
|
|
2011
|
+
<!-- match guarantees at least one for $initial variable -->
|
|
2012
|
+
<xsl:variable name="displays" select="ul|ol|dl|m[contains(math-nemeth, '
')]|md|cd" />
|
|
2013
|
+
<!-- content prior to first display is exceptional, but if empty, -->
|
|
2014
|
+
<!-- as indicated by $initial, we do not produce an empty paragraph -->
|
|
2015
|
+
<!-- -->
|
|
2016
|
+
<!-- all interesting nodes of paragraph, before first display -->
|
|
2017
|
+
<xsl:variable name="initial" select="$displays[1]/preceding-sibling::node()"/>
|
|
2018
|
+
<xsl:variable name="initial-content">
|
|
2019
|
+
<xsl:apply-templates select="$initial"/>
|
|
2020
|
+
</xsl:variable>
|
|
2021
|
+
<xsl:if test="not(normalize-space($initial-content) = '')">
|
|
2022
|
+
<segment indentation="2">
|
|
2023
|
+
<xsl:apply-templates select="$initial"/>
|
|
2024
|
+
</segment>
|
|
2025
|
+
</xsl:if>
|
|
2026
|
+
<!-- for each display, output the display, plus trailing content -->
|
|
2027
|
+
<xsl:for-each select="$displays">
|
|
2028
|
+
<!-- do the display proper -->
|
|
2029
|
+
<xsl:apply-templates select="."/>
|
|
2030
|
+
<!-- look through remainder, all element and text nodes, and the next display -->
|
|
2031
|
+
<xsl:variable name="rightward" select="following-sibling::node()" />
|
|
2032
|
+
<xsl:variable name="next-display" select="following-sibling::*[self::ul or self::ol or self::dl or self::m[contains(math-nemeth, '
')] or self::md or self::cd][1]" />
|
|
2033
|
+
<xsl:choose>
|
|
2034
|
+
<xsl:when test="$next-display">
|
|
2035
|
+
<xsl:variable name="leftward" select="$next-display/preceding-sibling::node()" />
|
|
2036
|
+
<!-- device below forms set intersection -->
|
|
2037
|
+
<xsl:variable name="common" select="$rightward[count(. | $leftward) = count($leftward)]" />
|
|
2038
|
+
<!-- Careful, punctuation after display math -->
|
|
2039
|
+
<!-- gets absorbed into display and so is a node -->
|
|
2040
|
+
<!-- that produces no content (cannot just count) -->
|
|
2041
|
+
<xsl:variable name="common-content">
|
|
2042
|
+
<xsl:apply-templates select="$common"/>
|
|
2043
|
+
</xsl:variable>
|
|
2044
|
+
<xsl:if test="not(normalize-space($common-content) = '')">
|
|
2045
|
+
<segment>
|
|
2046
|
+
<xsl:apply-templates select="$common"/>
|
|
2047
|
+
</segment>
|
|
2048
|
+
</xsl:if>
|
|
2049
|
+
</xsl:when>
|
|
2050
|
+
<xsl:otherwise>
|
|
2051
|
+
<!-- finish the trailing content, if nonempty -->
|
|
2052
|
+
<xsl:variable name="final-content">
|
|
2053
|
+
<xsl:apply-templates select="$rightward"/>
|
|
2054
|
+
</xsl:variable>
|
|
2055
|
+
<xsl:if test="not(normalize-space($final-content) = '')">
|
|
2056
|
+
<segment>
|
|
2057
|
+
<xsl:apply-templates select="$rightward"/>
|
|
2058
|
+
</segment>
|
|
2059
|
+
</xsl:if>
|
|
2060
|
+
</xsl:otherwise>
|
|
2061
|
+
</xsl:choose>
|
|
2062
|
+
</xsl:for-each>
|
|
2063
|
+
</xsl:template>
|
|
2064
|
+
|
|
2065
|
+
<!-- We support books and articles, though nothing in particular -->
|
|
2066
|
+
<!-- needs to be done at these root elements. Yet? -->
|
|
2067
|
+
<xsl:template match="book|article">
|
|
2068
|
+
<xsl:apply-templates select="*"/>
|
|
2069
|
+
</xsl:template>
|
|
2070
|
+
|
|
2071
|
+
<!-- "docinfo" should *always* be mined directly for pieces that affect output -->
|
|
2072
|
+
<xsl:template match="docinfo"/>
|
|
2073
|
+
|
|
2074
|
+
<!-- Many pieces of the "frontmatter" have templates designed for divisions -->
|
|
2075
|
+
<xsl:template match="frontmatter">
|
|
2076
|
+
<xsl:apply-templates select="*"/>
|
|
2077
|
+
</xsl:template>
|
|
2078
|
+
|
|
2079
|
+
<!-- The "titlepage" and front "colophon" should be mined to form front -->
|
|
2080
|
+
<!-- matter material in the right places, etc. We kill them for now so -->
|
|
2081
|
+
<!-- we don't see their children being overlooked. -->
|
|
2082
|
+
<xsl:template match="titlepage"/>
|
|
2083
|
+
<xsl:template match="frontmatter/colophon"/>
|
|
2084
|
+
|
|
2085
|
+
<!-- Many pieces of the "backmatter" have templates designed for divisions -->
|
|
2086
|
+
<xsl:template match="backmatter">
|
|
2087
|
+
<xsl:apply-templates select="*"/>
|
|
2088
|
+
</xsl:template>
|
|
2089
|
+
|
|
2090
|
+
|
|
2091
|
+
<!-- ############ -->
|
|
2092
|
+
<!-- EXPERIMENTAL -->
|
|
2093
|
+
<!-- ############ -->
|
|
2094
|
+
|
|
2095
|
+
<!-- These elements are fully handled by common (or by a braille -->
|
|
2096
|
+
<!-- character mode defined above), so the coverage catch-all at -->
|
|
2097
|
+
<!-- the end of this section excludes them in its "not(...)" -->
|
|
2098
|
+
<!-- list and they fall through, rather than report "Overlooked". -->
|
|
2099
|
+
<!-- This replaced a block of one-line "apply-imports" shims. -->
|
|
2100
|
+
|
|
2101
|
+
<!-- nbsp, ndash, mdash: characters defined above -->
|
|
2102
|
+
<!-- copyright, registered, trademark, degree, prime, dblprime, lsq, rsq, lq, rq, langle, rangle, ellipsis, midpoint, pilcrow, section-mark, minus, times, obelus, plusminus: empty character elements defined above -->
|
|
2103
|
+
<!-- phonomark, copyleft, servicemark, ldblbracket, rdblbracket, swungdash, permille, solidus: lack liblouis translations, so common's versions emit an accurate unimplemented-character warning (move a character up as it is implemented) -->
|
|
2104
|
+
<!-- q, sq, dblbrackets, angles: groupings of the characters above -->
|
|
2105
|
+
<!-- xref: xref-number and xref-link defined above -->
|
|
2106
|
+
<!-- today, timeofday: pure text in common -->
|
|
2107
|
+
<!-- ad, am, bc, ca, eg, etal, etc, ie, nb, pm, ps, vs, viz: Latin abbreviations, defined as text in common -->
|
|
2108
|
+
<!-- title, subtitle, shorttitle, plaintitle, creator: killed in common as metadata -->
|
|
2109
|
+
<!-- caption: killed in common as metadata -->
|
|
2110
|
+
<!-- cline: a simple template in common is active -->
|
|
2111
|
+
<!-- c: a simple template in common is active -->
|
|
2112
|
+
<!-- sage: handled in common -->
|
|
2113
|
+
<!-- rename: localizations happen in common -->
|
|
2114
|
+
|
|
2115
|
+
|
|
2116
|
+
<!-- Larger structures, needing implementation, *along with* interior -->
|
|
2117
|
+
<!-- structures. We report AND include a textual place holder. -->
|
|
2118
|
+
|
|
2119
|
+
<xsl:template match="notation-list">
|
|
2120
|
+
<xsl:text>NOTATIONLIST</xsl:text>
|
|
2121
|
+
</xsl:template>
|
|
2122
|
+
|
|
2123
|
+
<xsl:template match="index-list">
|
|
2124
|
+
<xsl:text>INDEXLIST</xsl:text>
|
|
2125
|
+
</xsl:template>
|
|
2126
|
+
|
|
2127
|
+
<xsl:template match="poem">
|
|
2128
|
+
<segment>POEM</segment>
|
|
2129
|
+
</xsl:template>
|
|
2130
|
+
|
|
2131
|
+
<!-- Next two are not structures, so as "text" -->
|
|
2132
|
+
|
|
2133
|
+
<xsl:template match="quantity">
|
|
2134
|
+
<xsl:text>QUANTITY</xsl:text>
|
|
2135
|
+
</xsl:template>
|
|
2136
|
+
|
|
2137
|
+
<xsl:template match="kbd">
|
|
2138
|
+
<xsl:text>KBD</xsl:text>
|
|
2139
|
+
</xsl:template>
|
|
2140
|
+
|
|
2141
|
+
<xsl:template name="missing-warning">
|
|
2142
|
+
<xsl:if test="//notation-list">
|
|
2143
|
+
<xsl:call-template name="missing-implementation">
|
|
2144
|
+
<xsl:with-param name="element" select="'notation-list'"/>
|
|
2145
|
+
<xsl:with-param name="ntimes" select="count(//notation-list)"/>
|
|
2146
|
+
</xsl:call-template>
|
|
2147
|
+
</xsl:if>
|
|
2148
|
+
<!-- -->
|
|
2149
|
+
<xsl:if test="//index-list">
|
|
2150
|
+
<xsl:call-template name="missing-implementation">
|
|
2151
|
+
<xsl:with-param name="element" select="'index-list'"/>
|
|
2152
|
+
<xsl:with-param name="ntimes" select="count(//index-list)"/>
|
|
2153
|
+
</xsl:call-template>
|
|
2154
|
+
</xsl:if>
|
|
2155
|
+
<xsl:if test="//poem">
|
|
2156
|
+
<xsl:call-template name="missing-implementation">
|
|
2157
|
+
<xsl:with-param name="element" select="'poem'"/>
|
|
2158
|
+
<xsl:with-param name="ntimes" select="count(//poem)"/>
|
|
2159
|
+
</xsl:call-template>
|
|
2160
|
+
</xsl:if>
|
|
2161
|
+
<!-- -->
|
|
2162
|
+
<xsl:if test="//quantity">
|
|
2163
|
+
<xsl:call-template name="missing-implementation">
|
|
2164
|
+
<xsl:with-param name="element" select="'quantity'"/>
|
|
2165
|
+
<xsl:with-param name="ntimes" select="count(//quantity)"/>
|
|
2166
|
+
</xsl:call-template>
|
|
2167
|
+
</xsl:if>
|
|
2168
|
+
<!-- -->
|
|
2169
|
+
<xsl:if test="//kbd">
|
|
2170
|
+
<xsl:call-template name="missing-implementation">
|
|
2171
|
+
<xsl:with-param name="element" select="'kbd'"/>
|
|
2172
|
+
<xsl:with-param name="ntimes" select="count(//kbd)"/>
|
|
2173
|
+
</xsl:call-template>
|
|
2174
|
+
</xsl:if>
|
|
2175
|
+
<!-- -->
|
|
2176
|
+
</xsl:template>
|
|
2177
|
+
|
|
2178
|
+
<xsl:template name="missing-implementation">
|
|
2179
|
+
<xsl:param name="element"/>
|
|
2180
|
+
<xsl:param name="ntimes"/>
|
|
2181
|
+
|
|
2182
|
+
<xsl:message>Unimplemented: <xsl:value-of select="$element"/> (<xsl:value-of select="$ntimes"/> times)</xsl:message>
|
|
2183
|
+
</xsl:template>
|
|
2184
|
+
|
|
2185
|
+
<xsl:template match="*" mode="overlooked">
|
|
2186
|
+
<xsl:message>Overlooked: <xsl:value-of select="local-name()"/></xsl:message>
|
|
2187
|
+
</xsl:template>
|
|
2188
|
+
|
|
2189
|
+
<!-- *Every* element needs an implementation, or it ends up here being -->
|
|
2190
|
+
<!-- reported as overlooked. Elements handled by common are named in -->
|
|
2191
|
+
<!-- the exclusion list, so they fall through; this is temporary -->
|
|
2192
|
+
<!-- during development and, once the list empties, can be removed. -->
|
|
2193
|
+
<xsl:template priority="-0.5" match="*[not(
|
|
2194
|
+
self::nbsp or self::ndash or self::mdash or
|
|
2195
|
+
self::copyright or self::registered or self::trademark or self::degree or self::prime or self::dblprime or self::lsq or self::rsq or self::lq or self::rq or self::langle or self::rangle or self::ellipsis or self::midpoint or self::pilcrow or self::section-mark or self::minus or self::times or self::obelus or self::plusminus or
|
|
2196
|
+
self::phonomark or self::copyleft or self::servicemark or self::ldblbracket or self::rdblbracket or self::swungdash or self::permille or self::solidus or
|
|
2197
|
+
self::q or self::sq or self::dblbrackets or self::angles or
|
|
2198
|
+
self::xref or
|
|
2199
|
+
self::today or self::timeofday or
|
|
2200
|
+
self::ad or self::am or self::bc or self::ca or self::eg or self::etal or self::etc or self::ie or self::nb or self::pm or self::ps or self::vs or self::viz or
|
|
2201
|
+
self::title or self::subtitle or self::shorttitle or self::plaintitle or self::creator or
|
|
2202
|
+
self::caption or
|
|
2203
|
+
self::cline or
|
|
2204
|
+
self::c or
|
|
2205
|
+
self::sage or
|
|
2206
|
+
self::rename)]">
|
|
2207
|
+
<xsl:apply-templates select="." mode="overlooked"/>
|
|
2208
|
+
<!-- recurse into child elements to find more "missing" elements -->
|
|
2209
|
+
<xsl:apply-templates select="*"/>
|
|
2210
|
+
</xsl:template>
|
|
2211
|
+
|
|
2212
|
+
<!-- ######### -->
|
|
2213
|
+
<!-- Utilities -->
|
|
2214
|
+
<!-- ######### -->
|
|
2215
|
+
|
|
2216
|
+
<!-- Transcriber Notes -->
|
|
2217
|
+
|
|
2218
|
+
<!-- Here code is the transcriber, so we can explain places where we -->
|
|
2219
|
+
<!-- have done something different than it might be realized in print. -->
|
|
2220
|
+
<!-- -->
|
|
2221
|
+
<!-- [BANA 2016] 3.2.1 -->
|
|
2222
|
+
<!-- Two three-cell sequences indicate the begin and end of a -->
|
|
2223
|
+
<!-- transcriber note. Additionally, the indentation is 7-5 margins. -->
|
|
2224
|
+
<!-- -->
|
|
2225
|
+
<!-- The content provided in the "message" parameter by a calling -->
|
|
2226
|
+
<!-- instance will be placed into a segment, so this is not an -->
|
|
2227
|
+
<!-- "embedded" note (which is for seven words or less). Content can -->
|
|
2228
|
+
<!-- contain the *internal* markup used here, such as "italic" or -->
|
|
2229
|
+
<!-- "bold", and that will be copied into the note for processing when -->
|
|
2230
|
+
<!-- converted to braille -->
|
|
2231
|
+
<!-- -->
|
|
2232
|
+
<!-- Template could be context-free for literal messages, but the -->
|
|
2233
|
+
<!-- $message will sometimes come from the context of an element -->
|
|
2234
|
+
<!-- (e.g. the "shortdescription" of an "image") -->
|
|
2235
|
+
<xsl:template match="*" mode="transcriber-note">
|
|
2236
|
+
<xsl:param name="message"/>
|
|
2237
|
+
|
|
2238
|
+
<segment indentation="7" runover="5">
|
|
2239
|
+
<!-- dot 4, dot 46, dot 126 -->
|
|
2240
|
+
<xsl:text>⠈⠨⠣</xsl:text>
|
|
2241
|
+
<!-- *Copy* literal markup, or result of applying templates -->
|
|
2242
|
+
<xsl:copy-of select="$message"/>
|
|
2243
|
+
<!-- dot 4, dot 46, dot 345 -->
|
|
2244
|
+
<xsl:text>⠈⠨⠜</xsl:text>
|
|
2245
|
+
</segment>
|
|
2246
|
+
</xsl:template>
|
|
2247
|
+
|
|
2248
|
+
|
|
2249
|
+
</xsl:stylesheet>
|