@pretextbook/pretext-html 0.12.0 → 0.14.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/assets/preview-html.xsl +4 -1
- package/assets/upstream.json +1 -1
- package/assets/xsl/localizations/fr-CA.xml +12 -12
- package/assets/xsl/localizations/fr-FR.xml +11 -11
- package/assets/xsl/localizations/it-IT.xml +7 -7
- package/assets/xsl/pretext-assembly.xsl +83 -20
- package/assets/xsl/pretext-braille-preprint.xsl +1 -3
- package/assets/xsl/pretext-common.xsl +15 -91
- package/assets/xsl/pretext-fo.xsl +4 -6
- package/assets/xsl/pretext-html.xsl +41 -30
- package/assets/xsl/pretext-latex-common.xsl +1 -23
- package/assets/xsl/pretext-text-utilities.xsl +11 -1
- package/assets/xsl/tests/pretext-text-utilities-test.xsl +119 -0
- package/assets/xsl-bundle.json +1 -1
- package/dist/index.browser.js +1 -1
- package/package.json +1 -1
package/assets/preview-html.xsl
CHANGED
|
@@ -229,7 +229,10 @@
|
|
|
229
229
|
<!-- Show the print-preview button on printouts, but inert: the page it would -->
|
|
230
230
|
<!-- reload with "?printpreview=<id>" does not exist for an in-memory render, -->
|
|
231
231
|
<!-- and a host that resolves that query against its own URL sends the reader -->
|
|
232
|
-
<!-- somewhere unrelated.
|
|
232
|
+
<!-- somewhere unrelated. The button carries data-printout* attributes all -->
|
|
233
|
+
<!-- the same, which is how the embedder finds the page's printouts and -->
|
|
234
|
+
<!-- offers the same layout from its own UI (src/printout.ts). -->
|
|
235
|
+
<!-- See PRINTOUT_LINK_OVERRIDE in refresh-xsl.mjs. -->
|
|
233
236
|
<xsl:template match="*" mode="standalone-printout-links">
|
|
234
237
|
<div class="print-links">
|
|
235
238
|
<a class="print-link" style="opacity:0.45;cursor:default;pointer-events:none" aria-disabled="true" title="Print preview: select this printout from the live preview's own controls">
|
package/assets/upstream.json
CHANGED
|
@@ -224,7 +224,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
224
224
|
<localization string-id='copyright'>Copyright</localization>
|
|
225
225
|
<localization string-id='keywords'>Mots-clés</localization>
|
|
226
226
|
<!-- HTML clickables (lowercase strings to click on) -->
|
|
227
|
-
|
|
227
|
+
<localization string-id='permalink'>permalien</localization>
|
|
228
228
|
<localization string-id='incontext'>Contexte</localization>
|
|
229
229
|
<!-- <localization string-id='standalone'>Standalone</localization> -->
|
|
230
230
|
<!-- <localization string-id='embed'>Embed</localization> -->
|
|
@@ -261,16 +261,16 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
261
261
|
<localization string-id='print'>Imprimer</localization>
|
|
262
262
|
<localization string-id='print-preview'>Aperçu avant impression</localization>
|
|
263
263
|
<localization string-id='close'>Fermer</localization>
|
|
264
|
-
|
|
264
|
+
<localization string-id='open-new-tab'>Ouvrir dans un nouvel onglet</localization>
|
|
265
265
|
<!-- Readability menu items, HTML only, utilized by Javascript -->
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
266
|
+
<localization string-id='readability-settings'>Paramètres de lecture</localization>
|
|
267
|
+
<localization string-id='readability-line-height'>Interligne</localization>
|
|
268
|
+
<localization string-id='readability-content-font-size'>Taille de police</localization>
|
|
269
|
+
<localization string-id='readability-theme'>Thème</localization>
|
|
270
|
+
<localization string-id='readability-theme-system'>Système</localization>
|
|
271
|
+
<localization string-id='readability-theme-light'>Clair</localization>
|
|
272
|
+
<localization string-id='readability-theme-dark'>Sombre</localization>
|
|
273
|
+
<localization string-id='readability-assistive-technologies'>Technologies d'assistance</localization>
|
|
274
|
+
<localization string-id='readability-expose-permalinks'>Exposer les permaliens</localization>
|
|
275
|
+
<localization string-id='reset-all'>Options par défaut</localization>
|
|
276
276
|
</locale>
|
|
@@ -265,16 +265,16 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
265
265
|
<localization string-id='print'>Imprimer</localization>
|
|
266
266
|
<!-- <localization string-id='print-preview'>Print preview</localization> -->
|
|
267
267
|
<localization string-id='close'>Fermer</localization>
|
|
268
|
-
|
|
268
|
+
<localization string-id='open-new-tab'>Ouvrir dans un nouvel onglet</localization>
|
|
269
269
|
<!-- Readability menu items, HTML only, utilized by Javascript -->
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
270
|
+
<localization string-id='readability-settings'>Paramètres de lecture</localization>
|
|
271
|
+
<localization string-id='readability-line-height'>Interligne</localization>
|
|
272
|
+
<localization string-id='readability-content-font-size'>Taille de police</localization>
|
|
273
|
+
<localization string-id='readability-theme'>Thème</localization>
|
|
274
|
+
<localization string-id='readability-theme-system'>Système</localization>
|
|
275
|
+
<localization string-id='readability-theme-light'>Clair</localization>
|
|
276
|
+
<localization string-id='readability-theme-dark'>Sombre</localization>
|
|
277
|
+
<localization string-id='readability-assistive-technologies'>Technologies d'assistance</localization>
|
|
278
|
+
<localization string-id='readability-expose-permalinks'>Exposer les permaliens</localization>
|
|
279
|
+
<localization string-id='reset-all'>Options par défaut</localization>
|
|
280
280
|
</locale>
|
|
@@ -95,7 +95,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
95
95
|
<localization string-id='convention'>Convenzione</localization>
|
|
96
96
|
<localization string-id='note'>Nota</localization>
|
|
97
97
|
<!-- <localization string-id='observation'>Observation</localization> -->
|
|
98
|
-
<localization string-id='warning'>
|
|
98
|
+
<localization string-id='warning'>Avviso</localization>
|
|
99
99
|
<localization string-id='insight'>Intuizione</localization>
|
|
100
100
|
<!-- COMPUTATION-LIKE blocks -->
|
|
101
101
|
<localization string-id='computation'>Computazione</localization>
|
|
@@ -152,7 +152,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
152
152
|
<localization string-id='hint'>Suggerimento</localization>
|
|
153
153
|
<localization string-id='answer'>Risposta</localization>
|
|
154
154
|
<localization string-id='solution'>Soluzione</localization>
|
|
155
|
-
|
|
155
|
+
<localization string-id='subexercises'>Sottoesercizi</localization>
|
|
156
156
|
<localization string-id='exercisegroup'>Gruppo di esercizi</localization>
|
|
157
157
|
<localization string-id='biblio'>Riferimento bibliografico</localization>
|
|
158
158
|
<!-- Front matter components -->
|
|
@@ -199,7 +199,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
199
199
|
<localization string-id='previous-short'>Prec</localization>
|
|
200
200
|
<localization string-id='up-short'>Su</localization>
|
|
201
201
|
<localization string-id='next-short'>Succ</localization>
|
|
202
|
-
|
|
202
|
+
<localization string-id='top'>Inizio</localization>
|
|
203
203
|
<localization string-id='annotations'>Annotazioni</localization>
|
|
204
204
|
<localization string-id='feedback'>Feedback</localization>
|
|
205
205
|
<localization string-id='authored'>Redatto in PreTeXt</localization>
|
|
@@ -225,12 +225,12 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
225
225
|
<localization string-id='permalink'>permalink</localization>
|
|
226
226
|
<localization string-id='incontext'>Nel Contesto</localization>
|
|
227
227
|
<!-- <localization string-id='standalone'>Standalone</localization> -->
|
|
228
|
-
<localization string-id='embed'>
|
|
229
|
-
<localization string-id='embed-this-page'>
|
|
228
|
+
<localization string-id='embed'>Incorpora</localization>
|
|
229
|
+
<localization string-id='embed-this-page'>Incorpora questa pagina</localization>
|
|
230
230
|
<localization string-id='copy'>Copia</localization>
|
|
231
231
|
<localization string-id='profile'>Profilo</localization>
|
|
232
|
-
<localization string-id='permalink-tooltip'>Copia
|
|
233
|
-
<localization string-id='calculator'>
|
|
232
|
+
<localization string-id='permalink-tooltip'>Copia titolo e permalink per</localization>
|
|
233
|
+
<localization string-id='calculator'>Calcolatrice</localization>
|
|
234
234
|
<localization string-id='evaluate'>Calcola</localization>
|
|
235
235
|
<localization string-id='code'>Codice</localization>
|
|
236
236
|
<localization string-id='instructions'>Istruzioni</localization>
|
|
@@ -482,13 +482,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
482
482
|
<xsl:template match="node()|@*" mode="augment">
|
|
483
483
|
<xsl:param name="parent-struct" select="''"/>
|
|
484
484
|
<xsl:param name="level" select="0"/>
|
|
485
|
-
<xsl:param name="ordered-list-level" select="0"/>
|
|
486
485
|
|
|
487
486
|
<xsl:copy>
|
|
488
487
|
<xsl:apply-templates select="node()|@*" mode="augment">
|
|
489
488
|
<xsl:with-param name="parent-struct" select="$parent-struct"/>
|
|
490
489
|
<xsl:with-param name="level" select="$level"/>
|
|
491
|
-
<xsl:with-param name="ordered-list-level" select="$ordered-list-level"/>
|
|
492
490
|
</xsl:apply-templates>
|
|
493
491
|
</xsl:copy>
|
|
494
492
|
</xsl:template>
|
|
@@ -3660,6 +3658,28 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3660
3658
|
<!-- whole, and the deprecation warning says so plainly -->
|
|
3661
3659
|
<xsl:template match="references/conclusion" mode="repair"/>
|
|
3662
3660
|
|
|
3661
|
+
<!-- 2026-08-20 "ol" structuring an "exercise" is deprecated -->
|
|
3662
|
+
|
|
3663
|
+
<!-- An "ol" as a child of an "exercise", or of its "statement", -->
|
|
3664
|
+
<!-- once lettered its items like exercise parts. The list is -->
|
|
3665
|
+
<!-- wrapped in a "p" here, like any other list in running prose. -->
|
|
3666
|
+
<!-- Within the divisions that historically lettered these lists, -->
|
|
3667
|
+
<!-- a stamp preserves the extra list level for existing sources; -->
|
|
3668
|
+
<!-- new sources letter a list with marker="(a)", or structure -->
|
|
3669
|
+
<!-- real parts with "task". The deprecation warning says so. -->
|
|
3670
|
+
<xsl:template match="exercise/ol|exercise/statement/ol" mode="repair">
|
|
3671
|
+
<p>
|
|
3672
|
+
<xsl:copy>
|
|
3673
|
+
<xsl:if test="ancestor::exercises or ancestor::reading-questions or ancestor::worksheet or ancestor::handout">
|
|
3674
|
+
<xsl:attribute name="pi:legacy-parts">
|
|
3675
|
+
<xsl:text>yes</xsl:text>
|
|
3676
|
+
</xsl:attribute>
|
|
3677
|
+
</xsl:if>
|
|
3678
|
+
<xsl:apply-templates select="node()|@*" mode="repair"/>
|
|
3679
|
+
</xsl:copy>
|
|
3680
|
+
</p>
|
|
3681
|
+
</xsl:template>
|
|
3682
|
+
|
|
3663
3683
|
<!-- ########## -->
|
|
3664
3684
|
<!-- Enrichment -->
|
|
3665
3685
|
<!-- ########## -->
|
|
@@ -4034,7 +4054,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4034
4054
|
<xsl:template match="part|chapter|appendix|section|subsection|subsubsection|exercises|solutions|reading-questions|references|glossary|worksheet|handout" mode="augment">
|
|
4035
4055
|
<xsl:param name="parent-struct"/>
|
|
4036
4056
|
<xsl:param name="level"/>
|
|
4037
|
-
<xsl:param name="ordered-list-level" />
|
|
4038
4057
|
|
|
4039
4058
|
<xsl:variable name="the-serial">
|
|
4040
4059
|
<xsl:apply-templates select="." mode="division-serial-number"/>
|
|
@@ -4084,16 +4103,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4084
4103
|
</xsl:choose>
|
|
4085
4104
|
</xsl:variable>
|
|
4086
4105
|
<xsl:variable name="next-level" select="$level + 1"/>
|
|
4087
|
-
<xsl:variable name="next-ordered-list-level">
|
|
4088
|
-
<xsl:choose>
|
|
4089
|
-
<xsl:when test="self::exercises or self::worksheet or self::handout or self::reading-questions or self::references">
|
|
4090
|
-
<xsl:number value="1" />
|
|
4091
|
-
</xsl:when>
|
|
4092
|
-
<xsl:otherwise>
|
|
4093
|
-
<xsl:number value="0" />
|
|
4094
|
-
</xsl:otherwise>
|
|
4095
|
-
</xsl:choose>
|
|
4096
|
-
</xsl:variable>
|
|
4097
4106
|
<xsl:copy>
|
|
4098
4107
|
<xsl:attribute name="pi:struct">
|
|
4099
4108
|
<xsl:value-of select="$parent-struct"/>
|
|
@@ -4114,7 +4123,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4114
4123
|
<xsl:apply-templates select="node()|@*" mode="augment">
|
|
4115
4124
|
<xsl:with-param name="parent-struct" select="$new-struct"/>
|
|
4116
4125
|
<xsl:with-param name="level" select="$next-level"/>
|
|
4117
|
-
<xsl:with-param name="ordered-list-level" select="$next-ordered-list-level"/>
|
|
4118
4126
|
</xsl:apply-templates>
|
|
4119
4127
|
</xsl:copy>
|
|
4120
4128
|
</xsl:template>
|
|
@@ -4130,7 +4138,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4130
4138
|
<xsl:apply-templates select="node()|@*" mode="augment">
|
|
4131
4139
|
<xsl:with-param name="parent-struct" select="''"/>
|
|
4132
4140
|
<xsl:with-param name="level" select="0"/>
|
|
4133
|
-
<xsl:with-param name="ordered-list-level" select="0"/>
|
|
4134
4141
|
</xsl:apply-templates>
|
|
4135
4142
|
</xsl:copy>
|
|
4136
4143
|
</xsl:template>
|
|
@@ -4201,7 +4208,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4201
4208
|
<xsl:when test="$level='2'">i</xsl:when>
|
|
4202
4209
|
<xsl:when test="$level='3'">A</xsl:when>
|
|
4203
4210
|
<xsl:otherwise>
|
|
4204
|
-
<xsl:message>PTX:ERROR: ordered list is more than 4 levels deep (at level <xsl:value-of select="$level"
|
|
4211
|
+
<xsl:message>PTX:ERROR: ordered list is more than 4 levels deep (at level <xsl:value-of select="$level" />; a legacy exercise-parts list counts one level extra)</xsl:message>
|
|
4205
4212
|
</xsl:otherwise>
|
|
4206
4213
|
</xsl:choose>
|
|
4207
4214
|
</xsl:otherwise>
|
|
@@ -4209,8 +4216,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4209
4216
|
</xsl:template>
|
|
4210
4217
|
|
|
4211
4218
|
<xsl:template match="ol" mode="augment">
|
|
4212
|
-
|
|
4213
|
-
|
|
4219
|
+
<!-- The list level is intrinsic: a count of enclosing ordered -->
|
|
4220
|
+
<!-- lists, raised by one within a list the repair phase stamped -->
|
|
4221
|
+
<!-- as a legacy exercise-parts list (the stamp lifts the whole -->
|
|
4222
|
+
<!-- nest, so sublists letter as they always have). -->
|
|
4223
|
+
<xsl:variable name="ordered-list-level" select="count(ancestor::ol) + number(boolean(ancestor-or-self::ol[@pi:legacy-parts]))"/>
|
|
4214
4224
|
<xsl:variable name="format-code">
|
|
4215
4225
|
<xsl:apply-templates select="." mode="format-code">
|
|
4216
4226
|
<xsl:with-param name="level" select="$ordered-list-level"/>
|
|
@@ -4256,9 +4266,62 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4256
4266
|
<xsl:attribute name="pi:marker-suffix">
|
|
4257
4267
|
<xsl:value-of select="$marker-suffix"/>
|
|
4258
4268
|
</xsl:attribute>
|
|
4259
|
-
<xsl:apply-templates select="node()|@*" mode="augment"
|
|
4260
|
-
|
|
4269
|
+
<xsl:apply-templates select="node()|@*" mode="augment"/>
|
|
4270
|
+
</xsl:copy>
|
|
4271
|
+
</xsl:template>
|
|
4272
|
+
|
|
4273
|
+
<!-- The stamp has served its purpose once the level is recorded, -->
|
|
4274
|
+
<!-- so it does not survive into the assembled tree. -->
|
|
4275
|
+
<xsl:template match="@pi:legacy-parts" mode="augment"/>
|
|
4276
|
+
|
|
4277
|
+
<!-- List levels and format codes are ancestor-axis computations -->
|
|
4278
|
+
<!-- that *could* be made at conversion time in -common; we simply -->
|
|
4279
|
+
<!-- choose to make them once, here in assembly, and stamp the -->
|
|
4280
|
+
<!-- results. Unordered lists follow the pattern of ordered lists -->
|
|
4281
|
+
<!-- above: an authored @marker wins, else defaults cycle by depth. -->
|
|
4282
|
+
|
|
4283
|
+
<!-- Labels of unordered lists have format codes: -->
|
|
4284
|
+
<!-- disc, circle, square, or none. Default order: -->
|
|
4285
|
+
<!-- disc, circle, square, disc. -->
|
|
4286
|
+
<xsl:template match="ul" mode="format-code">
|
|
4287
|
+
<xsl:param name="level"/>
|
|
4288
|
+
<xsl:choose>
|
|
4289
|
+
<xsl:when test="@marker">
|
|
4290
|
+
<xsl:choose>
|
|
4291
|
+
<xsl:when test="@marker='disc'">disc</xsl:when>
|
|
4292
|
+
<xsl:when test="@marker='circle'">circle</xsl:when>
|
|
4293
|
+
<xsl:when test="@marker='square'">square</xsl:when>
|
|
4294
|
+
<xsl:when test="@marker=''">none</xsl:when>
|
|
4295
|
+
<xsl:otherwise>
|
|
4296
|
+
<xsl:message>PTX:ERROR: unordered list label (<xsl:value-of select="@marker" />) not recognized</xsl:message>
|
|
4297
|
+
</xsl:otherwise>
|
|
4298
|
+
</xsl:choose>
|
|
4299
|
+
</xsl:when>
|
|
4300
|
+
<xsl:otherwise>
|
|
4301
|
+
<xsl:choose>
|
|
4302
|
+
<xsl:when test="$level='0'">disc</xsl:when>
|
|
4303
|
+
<xsl:when test="$level='1'">circle</xsl:when>
|
|
4304
|
+
<xsl:when test="$level='2'">square</xsl:when>
|
|
4305
|
+
<xsl:when test="$level='3'">disc</xsl:when>
|
|
4306
|
+
<xsl:otherwise>
|
|
4307
|
+
<xsl:message>PTX:ERROR: unordered list is more than 4 levels deep (at level <xsl:value-of select="$level" />)</xsl:message>
|
|
4308
|
+
</xsl:otherwise>
|
|
4309
|
+
</xsl:choose>
|
|
4310
|
+
</xsl:otherwise>
|
|
4311
|
+
</xsl:choose>
|
|
4312
|
+
</xsl:template>
|
|
4313
|
+
|
|
4314
|
+
<xsl:template match="ul" mode="augment">
|
|
4315
|
+
<xsl:variable name="format-code">
|
|
4316
|
+
<xsl:apply-templates select="." mode="format-code">
|
|
4317
|
+
<xsl:with-param name="level" select="count(ancestor::ul)"/>
|
|
4261
4318
|
</xsl:apply-templates>
|
|
4319
|
+
</xsl:variable>
|
|
4320
|
+
<xsl:copy>
|
|
4321
|
+
<xsl:attribute name="pi:format-code">
|
|
4322
|
+
<xsl:value-of select="$format-code"/>
|
|
4323
|
+
</xsl:attribute>
|
|
4324
|
+
<xsl:apply-templates select="node()|@*" mode="augment"/>
|
|
4262
4325
|
</xsl:copy>
|
|
4263
4326
|
</xsl:template>
|
|
4264
4327
|
|
|
@@ -1209,9 +1209,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1209
1209
|
</xsl:template>
|
|
1210
1210
|
|
|
1211
1211
|
<xsl:template match="ul/li" mode="unicode-list-marker">
|
|
1212
|
-
<xsl:variable name="format-code"
|
|
1213
|
-
<xsl:apply-templates select="parent::ul" mode="format-code"/>
|
|
1214
|
-
</xsl:variable>
|
|
1212
|
+
<xsl:variable name="format-code" select="parent::ul/@pi:format-code"/>
|
|
1215
1213
|
<!-- The list label. The file en-ueb-chardefs.uti -->
|
|
1216
1214
|
<!-- associates these Unicode values with the indicated -->
|
|
1217
1215
|
<!-- dot patterns. This jibes with [BANA-2016, 8.6.2], -->
|
|
@@ -5122,61 +5122,6 @@ Book (with parts), "section" at level 3
|
|
|
5122
5122
|
<!-- Utility templates to determine the depth -->
|
|
5123
5123
|
<!-- of a list, relative to nesting in other lists -->
|
|
5124
5124
|
|
|
5125
|
-
<!-- We determine the depth of an unordered -->
|
|
5126
|
-
<!-- list, relative only to other unordered -->
|
|
5127
|
-
<!-- lists in a nesting, so as to determine -->
|
|
5128
|
-
<!-- the right label to apply, esp. as defaults -->
|
|
5129
|
-
<!-- The recursive template should be called -->
|
|
5130
|
-
<!-- without a level, since it defaults to zero -->
|
|
5131
|
-
<xsl:template match="ul" mode="unordered-list-level">
|
|
5132
|
-
<!-- Start with level zero, and increment on successive calls -->
|
|
5133
|
-
<xsl:param name="level" select="0"/>
|
|
5134
|
-
<xsl:choose>
|
|
5135
|
-
<!-- Another unordered list above, add one and recurse -->
|
|
5136
|
-
<xsl:when test="ancestor::ul">
|
|
5137
|
-
<xsl:apply-templates select="ancestor::ul[1]" mode="unordered-list-level">
|
|
5138
|
-
<xsl:with-param name="level" select="$level + 1" />
|
|
5139
|
-
</xsl:apply-templates>
|
|
5140
|
-
</xsl:when>
|
|
5141
|
-
<!-- No unordered list above, done, so return level -->
|
|
5142
|
-
<xsl:otherwise>
|
|
5143
|
-
<xsl:value-of select="$level" />
|
|
5144
|
-
</xsl:otherwise>
|
|
5145
|
-
</xsl:choose>
|
|
5146
|
-
</xsl:template>
|
|
5147
|
-
|
|
5148
|
-
<!-- Ordered lists follow the same strategy, -->
|
|
5149
|
-
<!-- except we implement exercises and references -->
|
|
5150
|
-
<!-- elements as ordered lists, so we need to absorb -->
|
|
5151
|
-
<!-- them into the general treatment of nested lists -->
|
|
5152
|
-
<!-- They do only occur as top-level elements, so that -->
|
|
5153
|
-
<!-- assumption allows for some economy -->
|
|
5154
|
-
<xsl:template match="ol" mode="ordered-list-level">
|
|
5155
|
-
<xsl:param name="level" select="0"/>
|
|
5156
|
-
<xsl:choose>
|
|
5157
|
-
<!-- Since exercises divisions and references are top-level -->
|
|
5158
|
-
<!-- ordered lists, when these are the only interesting -->
|
|
5159
|
-
<!-- ancestor, we add one to the level and return -->
|
|
5160
|
-
<xsl:when test="(ancestor::exercises or ancestor::worksheet or ancestor::handout or ancestor::reading-questions or ancestor::references) and not(ancestor::ol)">
|
|
5161
|
-
<xsl:value-of select="$level + 1" />
|
|
5162
|
-
</xsl:when>
|
|
5163
|
-
<xsl:when test="ancestor::ol">
|
|
5164
|
-
<xsl:apply-templates select="ancestor::ol[1]" mode="ordered-list-level">
|
|
5165
|
-
<xsl:with-param name="level" select="$level + 1" />
|
|
5166
|
-
</xsl:apply-templates>
|
|
5167
|
-
</xsl:when>
|
|
5168
|
-
<xsl:otherwise>
|
|
5169
|
-
<xsl:value-of select="$level" />
|
|
5170
|
-
</xsl:otherwise>
|
|
5171
|
-
</xsl:choose>
|
|
5172
|
-
</xsl:template>
|
|
5173
|
-
|
|
5174
|
-
<!-- Exercises and References are -->
|
|
5175
|
-
<!-- specialized top-level ordered lists -->
|
|
5176
|
-
<xsl:template match="exercises|worksheet|handout|reading-questions|references" mode="ordered-list-level">
|
|
5177
|
-
<xsl:value-of select="0" />
|
|
5178
|
-
</xsl:template>
|
|
5179
|
-
|
|
5180
5125
|
<!-- To indent properly in markdown, we -->
|
|
5181
5126
|
<!-- need to count every type of list -->
|
|
5182
5127
|
<xsl:template match="*" mode="list-level">
|
|
@@ -5205,41 +5150,6 @@ Book (with parts), "section" at level 3
|
|
|
5205
5150
|
</xsl:choose>
|
|
5206
5151
|
</xsl:template>
|
|
5207
5152
|
|
|
5208
|
-
<!-- Labels of unordered list have formatting codes, which -->
|
|
5209
|
-
<!-- we detect here and pass on to other more specialized -->
|
|
5210
|
-
<!-- templates for implementation specifics -->
|
|
5211
|
-
<!-- disc, circle, square or blank are the options -->
|
|
5212
|
-
<!-- Default order: disc, circle, square, disc -->
|
|
5213
|
-
<xsl:template match="ul" mode="format-code">
|
|
5214
|
-
<xsl:choose>
|
|
5215
|
-
<xsl:when test="@marker">
|
|
5216
|
-
<xsl:choose>
|
|
5217
|
-
<xsl:when test="@marker='disc'">disc</xsl:when>
|
|
5218
|
-
<xsl:when test="@marker='circle'">circle</xsl:when>
|
|
5219
|
-
<xsl:when test="@marker='square'">square</xsl:when>
|
|
5220
|
-
<xsl:when test="@marker=''">none</xsl:when>
|
|
5221
|
-
<xsl:otherwise>
|
|
5222
|
-
<xsl:message>PTX:ERROR: unordered list label (<xsl:value-of select="@marker" />) not recognized</xsl:message>
|
|
5223
|
-
</xsl:otherwise>
|
|
5224
|
-
</xsl:choose>
|
|
5225
|
-
</xsl:when>
|
|
5226
|
-
<xsl:otherwise>
|
|
5227
|
-
<xsl:variable name="level">
|
|
5228
|
-
<xsl:apply-templates select="." mode="unordered-list-level" />
|
|
5229
|
-
</xsl:variable>
|
|
5230
|
-
<xsl:choose>
|
|
5231
|
-
<xsl:when test="$level='0'">disc</xsl:when>
|
|
5232
|
-
<xsl:when test="$level='1'">circle</xsl:when>
|
|
5233
|
-
<xsl:when test="$level='2'">square</xsl:when>
|
|
5234
|
-
<xsl:when test="$level='3'">disc</xsl:when>
|
|
5235
|
-
<xsl:otherwise>
|
|
5236
|
-
<xsl:message>PTX:ERROR: unordered list is more than 4 levels deep (at level <xsl:value-of select="$level" />)</xsl:message>
|
|
5237
|
-
</xsl:otherwise>
|
|
5238
|
-
</xsl:choose>
|
|
5239
|
-
</xsl:otherwise>
|
|
5240
|
-
</xsl:choose>
|
|
5241
|
-
</xsl:template>
|
|
5242
|
-
|
|
5243
5153
|
<!-- CSS class for multi-column lists. Context is an element with -->
|
|
5244
5154
|
<!-- a potential "cols" attribute. Return value is "colsN" with -->
|
|
5245
5155
|
<!-- 2 <= N <= 6, or empty when @cols is absent. -->
|
|
@@ -9735,7 +9645,7 @@ Book (with parts), "section" at level 3
|
|
|
9735
9645
|
<!-- ################## -->
|
|
9736
9646
|
|
|
9737
9647
|
<!-- Dashes and hyphens - worth reviewing -->
|
|
9738
|
-
<!--
|
|
9648
|
+
<!-- https://jkorpela.fi/dashes.html -->
|
|
9739
9649
|
|
|
9740
9650
|
<!-- An mdash may have thin space around it, otherwise it -->
|
|
9741
9651
|
<!-- should have none. It might be difficult to enforce this -->
|
|
@@ -12030,6 +11940,20 @@ http://andrewmccarthy.ie/2014/11/06/swung-dash-in-latex/
|
|
|
12030
11940
|
<xsl:with-param name="message" select="'a "references" division no longer has a "conclusion". The element is discarded entirely: its content will not appear in any output. Please relocate the content, perhaps following the "references"'"/>
|
|
12031
11941
|
</xsl:call-template>
|
|
12032
11942
|
<!-- -->
|
|
11943
|
+
<!-- 2026-08-20 "ol" as a child of "exercise" is obsolete -->
|
|
11944
|
+
<xsl:call-template name="deprecation-message">
|
|
11945
|
+
<xsl:with-param name="occurrences" select=""$document-root//exercise/ol"" />
|
|
11946
|
+
<xsl:with-param name="date-string" select="'2026-08-20'" />
|
|
11947
|
+
<xsl:with-param name="message" select="'an "ol" is no longer a child of an "exercise"; a list belongs inside a "p". We will wrap it for you, and lettered exercise parts will letter as before. Please convert: structure true parts with "task", letter a plain list with marker="(a)", or consider an "exercisegroup" and its cols attribute for a compact multi-column layout'"/>
|
|
11948
|
+
</xsl:call-template>
|
|
11949
|
+
<!-- -->
|
|
11950
|
+
<!-- 2026-08-20 "ol" as a child of an exercise "statement" is obsolete -->
|
|
11951
|
+
<xsl:call-template name="deprecation-message">
|
|
11952
|
+
<xsl:with-param name="occurrences" select=""$document-root//exercise/statement/ol"" />
|
|
11953
|
+
<xsl:with-param name="date-string" select="'2026-08-20'" />
|
|
11954
|
+
<xsl:with-param name="message" select="'an "ol" is no longer a child of an "exercise" "statement"; a list belongs inside a "p". We will wrap it for you, and lettered exercise parts will letter as before. Please convert: structure true parts with "task", letter a plain list with marker="(a)", or consider an "exercisegroup" and its cols attribute for a compact multi-column layout'"/>
|
|
11955
|
+
</xsl:call-template>
|
|
11956
|
+
<!-- -->
|
|
12033
11957
|
</xsl:template>
|
|
12034
11958
|
|
|
12035
11959
|
<!-- Miscellaneous -->
|
|
@@ -2046,13 +2046,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2046
2046
|
<xsl:value-of select="parent::ol/@pi:marker-suffix"/>
|
|
2047
2047
|
</xsl:template>
|
|
2048
2048
|
|
|
2049
|
-
<!-- Bullets via the
|
|
2050
|
-
<!--
|
|
2051
|
-
<!--
|
|
2049
|
+
<!-- Bullets via the format code stamped during assembly, which -->
|
|
2050
|
+
<!-- cycles disc, circle, square by level, and honors an authored -->
|
|
2051
|
+
<!-- @marker (the empty @marker giving no bullet at all). -->
|
|
2052
2052
|
<xsl:template match="ul/li" mode="list-label">
|
|
2053
|
-
<xsl:variable name="format-code"
|
|
2054
|
-
<xsl:apply-templates select="parent::ul" mode="format-code"/>
|
|
2055
|
-
</xsl:variable>
|
|
2053
|
+
<xsl:variable name="format-code" select="parent::ul/@pi:format-code"/>
|
|
2056
2054
|
<xsl:choose>
|
|
2057
2055
|
<xsl:when test="$format-code = 'disc'">
|
|
2058
2056
|
<xsl:text>•</xsl:text>
|
|
@@ -351,7 +351,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
351
351
|
<xsl:apply-templates select="." mode="make-xref-knowls"/>
|
|
352
352
|
</xsl:if>
|
|
353
353
|
<!-- custom ol marker css production -->
|
|
354
|
-
|
|
354
|
+
<!-- A CDN cannot host these styles, since they are derived from the -->
|
|
355
|
+
<!-- source. CDN builds get them inline instead, see "css-common". -->
|
|
356
|
+
<xsl:if test="not($b-subsetting) and not($b-cdn-resources)">
|
|
355
357
|
<xsl:call-template name="ol-marker-styles"/>
|
|
356
358
|
</xsl:if>
|
|
357
359
|
</xsl:template>
|
|
@@ -6167,14 +6169,14 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
6167
6169
|
<!-- Utility templates to translate PTX -->
|
|
6168
6170
|
<!-- enumeration style to HTML list-style-type -->
|
|
6169
6171
|
<xsl:template match="ol|ol-marker" mode="html-list-class">
|
|
6170
|
-
<xsl:variable name="
|
|
6172
|
+
<xsl:variable name="ptx-format-code" select="./@pi:format-code" />
|
|
6171
6173
|
<xsl:choose>
|
|
6172
|
-
<xsl:when test="$
|
|
6173
|
-
<xsl:when test="$
|
|
6174
|
-
<xsl:when test="$
|
|
6175
|
-
<xsl:when test="$
|
|
6176
|
-
<xsl:when test="$
|
|
6177
|
-
<xsl:when test="$
|
|
6174
|
+
<xsl:when test="$ptx-format-code = '0'">decimal</xsl:when>
|
|
6175
|
+
<xsl:when test="$ptx-format-code = '1'">decimal</xsl:when>
|
|
6176
|
+
<xsl:when test="$ptx-format-code = 'a'">lower-alpha</xsl:when>
|
|
6177
|
+
<xsl:when test="$ptx-format-code = 'A'">upper-alpha</xsl:when>
|
|
6178
|
+
<xsl:when test="$ptx-format-code = 'i'">lower-roman</xsl:when>
|
|
6179
|
+
<xsl:when test="$ptx-format-code = 'I'">upper-roman</xsl:when>
|
|
6178
6180
|
<xsl:otherwise>
|
|
6179
6181
|
<xsl:message>PTX:BUG: bad ordered list label format code in HTML conversion</xsl:message>
|
|
6180
6182
|
</xsl:otherwise>
|
|
@@ -6182,14 +6184,12 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
6182
6184
|
</xsl:template>
|
|
6183
6185
|
|
|
6184
6186
|
<xsl:template match="ul" mode="html-list-class">
|
|
6185
|
-
<xsl:variable name="
|
|
6186
|
-
<xsl:apply-templates select="." mode="format-code" />
|
|
6187
|
-
</xsl:variable>
|
|
6187
|
+
<xsl:variable name="ptx-format-code" select="./@pi:format-code"/>
|
|
6188
6188
|
<xsl:choose>
|
|
6189
|
-
<xsl:when test="$
|
|
6190
|
-
<xsl:when test="$
|
|
6191
|
-
<xsl:when test="$
|
|
6192
|
-
<xsl:when test="$
|
|
6189
|
+
<xsl:when test="$ptx-format-code = 'disc'">disc</xsl:when>
|
|
6190
|
+
<xsl:when test="$ptx-format-code = 'circle'">circle</xsl:when>
|
|
6191
|
+
<xsl:when test="$ptx-format-code = 'square'">square</xsl:when>
|
|
6192
|
+
<xsl:when test="$ptx-format-code = 'none'">no-marker</xsl:when>
|
|
6193
6193
|
<xsl:otherwise>
|
|
6194
6194
|
<xsl:message>PTX:BUG: bad unordered list label format code in HTML conversion</xsl:message>
|
|
6195
6195
|
</xsl:otherwise>
|
|
@@ -6203,18 +6203,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
6203
6203
|
<xsl:template match="ol|ul">
|
|
6204
6204
|
<xsl:param name="b-original" select="true()" />
|
|
6205
6205
|
<xsl:param name="heading-level"/>
|
|
6206
|
-
|
|
6207
|
-
<!-- no harm if called on "ul" -->
|
|
6208
|
-
<xsl:variable name="mbx-format-code">
|
|
6209
|
-
<xsl:choose>
|
|
6210
|
-
<xsl:when test="self::ol">
|
|
6211
|
-
<xsl:value-of select="./@pi:format-code" />
|
|
6212
|
-
</xsl:when>
|
|
6213
|
-
<xsl:otherwise>
|
|
6214
|
-
<xsl:apply-templates select="." mode="format-code" />
|
|
6215
|
-
</xsl:otherwise>
|
|
6216
|
-
</xsl:choose>
|
|
6217
|
-
</xsl:variable>
|
|
6206
|
+
<xsl:variable name="ptx-format-code" select="./@pi:format-code"/>
|
|
6218
6207
|
<!-- newline inserted to encourage formatted output -->
|
|
6219
6208
|
<xsl:text>
</xsl:text>
|
|
6220
6209
|
<xsl:element name="{local-name(.)}">
|
|
@@ -6239,7 +6228,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
6239
6228
|
<xsl:attribute name="id">
|
|
6240
6229
|
<xsl:apply-templates select="." mode="html-id" />
|
|
6241
6230
|
</xsl:attribute>
|
|
6242
|
-
<xsl:if test="$
|
|
6231
|
+
<xsl:if test="$ptx-format-code = '0'">
|
|
6243
6232
|
<xsl:attribute name="start">
|
|
6244
6233
|
<xsl:text>0</xsl:text>
|
|
6245
6234
|
</xsl:attribute>
|
|
@@ -13956,7 +13945,16 @@ TODO:
|
|
|
13956
13945
|
<xsl:template name="mathjax">
|
|
13957
13946
|
<!-- MathJax 4 configuration via JavaScript module -->
|
|
13958
13947
|
<script type="module">
|
|
13959
|
-
|
|
13948
|
+
<!-- A module specifier is either an absolute URL or a relative -->
|
|
13949
|
+
<!-- reference beginning "/", "./", or "../" - a bare path will not -->
|
|
13950
|
+
<!-- resolve. So a local build, where "html.js.dir" is relative, -->
|
|
13951
|
+
<!-- needs the "./", while a CDN build, where the prefix has already -->
|
|
13952
|
+
<!-- made it absolute, must not have it: the "./" would make the -->
|
|
13953
|
+
<!-- whole URL relative to the page. -->
|
|
13954
|
+
<xsl:text>import { startMathJax } from '</xsl:text>
|
|
13955
|
+
<xsl:if test="$cdn-prefix = ''">
|
|
13956
|
+
<xsl:text>./</xsl:text>
|
|
13957
|
+
</xsl:if>
|
|
13960
13958
|
<xsl:value-of select="$html.js.dir"/>
|
|
13961
13959
|
<xsl:text>/mathjax_startup.js';
</xsl:text>
|
|
13962
13960
|
<xsl:text>startMathJax({
</xsl:text>
|
|
@@ -14651,7 +14649,20 @@ TODO:
|
|
|
14651
14649
|
<xsl:template name="css-common">
|
|
14652
14650
|
<!-- Temporary until css handling overhaul by ascholer complete -->
|
|
14653
14651
|
<xsl:if test="$b-needs-custom-marker-css">
|
|
14654
|
-
<
|
|
14652
|
+
<xsl:choose>
|
|
14653
|
+
<!-- These styles are derived from the source, so they are not on -->
|
|
14654
|
+
<!-- the CDN and "$html.css.dir" does not point at them. Inline -->
|
|
14655
|
+
<!-- them: there is one short rule per unique author-supplied -->
|
|
14656
|
+
<!-- marker, and portable HTML has no place to link out to anyway. -->
|
|
14657
|
+
<xsl:when test="$b-cdn-resources">
|
|
14658
|
+
<style>
|
|
14659
|
+
<xsl:apply-templates select="exsl:node-set($ol-markers)//ol-marker" mode="ol-marker-style"/>
|
|
14660
|
+
</style>
|
|
14661
|
+
</xsl:when>
|
|
14662
|
+
<xsl:otherwise>
|
|
14663
|
+
<link href="{$html.css.dir}/ol-markers.css" rel="stylesheet" type="text/css"/>
|
|
14664
|
+
</xsl:otherwise>
|
|
14665
|
+
</xsl:choose>
|
|
14655
14666
|
</xsl:if>
|
|
14656
14667
|
<!-- If extra CSS is specified, then unpack multiple CSS files -->
|
|
14657
14668
|
<xsl:if test="not($html.css.extra = '')">
|