@pretextbook/pretext-html 0.7.0 → 0.9.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.
Files changed (43) hide show
  1. package/README.md +31 -2
  2. package/assets/preview-html.xsl +16 -0
  3. package/assets/upstream.json +1 -1
  4. package/assets/xsl/README.md +25 -24
  5. package/assets/xsl/entities.ent +11 -0
  6. package/assets/xsl/extract-dynamic.xsl +54 -3
  7. package/assets/xsl/extract-gdscript.xsl +61 -0
  8. package/assets/xsl/extract-sageplot.xsl +3 -0
  9. package/assets/xsl/localizations/README.md +24 -24
  10. package/assets/xsl/localizations/it-IT.xml +37 -41
  11. package/assets/xsl/pretext-assembly.xsl +190 -30
  12. package/assets/xsl/pretext-beamer.xsl +57 -12
  13. package/assets/xsl/pretext-common.xsl +175 -30
  14. package/assets/xsl/pretext-epub.xsl +4 -6
  15. package/assets/xsl/pretext-fo.xsl +127 -67
  16. package/assets/xsl/pretext-html.xsl +350 -94
  17. package/assets/xsl/pretext-jupyter.xsl +1 -0
  18. package/assets/xsl/pretext-latex-classic.xsl +2 -2
  19. package/assets/xsl/pretext-latex-common.xsl +296 -151
  20. package/assets/xsl/pretext-latex.xsl +16 -6
  21. package/assets/xsl/pretext-numbers.xsl +10 -0
  22. package/assets/xsl/pretext-revealjs.xsl +69 -4
  23. package/assets/xsl/pretext-runestone-fitb.xsl +179 -84
  24. package/assets/xsl/pretext-runestone-static.xsl +72 -20
  25. package/assets/xsl/pretext-runestone.xsl +32 -25
  26. package/assets/xsl/pretext-text-utilities.xsl +7 -0
  27. package/assets/xsl/pretext-text.xsl +17 -0
  28. package/assets/xsl/publisher-variables.xsl +109 -111
  29. package/assets/xsl/support/play-button/README.md +1 -3
  30. package/assets/xsl/tests/README.md +1 -1
  31. package/assets/xsl/utilities/README.md +6 -8
  32. package/assets/xsl-bundle.json +1 -1
  33. package/dist/cli-BUrNZxov.js +1098 -0
  34. package/dist/cli.js +1 -1
  35. package/dist/html-static.d.ts +20 -0
  36. package/dist/index.browser.js +598 -374
  37. package/dist/index.d.ts +4 -0
  38. package/dist/index.js +35 -30
  39. package/dist/renderer.d.ts +40 -1
  40. package/dist/skeleton.d.ts +41 -0
  41. package/dist/xrefs.d.ts +54 -0
  42. package/package.json +2 -1
  43. package/dist/cli-D0m0Ha1j.js +0 -856
@@ -59,6 +59,8 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
59
59
  <xsl:param name="rs-css" select="''"/>
60
60
  <xsl:param name="rs-version" select="''"/>
61
61
 
62
+ <xsl:param name="godot.shell" select="'https://runestone.academy/cdn/runestone/godot-shell-'"/>
63
+
62
64
  <!-- The Runestone Services version actually in use is -->
63
65
  <!-- needed several places, so we compute it once now. -->
64
66
  <!-- Manifest, two "ebookConfig". -->
@@ -542,10 +544,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
542
544
  <xsl:value-of select="$latex-packages-mathjax"/>
543
545
  <xsl:value-of select="$latex-macros"/>
544
546
  </latex-macros>
545
- <!-- Report major and minor versions from WW so Runestone knows what's up. -->
546
- <!-- These variables are formed in -html and could be empty/blank. Hoever, -->
547
- <!-- they should always be defined as global variables. -->
548
- <webwork-version major="{$webwork-major-version}" minor="{$webwork-minor-version}"/>
549
547
  <xsl:choose>
550
548
  <xsl:when test="self::book">
551
549
  <!-- Now recurse into chapters, appendix -->
@@ -1426,15 +1424,8 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1426
1424
  <!-- NB: sample had paths with a leading backslash -->
1427
1425
  <xsl:if test="@database">
1428
1426
  <xsl:attribute name="data-dburl">
1429
- <xsl:choose>
1430
- <xsl:when test="$b-managed-directories">
1431
- <xsl:value-of select="$external-directory"/>
1432
- <xsl:value-of select="@database"/>
1433
- </xsl:when>
1434
- <xsl:otherwise>
1435
- <xsl:value-of select="@database"/>
1436
- </xsl:otherwise>
1437
- </xsl:choose>
1427
+ <xsl:value-of select="$external-directory"/>
1428
+ <xsl:value-of select="@database"/>
1438
1429
  </xsl:attribute>
