@pretextbook/pretext-html 0.12.0 → 0.13.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-common.xsl +1 -1
- package/assets/xsl/pretext-html.xsl +27 -3
- 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>
|
|
@@ -9735,7 +9735,7 @@ Book (with parts), "section" at level 3
|
|
|
9735
9735
|
<!-- ################## -->
|
|
9736
9736
|
|
|
9737
9737
|
<!-- Dashes and hyphens - worth reviewing -->
|
|
9738
|
-
<!--
|
|
9738
|
+
<!-- https://jkorpela.fi/dashes.html -->
|
|
9739
9739
|
|
|
9740
9740
|
<!-- An mdash may have thin space around it, otherwise it -->
|
|
9741
9741
|
<!-- should have none. It might be difficult to enforce this -->
|
|
@@ -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>
|
|
@@ -13956,7 +13958,16 @@ TODO:
|
|
|
13956
13958
|
<xsl:template name="mathjax">
|
|
13957
13959
|
<!-- MathJax 4 configuration via JavaScript module -->
|
|
13958
13960
|
<script type="module">
|
|
13959
|
-
|
|
13961
|
+
<!-- A module specifier is either an absolute URL or a relative -->
|
|
13962
|
+
<!-- reference beginning "/", "./", or "../" - a bare path will not -->
|
|
13963
|
+
<!-- resolve. So a local build, where "html.js.dir" is relative, -->
|
|
13964
|
+
<!-- needs the "./", while a CDN build, where the prefix has already -->
|
|
13965
|
+
<!-- made it absolute, must not have it: the "./" would make the -->
|
|
13966
|
+
<!-- whole URL relative to the page. -->
|
|
13967
|
+
<xsl:text>import { startMathJax } from '</xsl:text>
|
|
13968
|
+
<xsl:if test="$cdn-prefix = ''">
|
|
13969
|
+
<xsl:text>./</xsl:text>
|
|
13970
|
+
</xsl:if>
|
|
13960
13971
|
<xsl:value-of select="$html.js.dir"/>
|
|
13961
13972
|
<xsl:text>/mathjax_startup.js';
</xsl:text>
|
|
13962
13973
|
<xsl:text>startMathJax({
</xsl:text>
|
|
@@ -14651,7 +14662,20 @@ TODO:
|
|
|
14651
14662
|
<xsl:template name="css-common">
|
|
14652
14663
|
<!-- Temporary until css handling overhaul by ascholer complete -->
|
|
14653
14664
|
<xsl:if test="$b-needs-custom-marker-css">
|
|
14654
|
-
<
|
|
14665
|
+
<xsl:choose>
|
|
14666
|
+
<!-- These styles are derived from the source, so they are not on -->
|
|
14667
|
+
<!-- the CDN and "$html.css.dir" does not point at them. Inline -->
|
|
14668
|
+
<!-- them: there is one short rule per unique author-supplied -->
|
|
14669
|
+
<!-- marker, and portable HTML has no place to link out to anyway. -->
|
|
14670
|
+
<xsl:when test="$b-cdn-resources">
|
|
14671
|
+
<style>
|
|
14672
|
+
<xsl:apply-templates select="exsl:node-set($ol-markers)//ol-marker" mode="ol-marker-style"/>
|
|
14673
|
+
</style>
|
|
14674
|
+
</xsl:when>
|
|
14675
|
+
<xsl:otherwise>
|
|
14676
|
+
<link href="{$html.css.dir}/ol-markers.css" rel="stylesheet" type="text/css"/>
|
|
14677
|
+
</xsl:otherwise>
|
|
14678
|
+
</xsl:choose>
|
|
14655
14679
|
</xsl:if>
|
|
14656
14680
|
<!-- If extra CSS is specified, then unpack multiple CSS files -->
|
|
14657
14681
|
<xsl:if test="not($html.css.extra = '')">
|
|
@@ -1131,11 +1131,21 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1131
1131
|
<!-- Add a question mark, then grab leading substring -->
|
|
1132
1132
|
<!-- This will fail if "?" is encoded -->
|
|
1133
1133
|
<xsl:variable name="no-query-string" select="substring-before(concat($filename, '?'), '?')" />
|
|
1134
|
+
<!-- Reduce to the last path segment first, else a period in a host -->
|
|
1135
|
+
<!-- name or a directory ("media.w3.org", "v1.2") would be read as -->
|
|
1136
|
+
<!-- the start of an extension. The leading slash is what makes -->
|
|
1137
|
+
<!-- "substring-after-last" return a bare filename unchanged. -->
|
|
1138
|
+
<xsl:variable name="final-segment">
|
|
1139
|
+
<xsl:call-template name="substring-after-last">
|
|
1140
|
+
<xsl:with-param name="input" select="concat('/', $no-query-string)" />
|
|
1141
|
+
<xsl:with-param name="substr" select="'/'" />
|
|
1142
|
+
</xsl:call-template>
|
|
1143
|
+
</xsl:variable>
|
|
1134
1144
|
<!-- get extension after last period -->
|
|
1135
1145
|
<!-- will return empty if no extension -->
|
|
1136
1146
|
<xsl:variable name="extension">
|
|
1137
1147
|
<xsl:call-template name="substring-after-last">
|
|
1138
|
-
<xsl:with-param name="input" select="$
|
|
1148
|
+
<xsl:with-param name="input" select="$final-segment" />
|
|
1139
1149
|
<xsl:with-param name="substr" select="'.'" />
|
|
1140
1150
|
</xsl:call-template>
|
|
1141
1151
|
</xsl:variable>
|
|
@@ -324,6 +324,125 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
324
324
|
</xsl:variable>
|
|
325
325
|
|
|
326
326
|
|
|
327
|
+
<!--========================================================================-->
|
|
328
|
+
<!-- test file-extension -->
|
|
329
|
+
<xsl:variable name="file-extension-bare">
|
|
330
|
+
<xsl:variable name="test-val">
|
|
331
|
+
<xsl:call-template name="file-extension">
|
|
332
|
+
<xsl:with-param name="filename" select="'movie.mp4'"/>
|
|
333
|
+
</xsl:call-template>
|
|
334
|
+
</xsl:variable>
|
|
335
|
+
<xsl:call-template name="assert-equal">
|
|
336
|
+
<xsl:with-param name="expected" select="'mp4'"/>
|
|
337
|
+
<xsl:with-param name="actual" select="$test-val"/>
|
|
338
|
+
<xsl:with-param name="test-name" select="'file-extension-bare'"/>
|
|
339
|
+
</xsl:call-template>
|
|
340
|
+
</xsl:variable>
|
|
341
|
+
|
|
342
|
+
<xsl:variable name="file-extension-none">
|
|
343
|
+
<xsl:variable name="test-val">
|
|
344
|
+
<xsl:call-template name="file-extension">
|
|
345
|
+
<xsl:with-param name="filename" select="'movie'"/>
|
|
346
|
+
</xsl:call-template>
|
|
347
|
+
</xsl:variable>
|
|
348
|
+
<xsl:call-template name="assert-equal">
|
|
349
|
+
<xsl:with-param name="expected" select="''"/>
|
|
350
|
+
<xsl:with-param name="actual" select="$test-val"/>
|
|
351
|
+
<xsl:with-param name="test-name" select="'file-extension-none'"/>
|
|
352
|
+
</xsl:call-template>
|
|
353
|
+
</xsl:variable>
|
|
354
|
+
|
|
355
|
+
<xsl:variable name="file-extension-uppercase">
|
|
356
|
+
<xsl:variable name="test-val">
|
|
357
|
+
<xsl:call-template name="file-extension">
|
|
358
|
+
<xsl:with-param name="filename" select="'MOVIE.MP4'"/>
|
|
359
|
+
</xsl:call-template>
|
|
360
|
+
</xsl:variable>
|
|
361
|
+
<xsl:call-template name="assert-equal">
|
|
362
|
+
<xsl:with-param name="expected" select="'mp4'"/>
|
|
363
|
+
<xsl:with-param name="actual" select="$test-val"/>
|
|
364
|
+
<xsl:with-param name="test-name" select="'file-extension-uppercase'"/>
|
|
365
|
+
</xsl:call-template>
|
|
366
|
+
</xsl:variable>
|
|
367
|
+
|
|
368
|
+
<xsl:variable name="file-extension-relative-path">
|
|
369
|
+
<xsl:variable name="test-val">
|
|
370
|
+
<xsl:call-template name="file-extension">
|
|
371
|
+
<xsl:with-param name="filename" select="'video/movie.webm'"/>
|
|
372
|
+
</xsl:call-template>
|
|
373
|
+
</xsl:variable>
|
|
374
|
+
<xsl:call-template name="assert-equal">
|
|
375
|
+
<xsl:with-param name="expected" select="'webm'"/>
|
|
376
|
+
<xsl:with-param name="actual" select="$test-val"/>
|
|
377
|
+
<xsl:with-param name="test-name" select="'file-extension-relative-path'"/>
|
|
378
|
+
</xsl:call-template>
|
|
379
|
+
</xsl:variable>
|
|
380
|
+
|
|
381
|
+
<xsl:variable name="file-extension-relative-none">
|
|
382
|
+
<xsl:variable name="test-val">
|
|
383
|
+
<xsl:call-template name="file-extension">
|
|
384
|
+
<xsl:with-param name="filename" select="'video/ups-visitor-guide-360'"/>
|
|
385
|
+
</xsl:call-template>
|
|
386
|
+
</xsl:variable>
|
|
387
|
+
<xsl:call-template name="assert-equal">
|
|
388
|
+
<xsl:with-param name="expected" select="''"/>
|
|
389
|
+
<xsl:with-param name="actual" select="$test-val"/>
|
|
390
|
+
<xsl:with-param name="test-name" select="'file-extension-relative-none'"/>
|
|
391
|
+
</xsl:call-template>
|
|
392
|
+
</xsl:variable>
|
|
393
|
+
|
|
394
|
+
<xsl:variable name="file-extension-query-string">
|
|
395
|
+
<xsl:variable name="test-val">
|
|
396
|
+
<xsl:call-template name="file-extension">
|
|
397
|
+
<xsl:with-param name="filename" select="'movie.mp4?start=16'"/>
|
|
398
|
+
</xsl:call-template>
|
|
399
|
+
</xsl:variable>
|
|
400
|
+
<xsl:call-template name="assert-equal">
|
|
401
|
+
<xsl:with-param name="expected" select="'mp4'"/>
|
|
402
|
+
<xsl:with-param name="actual" select="$test-val"/>
|
|
403
|
+
<xsl:with-param name="test-name" select="'file-extension-query-string'"/>
|
|
404
|
+
</xsl:call-template>
|
|
405
|
+
</xsl:variable>
|
|
406
|
+
|
|
407
|
+
<xsl:variable name="file-extension-url">
|
|
408
|
+
<xsl:variable name="test-val">
|
|
409
|
+
<xsl:call-template name="file-extension">
|
|
410
|
+
<xsl:with-param name="filename" select="'https://media.w3.org/2010/05/sintel/trailer.mp4'"/>
|
|
411
|
+
</xsl:call-template>
|
|
412
|
+
</xsl:variable>
|
|
413
|
+
<xsl:call-template name="assert-equal">
|
|
414
|
+
<xsl:with-param name="expected" select="'mp4'"/>
|
|
415
|
+
<xsl:with-param name="actual" select="$test-val"/>
|
|
416
|
+
<xsl:with-param name="test-name" select="'file-extension-url'"/>
|
|
417
|
+
</xsl:call-template>
|
|
418
|
+
</xsl:variable>
|
|
419
|
+
|
|
420
|
+
<xsl:variable name="file-extension-url-none">
|
|
421
|
+
<xsl:variable name="test-val">
|
|
422
|
+
<xsl:call-template name="file-extension">
|
|
423
|
+
<xsl:with-param name="filename" select="'https://media.w3.org/2010/05/sintel/trailer'"/>
|
|
424
|
+
</xsl:call-template>
|
|
425
|
+
</xsl:variable>
|
|
426
|
+
<xsl:call-template name="assert-equal">
|
|
427
|
+
<xsl:with-param name="expected" select="''"/>
|
|
428
|
+
<xsl:with-param name="actual" select="$test-val"/>
|
|
429
|
+
<xsl:with-param name="test-name" select="'file-extension-url-none'"/>
|
|
430
|
+
</xsl:call-template>
|
|
431
|
+
</xsl:variable>
|
|
432
|
+
|
|
433
|
+
<xsl:variable name="file-extension-url-dotted-directory">
|
|
434
|
+
<xsl:variable name="test-val">
|
|
435
|
+
<xsl:call-template name="file-extension">
|
|
436
|
+
<xsl:with-param name="filename" select="'https://example.org/v1.2/movie.webm'"/>
|
|
437
|
+
</xsl:call-template>
|
|
438
|
+
</xsl:variable>
|
|
439
|
+
<xsl:call-template name="assert-equal">
|
|
440
|
+
<xsl:with-param name="expected" select="'webm'"/>
|
|
441
|
+
<xsl:with-param name="actual" select="$test-val"/>
|
|
442
|
+
<xsl:with-param name="test-name" select="'file-extension-url-dotted-directory'"/>
|
|
443
|
+
</xsl:call-template>
|
|
444
|
+
</xsl:variable>
|
|
445
|
+
|
|
327
446
|
<!--========================================================================-->
|
|
328
447
|
|
|
329
448
|
<!-- "main" -->
|