1439
1430
  </xsl:if>
1440
1431
  <!-- for natural language, just skip attribute -->
@@ -2584,15 +2575,32 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
2584
2575
  <!-- This is a location in the external directory. -->
2585
2576
  <xsl:if test="@database">
2586
2577
  <xsl:attribute name="data-dburl">
2587
- <xsl:choose>
2588
- <xsl:when test="$b-managed-directories">
2589
- <xsl:value-of select="$external-directory"/>
2590
- <xsl:value-of select="@database"/>
2591
- </xsl:when>
2592
- <xsl:otherwise>
2593
- <xsl:value-of select="@database"/>
2594
- </xsl:otherwise>
2595
- </xsl:choose>
2578
+ <xsl:value-of select="$external-directory"/>
2579
+ <xsl:value-of select="@database"/>
2580
+ </xsl:attribute>
2581
+ </xsl:if>
2582
+ </xsl:if>
2583
+ <!-- GDScript (Godot WASM) needs to find the shell engine files -->
2584
+ <xsl:if test="$active-language = 'gdscript'">
2585
+ <xsl:attribute name="data-wasm">
2586
+ <xsl:value-of select="$godot.shell" />
2587
+ <xsl:value-of select="$godot.version" />
2588
+ </xsl:attribute>
2589
+ <!-- Optional: per-exercise pck directory in the external directory -->
2590
+ <xsl:if test="@pck">
2591
+ <xsl:attribute name="data-pck">
2592
+ <xsl:value-of select="$generated-directory"/>
2593
+ <!-- add subdirectory -->
2594
+ <xsl:text>gdscript/</xsl:text>
2595
+ <!-- add template -->
2596
+ <xsl:apply-templates select="." mode="unique-id" />
2597
+ <xsl:text>.zip</xsl:text>
2598
+ </xsl:attribute>
2599
+ </xsl:if>
2600
+ <!-- Scene path inside the .pck virtual filesystem -->
2601
+ <xsl:if test="@scene">
2602
+ <xsl:attribute name="data-scene">
2603
+ <xsl:value-of select="@scene"/>
2596
2604
  </xsl:attribute>
2597
2605
  </xsl:if>
2598
2606
  </xsl:if>
@@ -2715,9 +2723,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
2715
2723
  <!-- locate trace data via a *.js file, managed or not -->
2716
2724
  <xsl:variable name="trace-file">
2717
2725
  <xsl:value-of select="$generated-directory"/>
2718
- <xsl:if test="$b-managed-directories">
2719
- <xsl:text>trace/</xsl:text>
2720
- </xsl:if>
2726
+ <xsl:text>trace/</xsl:text>
2721
2727
  <xsl:apply-templates select="." mode="runestone-codelens-trace-filename"/>
2722
2728
  </xsl:variable>
2723
2729
  <!-- the Runestone HTML -->
@@ -2767,6 +2773,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
2767
2773
  <xsl:when test="$language = 'javascript'"> <xsl:text>browser</xsl:text></xsl:when>
2768
2774
  <xsl:when test="$language = 'html'"> <xsl:text>browser</xsl:text></xsl:when>
2769
2775
  <xsl:when test="$language = 'sql'"> <xsl:text>browser</xsl:text></xsl:when>
2776
+ <xsl:when test="$language = 'gdscript'"> <xsl:text>browser</xsl:text></xsl:when>
2770
2777
  <xsl:when test="$language = 'c'"> <xsl:text>jobeserver</xsl:text></xsl:when>
2771
2778
  <xsl:when test="$language = 'cpp'"> <xsl:text>jobeserver</xsl:text></xsl:when>
2772
2779
  <xsl:when test="$language = 'java'"> <xsl:text>jobeserver</xsl:text></xsl:when>
@@ -1012,6 +1012,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1012
1012
 
1013
1013
  <!-- First define the replacements. These must be in -->
1014
1014
  <!-- order as search + replace pairs -->
1015
+ <!-- Other control character replacements are not -->
1016
+ <!-- included because they would not be valid at an -->
1017
+ <!-- earlier stage. -->
1015
1018
  <xsl:variable name="json-replacements">
1016
1019
  <search>\</search>
1017
1020
  <replace>\\</replace>
@@ -1025,6 +1028,10 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1025
1028
  <replace>\r</replace>
1026
1029
  <search><xsl:value-of select="string('&#x22;')"/></search>
1027
1030
  <replace>\&#x22;</replace>
1031
+ <search><xsl:value-of select="string('&#x2028;')"/></search>
1032
+ <replace>\u2028</replace>
1033
+ <search><xsl:value-of select="string('&#x2029;')"/></search>
1034
+ <replace>\u2029</replace>
1028
1035
  </xsl:variable>
1029
1036
  <xsl:variable name="json-replacements-search-set" select="exsl:node-set($json-replacements)/search" />
1030
1037
  <xsl:variable name="json-replacements-replace-set" select="exsl:node-set($json-replacements)/replace" />
@@ -353,12 +353,29 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
353
353
 
354
354
  <!-- Modest: each row a line, cells separated by double spaces. -->
355
355
  <!-- No column alignment (yet), spanning cells simply run in. -->
356
+ <!-- Table notes ("tn") collect just below the table, lettered -->
357
+ <!-- in reading order; letters keep them apart from the [1]-style -->
358
+ <!-- marks of true footnotes. -->
356
359
  <xsl:template match="tabular">
357
360
  <xsl:text>&#xa;</xsl:text>
358
361
  <xsl:apply-templates select="row"/>
362
+ <xsl:for-each select=".//tn">
363
+ <xsl:text>[</xsl:text>
364
+ <xsl:apply-templates select="." mode="number"/>
365
+ <xsl:text>] </xsl:text>
366
+ <xsl:apply-templates/>
367
+ <xsl:text>&#xa;</xsl:text>
368
+ </xsl:for-each>
359
369
  <xsl:text>&#xa;</xsl:text>
360
370
  </xsl:template>
361
371
 
372
+ <!-- The letter mark of a table note, at its cell location -->
373
+ <xsl:template match="tabular//tn">
374
+ <xsl:text>[</xsl:text>
375
+ <xsl:apply-templates select="." mode="number"/>
376
+ <xsl:text>]</xsl:text>
377
+ </xsl:template>
378
+
362
379
  <xsl:template match="row">
363
380
  <xsl:text> </xsl:text>
364
381
  <xsl:for-each select="cell">
@@ -1156,7 +1156,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1156
1156
  <!-- while a trailing slash will be reliably added if -->
1157
1157
  <!-- (a) not present in publisher file specification -->
1158
1158
  <!-- (b) the path is not empty -->
1159
- <!-- The external directory is a fact of the source (a different -->
1159
+ <!-- The external directory is a property of the source (a different -->
1160
1160
  <!-- directory of files is a different document), so its declaration -->
1161
1161
  <!-- is "directories/@external" within "docinfo" (2026-07-30). The -->
1162
1162
  <!-- publication file "source/directories/@external" is deprecated but -->
@@ -1165,6 +1165,13 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1165
1165
  <!-- directory variables and the tree behind $docinfo does not exist -->
1166
1166
  <!-- yet at that point (referencing it is a circular definition). -->
1167
1167
  <xsl:variable name="external-directory-source">
1168
+ <!-- an empty declaration is an error, not an election -->
1169
+ <xsl:if test="$version-docinfo/directories/@external = ''">
1170
+ <xsl:message terminate="yes">PTX:FATAL: the value of "directories/@external" within "docinfo" must be nonempty</xsl:message>
1171
+ </xsl:if>
1172
+ <xsl:if test="$publication/source/directories/@external = ''">
1173
+ <xsl:message terminate="yes">PTX:FATAL: the value of source/directories/@external in the publisher file must be nonempty</xsl:message>
1174
+ </xsl:if>
1168
1175
  <xsl:variable name="raw-input">
1169
1176
  <xsl:choose>
1170
1177
  <xsl:when test="$version-docinfo/directories/@external">
@@ -1174,7 +1181,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1174
1181
  <xsl:value-of select="$version-docinfo/directories/@external"/>
1175
1182
  </xsl:when>
1176
1183
  <xsl:when test="$publication/source/directories/@external">
1177
- <xsl:message>PTX:DEPRECATE: (2026-07-30) the external directory is a fact of the source, and is now declared with a "directories/@external" attribute within "docinfo". The publication file entry "source/directories/@external" is honored meanwhile, but please relocate it.</xsl:message>
1184
+ <xsl:message>PTX:DEPRECATE: (2026-07-30) the external directory is a property of your source, and is now declared with a "directories/@external" attribute within "docinfo". The publication file entry "source/directories/@external" is honored meanwhile, but please relocate it.</xsl:message>
1178
1185
  <xsl:value-of select="$publication/source/directories/@external"/>
1179
1186
  </xsl:when>
1180
1187
  <xsl:otherwise/>
@@ -1200,104 +1207,50 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1200
1207
  </xsl:choose>
1201
1208
  </xsl:variable>
1202
1209
 
1203
- <!-- Historically this was given by the "images" directory as a default, -->
1204
- <!-- and it seems almost every author just ran with this. -->
1210
+ <!-- The generated directory is machine-owned, so it is defaultable: -->
1211
+ <!-- an undeclared location is the directory "generated", beside the -->
1212
+ <!-- source. (Historically an unmanaged scheme fell back to the -->
1213
+ <!-- "images" directory; managed directories are now the only scheme.)-->
1205
1214
  <xsl:variable name="generated-directory-source">
1206
- <xsl:variable name="raw-input" select="$publication/source/directories/@generated"/>
1207
- <xsl:choose>
1208
- <xsl:when test="$b-managed-directories">
1209
- <xsl:choose>
1210
- <xsl:when test="substring($raw-input, 1, 1) = '/'">
1211
- <xsl:message>PTX:FALLBACK: a generated-image directory (source/directories/@generated in the publisher file) must be a relative path and not begin with "/" as in "<xsl:value-of select="$raw-input"/>". Proceeding with the default, which is an empty string, and may lead to unexpected results.</xsl:message>
1212
- <xsl:text/>
1213
- </xsl:when>
1214
- <!-- trailing path separator is good -->
1215
- <xsl:when test="substring($raw-input, string-length($raw-input), 1) = '/'">
1216
- <xsl:value-of select="$raw-input"/>
1217
- </xsl:when>
1218
- <!-- if there is substance, we need to add a trailing slash -->
1219
- <xsl:when test="string-length($raw-input) > 0">
1220
- <xsl:value-of select="concat($raw-input, '/')"/>
1221
- </xsl:when>
1222
- <!-- specification must be empty, so we leave it that way -->
1223
- <xsl:otherwise/>
1224
- </xsl:choose>
1225
- </xsl:when>
1226
- <!-- Should issue a deprecation warning (elsewhere) for this. -->
1227
- <!-- directory.images *is* defined elsewhere in this stylesheet, -->
1228
- <!-- and defaults to "images", but does not have a slash, which -->
1229
- <!-- is presumed for the $generated-directory variable -->
1230
- <xsl:otherwise>
1231
- <xsl:value-of select="concat($directory.images, '/')"/>
1232
- </xsl:otherwise>
1233
- </xsl:choose>
1234
- </xsl:variable>
1235
-
1236
- <!-- For backward-compatibility, we want to know if the collection of -->
1237
- <!-- generated images is structured by their production method (newer) -->
1238
- <!-- or not (older, historical). So we create a boolean based on the -->
1239
- <!-- presence of the publisher file specification. -->
1240
- <xsl:variable name="managed-directories">
1241
- <xsl:if test="$version-docinfo/directories/@external = ''">
1242
- <xsl:message terminate="yes">PTX:FATAL: the value of "directories/@external" within "docinfo" must be nonempty</xsl:message>
1243
- </xsl:if>
1244
- <xsl:if test="$publication/source/directories/@external = ''">
1245
- <xsl:message terminate="yes">PTX:FATAL: the value of source/directories/@external in the publisher file must be nonempty</xsl:message>
1246
- </xsl:if>
1247
1215
  <xsl:if test="$publication/source/directories/@generated = ''">
1248
1216
  <xsl:message terminate="yes">PTX:FATAL: the value of source/directories/@generated in the publisher file must be nonempty</xsl:message>
1249
1217
  </xsl:if>
1250
- <!-- The external directory may be declared in "docinfo" (preferred) -->
1251
- <!-- or the publication file (deprecated, honored); the generated -->
1252
- <!-- directory is a publication file entry. Management requires an -->
1253
- <!-- external declaration, from either home, together with the -->
1254
- <!-- generated declaration. -->
1255
- <xsl:variable name="b-has-external" select="boolean($version-docinfo/directories/@external) or boolean($publication/source/directories/@external)"/>
1218
+ <xsl:variable name="raw-input">
1219
+ <xsl:choose>
1220
+ <xsl:when test="$publication/source/directories/@generated">
1221
+ <xsl:value-of select="$publication/source/directories/@generated"/>
1222
+ </xsl:when>
1223
+ <xsl:otherwise>
1224
+ <xsl:text>generated</xsl:text>
1225
+ </xsl:otherwise>
1226
+ </xsl:choose>
1227
+ </xsl:variable>
1256
1228
  <xsl:choose>
1257
- <xsl:when test="$b-has-external and $publication/source/directories/@generated">
1258
- <xsl:text>yes</xsl:text>
1229
+ <xsl:when test="substring($raw-input, 1, 1) = '/'">
1230
+ <xsl:message>PTX:FALLBACK: a generated-image directory (source/directories/@generated in the publisher file) must be a relative path and not begin with "/" as in "<xsl:value-of select="$raw-input"/>". Proceeding with the default, which is an empty string, and may lead to unexpected results.</xsl:message>
1231
+ <xsl:text/>
1259
1232
  </xsl:when>
1260
- <xsl:when test="not($b-has-external) and not($publication/source/directories/@generated)">
1261
- <xsl:text>no</xsl:text>
1233
+ <!-- trailing path separator is good -->
1234
+ <xsl:when test="substring($raw-input, string-length($raw-input), 1) = '/'">
1235
+ <xsl:value-of select="$raw-input"/>
1262
1236
  </xsl:when>
1237
+ <!-- add the trailing slash -->
1263
1238
  <xsl:otherwise>
1264
- <xsl:message>PTX:FALLBACK: an external directory ("directories/@external" within "docinfo", or the deprecated publication file form) and a generated directory (source/directories/@generated in the publication file) must be specified together; only one was found. Proceeding as if neither was specified.</xsl:message>
1265
- <xsl:text>no</xsl:text>
1239
+ <xsl:value-of select="concat($raw-input, '/')"/>
1266
1240
  </xsl:otherwise>
1267
1241
  </xsl:choose>
1268
1242
  </xsl:variable>
1269
- <xsl:variable name="b-managed-directories" select="$managed-directories = 'yes'"/>
1270
1243
 
1271
- <!-- Destination directory is hard-coded here and used in -->
1272
- <!-- various conversions under the managed directories scheme. -->
1273
- <xsl:variable name="external-directory">
1274
- <xsl:choose>
1275
- <xsl:when test="$b-managed-directories">
1276
- <xsl:text>external/</xsl:text>
1277
- </xsl:when>
1278
- <!-- backwards-compatiblity, there never was any sort of -->
1279
- <!-- naming/copying scheme for externally produced content -->
1280
- <xsl:otherwise/>
1281
- </xsl:choose>
1282
- </xsl:variable>
1244
+ <!-- Managed directories are the only scheme (2026-08-02). The two -->
1245
+ <!-- directions are independent facts: an undeclared external means -->
1246
+ <!-- the project has no external assets, and the machine-owned -->
1247
+ <!-- generated directory is defaultable. -->
1283
1248
 
1284
- <!-- There was once a scheme of sorts for managing the directory -->
1285
- <!-- where generated images landed and were found. So we need -->
1286
- <!-- to preserve that logic for backward-compatibility. -->
1287
- <xsl:variable name="generated-directory">
1288
- <xsl:choose>
1289
- <xsl:when test="$b-managed-directories">
1290
- <xsl:value-of select="'generated/'"/>
1291
- </xsl:when>
1292
- <!-- Should issue a deprecation warning (elsewhere) for this. -->
1293
- <!-- directory.images *is* defined elsewhere in this stylesheet, -->
1294
- <!-- and defaults to "images", but does not have a slash, which -->
1295
- <!-- is presumed for the $generated-directory variable -->
1296
- <xsl:otherwise>
1297
- <xsl:value-of select="concat($directory.images, '/')"/>
1298
- </xsl:otherwise>
1299
- </xsl:choose>
1300
- </xsl:variable>
1249
+
1250
+ <!-- The destination directories within any output are hard-coded -->
1251
+ <!-- here, and used in the various conversions. -->
1252
+ <xsl:variable name="external-directory" select="'external/'"/>
1253
+ <xsl:variable name="generated-directory" select="'generated/'"/>
1301
1254
 
1302
1255
 
1303
1256
  <!-- This is a directory that may need to be copied to a -->
@@ -1436,22 +1389,17 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1436
1389
  <!-- variable since it will not be used, and it is silent. -->
1437
1390
  <xsl:if test="$original//webwork[node() or @*]">
1438
1391
  <xsl:choose>
1439
- <!-- Note: $generated-directory-source is never empty? -->
1440
- <!-- Defaults to the very old "directory.images"? -->
1441
- <!-- So testing for the publication file entry is better. -->
1442
- <xsl:when test="$publication/source/directories/@generated">
1443
- <xsl:value-of select="str:replace(concat($generated-directory-source, 'webwork/'), '&#x20;', '%20')"/>
1444
- </xsl:when>
1445
- <xsl:when test="$publication/source/@webwork-problems">
1392
+ <!-- the deprecated location is honored only when no -->
1393
+ <!-- generated directory is declared -->
1394
+ <xsl:when test="$publication/source/@webwork-problems and not($publication/source/directories/@generated)">
1446
1395
  <xsl:value-of select="str:replace($publication/source/@webwork-problems, '&#x20;', '%20')"/>
1447
1396
  <xsl:message>PTX:DEPRECATE: the publication file entry source/@webwork-problems is</xsl:message>
1448
1397
  <xsl:message> deprecated, please move to using managed directories</xsl:message>
1449
1398
  </xsl:when>
1450
- <!-- no specification, so empty string for filename -->
1451
- <!-- this will be noted where it is employed -->
1452
- <!-- no specification, so empty string for directory -->
1453
- <!-- this will be noted where it is employed -->
1454
- <xsl:otherwise/>
1399
+ <!-- the generated directory, declared or defaulted -->
1400
+ <xsl:otherwise>
1401
+ <xsl:value-of select="str:replace(concat($generated-directory-source, 'webwork/'), '&#x20;', '%20')"/>
1402
+ </xsl:otherwise>
1455
1403
  </xsl:choose>
1456
1404
  </xsl:if>
1457
1405
  </xsl:variable>
@@ -1463,18 +1411,34 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1463
1411
  <xsl:variable name="dynamic-substitutions-file">
1464
1412
  <!-- Only relevant if there are dynamic exercises present. -->
1465
1413
  <xsl:if test="$original//exercise//setup">
1466
- <xsl:choose>
1467
- <!-- Look in the publication file for the generated directory -->
1468
- <xsl:when test="$publication/source/directories/@generated">
1469
- <xsl:value-of select="str:replace(concat($generated-directory-source, 'dynamic_subs/dynamic_substitutions.xml'), '&#x20;', '%20')"/>
1470
- </xsl:when>
1471
- <!-- no specification, so empty string for filename -->
1472
- <!-- this will be noted where it is employed -->
1473
- <xsl:otherwise/>
1474
- </xsl:choose>
1414
+ <!-- the generated directory, declared or defaulted -->
1415
+ <xsl:value-of select="str:replace(concat($generated-directory-source, 'dynamic_subs/dynamic_substitutions.xml'), '&#x20;', '%20')"/>
1475
1416
  </xsl:if>
1476
1417
  </xsl:variable>
1477
1418
 
1419
+ <!-- A dynamic exercise may pull in a Javascript library that is not -->
1420
+ <!-- part of the project, via setup/jsimports/jslibrary/@url . In -->
1421
+ <!-- HTML that code runs in the reader's browser, sandboxed as any -->
1422
+ <!-- other page script. But a *static* build (LaTeX, PDF, EPUB) must -->
1423
+ <!-- execute the same library under Node, on the machine doing the -->
1424
+ <!-- build, with no sandbox at all. So a static build refuses to run -->
1425
+ <!-- a remote library unless the publisher has named it here: -->
1426
+ <!-- -->
1427
+ <!-- <dynamics> -->
1428
+ <!-- <remote-libraries> -->
1429
+ <!-- <library url="https://example.org/matrix.mjs"/> -->
1430
+ <!-- </remote-libraries> -->
1431
+ <!-- </dynamics> -->
1432
+ <!-- -->
1433
+ <!-- This is deliberately a per-URL list and not a blanket switch, so -->
1434
+ <!-- that approval granted today cannot silently extend to a library -->
1435
+ <!-- some exercise starts importing tomorrow. HTML builds are not -->
1436
+ <!-- gated, since the risk being managed is Node running unvetted -->
1437
+ <!-- code as the author, which is strictly greater than the in-browser -->
1438
+ <!-- case. The list is consumed by extract-dynamic.xsl , which -->
1439
+ <!-- passes it to the substitution script. -->
1440
+ <xsl:variable name="remote-library-allowlist" select="$publication/dynamics/remote-libraries/library"/>
1441
+
1478
1442
  <!-- File of custom/@name elements, whose content is a custom -->
1479
1443
  <!-- replacement for a corresponding custom/@ref element in -->
1480
1444
  <!-- the source. -->
@@ -1866,6 +1830,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1866
1830
  <!-- languages *always* supported, including "none" -->
1867
1831
  <xsl:when test="($entered-lang = 'none') or
1868
1832
  ($entered-lang = 'python') or
1833
+ ($entered-lang = 'gdscript') or
1869
1834
  ($entered-lang = 'javascript') or
1870
1835
  ($entered-lang = 'html') or
1871
1836
  ($entered-lang = 'sql')">
@@ -2824,6 +2789,14 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
2824
2789
  </xsl:variable>
2825
2790
  <xsl:variable name="b-has-embed-button" select="$embed-button = 'yes'"/>
2826
2791
 
2792
+ <!-- -->
2793
+ <!-- HTML Read-aloud control -->
2794
+ <!-- -->
2795
+
2796
+ <xsl:variable name="read-aloud">
2797
+ <xsl:apply-templates select="$publisher-attribute-options/html/pi:pub-attribute[@name='read-aloud']" mode="set-pubfile-variable"/>
2798
+ </xsl:variable>
2799
+ <xsl:variable name="b-read-aloud" select="not($read-aloud = 'no')"/>
2827
2800
 
2828
2801
  <!-- -->
2829
2802
  <!-- HTML Banner options -->
@@ -3471,6 +3444,16 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
3471
3444
  </xsl:choose>
3472
3445
  </xsl:variable>
3473
3446
 
3447
+ <!-- ######################## -->
3448
+ <!-- Beamer Slideshow Options -->
3449
+ <!-- ######################## -->
3450
+
3451
+ <!-- Beamer Theme -->
3452
+
3453
+ <xsl:variable name="beamer-theme">
3454
+ <xsl:apply-templates select="$publisher-attribute-options/beamer/appearance/pi:pub-attribute[@name='theme']" mode="set-pubfile-variable"/>
3455
+ </xsl:variable>
3456
+
3474
3457
 
3475
3458
  <!-- ########################################### -->
3476
3459
  <!-- Set Values/Defaults for Publisher Variables -->
@@ -3548,6 +3531,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
3548
3531
  </common>
3549
3532
  <html>
3550
3533
  <pi:pub-attribute name="short-answer-responses" default="graded" options="always"/>
3534
+ <pi:pub-attribute name="read-aloud" default="yes" options="no"/>
3551
3535
  <pi:pub-attribute name="favicon" default="none" options="simple"/>
3552
3536
  <pi:pub-attribute name="embed-button" default="no" options="yes"/>
3553
3537
  <pi:pub-attribute name="design-width" freeform="yes"/>
@@ -3718,6 +3702,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
3718
3702
  <pi:pub-attribute name="math" default="online" options="embedded"/>
3719
3703
  </resources>
3720
3704
  </revealjs>
3705
+ <beamer>
3706
+ <appearance>
3707
+ <pi:pub-attribute name="theme" default="Boadilla" freeform="yes"/>
3708
+ </appearance>
3709
+ </beamer>
3721
3710
  </pi:publisher>
3722
3711
 
3723
3712
  <!-- global variable for pi:publisher tree above -->
@@ -3946,9 +3935,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
3946
3935
  <!-- silently moved here, which should make no real difference -->
3947
3936
  <xsl:param name="directory.knowls" select="''" />
3948
3937
 
3949
- <!-- Deprecated 2020-11-23 in favor of publisher file -->
3950
- <!-- specification, but will still be respected -->
3951
- <xsl:param name="directory.images" select="'images'" />
3938
+ <!-- Deprecated 2020-11-23 in favor of publisher file -->
3939
+ <!-- specification; as of 2026-08-02 managed -->
3940
+ <!-- directories are the only scheme, so this is dead: -->
3941
+ <!-- it survives only to power a deprecation warning. -->
3942
+ <xsl:param name="directory.images" select="''" />
3952
3943
 
3953
3944
  <!-- 2021-01-03 chunk.level to publisher file -->
3954
3945
  <xsl:param name="chunk.level" select="''" />
@@ -4739,6 +4730,13 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
4739
4730
  <xsl:with-param name="incorrect-use" select="($html.annotation != '')" />
4740
4731
  </xsl:call-template>
4741
4732
  <!-- -->
4733
+ <!-- 2026-08-02 managed directories are the only scheme -->
4734
+ <xsl:call-template name="parameter-deprecation-message">
4735
+ <xsl:with-param name="date-string" select="'2026-08-02'" />
4736
+ <xsl:with-param name="message" select="'the directory.images parameter is now ignored: managed directories are the only scheme. Generated assets live in the directory given by source/directories/@generated in the publication file (default: &quot;generated&quot;, beside the source), and external assets in the directory given by &quot;directories/@external&quot; within &quot;docinfo&quot;.'" />
4737
+ <xsl:with-param name="incorrect-use" select="($directory.images != '')" />
4738
+ </xsl:call-template>
4739
+ <!-- -->
4742
4740
  </xsl:template>
4743
4741
 
4744
4742
  </xsl:stylesheet>
@@ -1,6 +1,5 @@
1
1
  Generic Video Preview Image
2
-
3
- ```
2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
3
 
5
4
  2023-02-07: This image was previously provided for LaTeX output as a macro that resolves to a TikZ version. See removed code and comments below. In HTML we use an SVG we have mildly edited. Search the HTML conversion for a template with name "generic-preview-svg".
6
5
 
@@ -43,4 +42,3 @@ The purpose of the PNG image is to be the static version created via the pre-pro
43
42
  (64.0200,47.9100) -- (38.2800,61.4100) -- cycle;
44
43
  \end{tikzpicture}
45
44
  }
46
- ```
@@ -40,4 +40,4 @@ Refer to the existing tests in `pretext-text-utilities-test.xsl` for examples of
40
40
  ## Files
41
41
 
42
42
  - `pretext-text-utilities-test.xsl`: Contains tests for the text utilities templates.
43
- - `null.xml`: A minimal XML file used as input for the tests.
43
+ - `null.xml`: A minimal XML file used as input for the tests.
@@ -21,30 +21,28 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
21
21
 
22
22
  ## Source-to-Source conversions
23
23
 
24
- For utility programs here which rewrite your source, be **sure** to use version control (collect and review changes on a branch, stash and drop undesirable outcomes), or have backups handy. The effects are not reversible. Stylesheets will output to standard output, so you can redirect their output, or you can use something like the `-o` flag on the `xsltproc` command-line invocation. Experiment first.
24
+ For utility programs here which rewrite your source, be **sure** to use version control (collect and review changes on a branch, stash and drop undesirable outcomes), or have backups handy. The effects are not reversible. Stylesheets will output to standard output, so you can redirect their output, or you can use something like the `-o` flag on the `xsltproc` command-line invocation. Experiment first.
25
25
 
26
26
  ### `fix-deprecations.xsl`
27
+ This will convert any obsolete element names or constructions to their replacements. As deprecations are added, you may run it anew, and only the new changes will be applied. Despite the name, it does make some minor changes. Empty tags will get a single space prior to the closing backslash.
27
28
 
28
- This will convert any obsolete element names or constructions to their replacements. As deprecations are added, you may run it anew, and only the new changes will be applied. Despite the name, it does make some minor changes. Empty tags will get a single space prior to the closing backslash.
29
-
30
- Be sure to read all the details in the Author's Guide before using this on your source. Here is an absolute minimal example.
31
-
29
+ Be sure to read all the details in the Author's Guide before using this on your source. Here is an absolute minimal example.
32
30
  ```
33
31
  $ xsltproc /path/to/xsl/utilities/fix-deprecations.xsl -stringparam fix all /path/to/examples/sample-errors-and-warnings.xml > new-sample.xml
34
32
 
35
33
  $ diff /path/to/examples/sample-errors-and-warnings.xml new-sample.xml
36
34
  ```
37
-
38
35
  (Updated: 2017-07-04)
39
36
 
37
+
40
38
  ## Author Report
41
39
 
42
- `author-report.xsl` is a very simple stylesheet which will produce a text version of items in your source that could benefit from your attention. This is different than validating your PreTeXt source against the schema, but is part of using automated tools to ensure healthy source material.
40
+ `author-report.xsl` is a very simple stylesheet which will produce a text version of items in your source that could benefit from your attention. This is different than validating your PreTeXt source against the schema, but is part of using automated tools to ensure healthy source material.
43
41
 
44
42
  (Updated: 2018-12-09)
45
43
 
46
44
  ## Intermediate Enhanced Source
47
45
 
48
- `pretext-enhanced-source.xsl` is mainly meant for development use. It outputs an XML file, which is not necessarily valid PreTeXt, at a key stage of the processing. It gives you a look under the hood (or bonnet). So generally not useful (or necessary) for authors.
46
+ `pretext-enhanced-source.xsl` is mainly meant for development use. It outputs an XML file, which is not necessarily valid PreTeXt, at a key stage of the processing. It gives you a look under the hood (or bonnet). So generally not useful (or necessary) for authors.
49
47
 
50
48
  (Updated: 2020-02-25)