@pretextbook/pretext-html 0.3.0 → 0.5.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 (58) hide show
  1. package/README.md +106 -10
  2. package/assets/preview-html.xsl +8 -4
  3. package/assets/preview-revealjs.xsl +85 -0
  4. package/assets/upstream.json +1 -1
  5. package/assets/xsl/LICENSE-pretext +16 -0
  6. package/assets/xsl/README.md +25 -24
  7. package/assets/xsl/entities.ent +27 -0
  8. package/assets/xsl/extract-biblio-csl.xsl +6 -4
  9. package/assets/xsl/extract-dynamic.xsl +14 -12
  10. package/assets/xsl/extract-interactive.xsl +2 -2
  11. package/assets/xsl/extract-pg.xsl +123 -306
  12. package/assets/xsl/extract-qrcode.xsl +12 -2
  13. package/assets/xsl/extract-sageplot.xsl +1 -1
  14. package/assets/xsl/extract-trace.xsl +3 -3
  15. package/assets/xsl/extract-youtube.xsl +1 -1
  16. package/assets/xsl/latex/pretext-latex-texstyle.xsl +4 -5
  17. package/assets/xsl/localizations/README.md +24 -24
  18. package/assets/xsl/pretext-assembly.xsl +463 -368
  19. package/assets/xsl/pretext-beamer.xsl +43 -146
  20. package/assets/xsl/pretext-braille-preprint.xsl +458 -202
  21. package/assets/xsl/pretext-common.xsl +486 -510
  22. package/assets/xsl/pretext-epub.xsl +318 -78
  23. package/assets/xsl/pretext-fo.xsl +80 -96
  24. package/assets/xsl/pretext-html.xsl +413 -318
  25. package/assets/xsl/pretext-jupyter.xsl +534 -322
  26. package/assets/xsl/pretext-latex-classic.xsl +14 -15
  27. package/assets/xsl/pretext-latex-common.xsl +393 -2397
  28. package/assets/xsl/pretext-latex.xsl +1995 -5
  29. package/assets/xsl/pretext-markdown.xsl +919 -0
  30. package/assets/xsl/pretext-numbers.xsl +57 -39
  31. package/assets/xsl/pretext-revealjs.xsl +241 -33
  32. package/assets/xsl/pretext-runestone-fitb.xsl +34 -35
  33. package/assets/xsl/pretext-runestone-static.xsl +17 -17
  34. package/assets/xsl/pretext-runestone.xsl +36 -34
  35. package/assets/xsl/pretext-sage-doctest.xsl +2 -2
  36. package/assets/xsl/pretext-text-utilities.xsl +69 -1
  37. package/assets/xsl/pretext-text.xsl +1077 -107
  38. package/assets/xsl/pretext-view-source.xsl +5 -3
  39. package/assets/xsl/pretext-ww-problem-sets.xsl +6 -1
  40. package/assets/xsl/publisher-variables.xsl +397 -477
  41. package/assets/xsl/support/play-button/README.md +1 -3
  42. package/assets/xsl/tests/README.md +1 -1
  43. package/assets/xsl/utilities/README.md +6 -8
  44. package/assets/xsl/utilities/report-publisher-variables.xsl +15 -0
  45. package/assets/xsl-bundle.json +1 -1
  46. package/dist/cli-DZsyZERX.js +694 -0
  47. package/dist/cli.js +1 -1
  48. package/dist/index.browser.d.ts +5 -0
  49. package/dist/index.browser.js +499 -344
  50. package/dist/index.d.ts +5 -0
  51. package/dist/index.js +23 -18
  52. package/dist/publication.d.ts +26 -12
  53. package/dist/renderer.d.ts +68 -0
  54. package/dist/reveal.d.ts +77 -0
  55. package/dist/reveal.js +110 -0
  56. package/dist/target.d.ts +34 -0
  57. package/package.json +12 -1
  58. package/dist/cli-CzoinNle.js +0 -639
@@ -34,9 +34,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
34
34
  xmlns:str="http://exslt.org/strings"
35
35
  xmlns:dyn="http://exslt.org/dynamic"
36
36
  extension-element-prefixes="pi exsl date str dyn"
37
- xmlns:mb="https://pretextbook.org/"
38
37
  xmlns:pf="https://prefigure.org"
39
- exclude-result-prefixes="mb"
40
38
  >
41
39
 
42
40
  <!-- PreTeXt common templates -->
@@ -188,7 +186,10 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
188
186
  <!-- "book" and "article" are sometimes different, esp. for LaTeX -->
189
187
  <xsl:variable name="b-is-book" select="$document-root/self::book" />
190
188
  <xsl:variable name="b-is-article" select="$document-root/self::article" />
191
- <!-- w/, w/o parts induces variants -->
189
+ <!-- w/, w/o parts induces variants -->
190
+ <!-- NB: computed from the *assembled* root; the version-tree analog, -->
191
+ <!-- $version-has-parts in publisher-variables.xsl, is the -->
192
+ <!-- pre-assembly fact — same concept, deliberately distinct name. -->
192
193
  <xsl:variable name="b-has-parts" select="boolean($root/book/part)" />
193
194
 
194
195
  <!-- File extensions can be set globally for a conversion, -->
@@ -404,7 +405,7 @@ $inline-solution-back|$divisional-solution-back|$worksheet-solution-back|$readin
404
405
  </xsl:when>
405
406
  <xsl:otherwise>
406
407
  <xsl:message>
407
- <xsl:text>PTX:WARNING: the whitespace parameter can be 'strict' or 'flexible', not '</xsl:text>
408
+ <xsl:text>PTX:FALLBACK: the whitespace parameter can be 'strict' or 'flexible', not '</xsl:text>
408
409
  <xsl:value-of select="$whitespace" />
409
410
  <xsl:text>'. Using the default ('flexible').</xsl:text>
410
411
  </xsl:message>
@@ -439,7 +440,7 @@ $inline-solution-back|$divisional-solution-back|$worksheet-solution-back|$readin
439
440
  <!-- An "exercisegroup" indents its exercises, to show the -->
440
441
  <!-- scope of the group, by this fraction of the prevailing -->
441
442
  <!-- text width. The LaTeX conversion applies it through -->
442
- <!-- \egindent (that many \linewidth); the XSL-FO conversion -->
443
+ <!-- \ptxegindent (that many \linewidth); the XSL-FO conversion -->
443
444
  <!-- scales its text measure. -->
444
445
  <xsl:variable name="exercisegroup-indentation" select="0.05"/>
445
446
 
@@ -579,7 +580,7 @@ Book (with parts), "section" at level 3
579
580
  <xsl:when test="$normalized-level=3">subsection</xsl:when>
580
581
  <xsl:when test="$normalized-level=4">subsubsection</xsl:when>
581
582
  <xsl:otherwise>
582
- <xsl:message>PTX:ERROR: Level computation is out-of-bounds (input as <xsl:value-of select="$level" />, normalized to <xsl:value-of select="$normalized-level" />)</xsl:message>
583
+ <xsl:message>PTX:BUG: Level computation is out-of-bounds (input as <xsl:value-of select="$level" />, normalized to <xsl:value-of select="$normalized-level" />)</xsl:message>
583
584
  </xsl:otherwise>
584
585
  </xsl:choose>
585
586
  </xsl:template>
@@ -719,7 +720,7 @@ Book (with parts), "section" at level 3
719
720
  <!-- check for bare # (present but \# is not) -->
720
721
  <xsl:if test="contains($inside, '#') and not(contains($inside, '\#'))">
721
722
  <xsl:message>
722
- <xsl:text>PTX:WARNING: a bare "#" inside \text{} in math must be escaped as "\#"</xsl:text>
723
+ <xsl:text>PTX:ERROR: a bare "#" inside \text{} in math must be escaped as "\#"</xsl:text>
723
724
  <xsl:text>&#xa;</xsl:text>
724
725
  <xsl:text> </xsl:text>
725
726
  <xsl:apply-templates select="." mode="location-report"/>
@@ -728,7 +729,7 @@ Book (with parts), "section" at level 3
728
729
  <!-- check for bare % -->
729
730
  <xsl:if test="contains($inside, '%') and not(contains($inside, '\%'))">
730
731
  <xsl:message>
731
- <xsl:text>PTX:WARNING: a bare "%" inside \text{} in math must be escaped as "\%"</xsl:text>
732
+ <xsl:text>PTX:ERROR: a bare "%" inside \text{} in math must be escaped as "\%"</xsl:text>
732
733
  <xsl:text>&#xa;</xsl:text>
733
734
  <xsl:text> </xsl:text>
734
735
  <xsl:apply-templates select="." mode="location-report"/>
@@ -737,7 +738,7 @@ Book (with parts), "section" at level 3
737
738
  <!-- check for bare & -->
738
739
  <xsl:if test="contains($inside, '&amp;') and not(contains($inside, '\&amp;'))">
739
740
  <xsl:message>
740
- <xsl:text>PTX:WARNING: a bare "&amp;" inside \text{} in math must be escaped as "\&amp;"</xsl:text>
741
+ <xsl:text>PTX:ERROR: a bare "&amp;" inside \text{} in math must be escaped as "\&amp;"</xsl:text>
741
742
  <xsl:text>&#xa;</xsl:text>
742
743
  <xsl:text> </xsl:text>
743
744
  <xsl:apply-templates select="." mode="location-report"/>
@@ -1489,9 +1490,15 @@ Book (with parts), "section" at level 3
1489
1490
  <xsl:if test="$rows &gt; 1 or $cols &gt; 1">
1490
1491
  <xsl:text> (</xsl:text>
1491
1492
  <xsl:value-of select="$rows"/>
1492
- <xsl:call-template name="nbsp-character"/>
1493
- <xsl:call-template name="times-character"/>
1494
- <xsl:call-template name="nbsp-character"/>
1493
+ <xsl:call-template name="character">
1494
+ <xsl:with-param name="name" select="'nbsp'"/>
1495
+ </xsl:call-template>
1496
+ <xsl:call-template name="character">
1497
+ <xsl:with-param name="name" select="'times'"/>
1498
+ </xsl:call-template>
1499
+ <xsl:call-template name="character">
1500
+ <xsl:with-param name="name" select="'nbsp'"/>
1501
+ </xsl:call-template>
1495
1502
  <xsl:value-of select="$cols"/>
1496
1503
  <xsl:text> </xsl:text>
1497
1504
  <xsl:apply-templates select="." mode="type-name">
@@ -2012,7 +2019,7 @@ Book (with parts), "section" at level 3
2012
2019
  <xsl:if test="$wsdebug and not($text-processed = $middle-cleaned)">
2013
2020
  <!-- DEBUGGING follows, maybe move outward later -->
2014
2021
  <xsl:message>
2015
- <xsl:text>****&#xa;</xsl:text>
2022
+ <xsl:text>PTX:DEBUG: whitespace diagnostic&#xa;</xsl:text>
2016
2023
  <xsl:text>O:</xsl:text>
2017
2024
  <xsl:value-of select="." />
2018
2025
  <xsl:text>:O&#xa;</xsl:text>
@@ -2267,6 +2274,13 @@ Book (with parts), "section" at level 3
2267
2274
  <!-- Realization: usual presentation, within the enclosing chunk -->
2268
2275
 
2269
2276
 
2277
+ <!-- A conversion opts in to "division companion" chunks: the four -->
2278
+ <!-- elements of &DIVISION-COMPANION; earn their own page (chunk) -->
2279
+ <!-- exactly when their parent division is realized as a summary -->
2280
+ <!-- (intermediate) page. The HTML conversion opts in; conversions -->
2281
+ <!-- with their own chunking (WeBWorK sets, Sage doctest) do not. -->
2282
+ <xsl:variable name="b-division-companion-chunks" select="false()"/>
2283
+
2270
2284
  <!-- An intermediate node is at lesser level -->
2271
2285
  <!-- than chunk-level and is not a leaf -->
2272
2286
  <xsl:template match="*" mode="is-intermediate">
@@ -2317,6 +2331,22 @@ Book (with parts), "section" at level 3
2317
2331
  </xsl:choose>
2318
2332
  </xsl:template>
2319
2333
 
2334
+ <!-- A division companion is a chunk exactly when its parent -->
2335
+ <!-- is a summary (intermediate) page, and the conversion -->
2336
+ <!-- has opted in. It is never an intermediate node itself -->
2337
+ <!-- (the generic template answers correctly), and it is -->
2338
+ <!-- inline content of its parent's page in every other case -->
2339
+ <xsl:template match="&DIVISION-COMPANION;" mode="is-chunk">
2340
+ <xsl:choose>
2341
+ <xsl:when test="$b-division-companion-chunks">
2342
+ <xsl:apply-templates select="parent::*" mode="is-intermediate"/>
2343
+ </xsl:when>
2344
+ <xsl:otherwise>
2345
+ <xsl:value-of select="false()"/>
2346
+ </xsl:otherwise>
2347
+ </xsl:choose>
2348
+ </xsl:template>
2349
+
2320
2350
  <!-- #################################### -->
2321
2351
  <!-- Abstract Chunking of Structural Nodes-->
2322
2352
  <!-- #################################### -->
@@ -2363,11 +2393,23 @@ Book (with parts), "section" at level 3
2363
2393
  </xsl:when>
2364
2394
  <xsl:otherwise>
2365
2395
  <xsl:apply-templates select="." mode="intermediate" />
2366
- <xsl:apply-templates select="&STRUCTURAL;" mode="chunking" />
2396
+ <xsl:apply-templates select="&STRUCTURAL;|&DIVISION-COMPANION;" mode="chunking" />
2367
2397
  </xsl:otherwise>
2368
2398
  </xsl:choose>
2369
2399
  </xsl:template>
2370
2400
 
2401
+ <!-- A division companion produces a page (chunk) or nothing: -->
2402
+ <!-- it is only visited via the recursion above, so a parent -->
2403
+ <!-- summary page is guaranteed, but the opt-in may be off -->
2404
+ <xsl:template match="&DIVISION-COMPANION;" mode="chunking">
2405
+ <xsl:variable name="chunk">
2406
+ <xsl:apply-templates select="." mode="is-chunk" />
2407
+ </xsl:variable>
2408
+ <xsl:if test="$chunk = 'true'">
2409
+ <xsl:apply-templates select="." mode="chunk" />
2410
+ </xsl:if>
2411
+ </xsl:template>
2412
+
2371
2413
  <!-- docinfo, and anything else, is immune and dead-ends -->
2372
2414
  <xsl:template match="*" mode="chunking" />
2373
2415
 
@@ -2384,7 +2426,7 @@ Book (with parts), "section" at level 3
2384
2426
  <!-- parameter holding the contents of the body of the page -->
2385
2427
 
2386
2428
  <!-- A complete file/page for a structural division -->
2387
- <xsl:template match="&STRUCTURAL;" mode="chunk">
2429
+ <xsl:template match="&STRUCTURAL;|&DIVISION-COMPANION;" mode="chunk">
2388
2430
  <xsl:apply-templates select="." mode="file-wrap">
2389
2431
  <xsl:with-param name="content">
2390
2432
  <xsl:apply-templates select="." />
@@ -2430,7 +2472,7 @@ Book (with parts), "section" at level 3
2430
2472
  </xsl:variable>
2431
2473
  <xsl:choose>
2432
2474
  <xsl:when test="$intermediate='true' or $chunk='true'">
2433
- <xsl:apply-templates select="." mode="visible-id" />
2475
+ <xsl:apply-templates select="." mode="unique-id" />
2434
2476
  <xsl:value-of select="$file-extension" />
2435
2477
  </xsl:when>
2436
2478
  <!-- Halts since "mathbook" element will be chunk (or earlier) -->
@@ -2442,7 +2484,7 @@ Book (with parts), "section" at level 3
2442
2484
 
2443
2485
  <!-- Context URL -->
2444
2486
  <!-- URL for an element on its containing HTML page. -->
2445
- <!-- Produces: baseurl + containing-filename + "#" + visible-id -->
2487
+ <!-- Produces: baseurl + containing-filename + "#" + unique-id -->
2446
2488
  <!-- Empty when no baseurl is configured. -->
2447
2489
  <!-- NB: requires $chunk-level and $file-extension to be set -->
2448
2490
  <!-- correctly for HTML output (as in extract-qrcode.xsl). -->
@@ -2451,7 +2493,7 @@ Book (with parts), "section" at level 3
2451
2493
  <xsl:value-of select="$baseurl"/>
2452
2494
  <xsl:apply-templates select="." mode="containing-filename"/>
2453
2495
  <xsl:text>#</xsl:text>
2454
- <xsl:apply-templates select="." mode="visible-id"/>
2496
+ <xsl:apply-templates select="." mode="unique-id"/>
2455
2497
  </xsl:if>
2456
2498
  </xsl:template>
2457
2499
 
@@ -2886,7 +2928,7 @@ Book (with parts), "section" at level 3
2886
2928
  <xsl:variable name="normalized-width" select="normalize-space($raw-width)" />
2887
2929
  <xsl:choose>
2888
2930
  <xsl:when test="not(substring($normalized-width, string-length($normalized-width)) = '%')">
2889
- <xsl:message>PTX:WARNING: a "width" attribute should be given as a percentage (such as "40%", not as "<xsl:value-of select="$normalized-width" />, using 100% instead"</xsl:message>
2931
+ <xsl:message>PTX:FALLBACK: a "width" attribute should be given as a percentage (such as "40%", not as "<xsl:value-of select="$normalized-width" />, using 100% instead"</xsl:message>
2890
2932
  <xsl:apply-templates select="." mode="location-report" />
2891
2933
  <!-- replace by 100% -->
2892
2934
  <xsl:text>100%</xsl:text>
@@ -2981,7 +3023,7 @@ Book (with parts), "section" at level 3
2981
3023
  <!-- NaN does not equal *anything*, so tests if a number -->
2982
3024
  <!-- http://stackoverflow.com/questions/6895870 -->
2983
3025
  <xsl:when test="not(number($the-aspect) = number($the-aspect)) or ($the-aspect &lt; 0)">
2984
- <xsl:message>PTX:WARNING: the @aspect attribute should be a ratio, like 4:3, or a positive number, not "<xsl:value-of select="$the-aspect" />"</xsl:message>
3026
+ <xsl:message>PTX:ERROR: the @aspect attribute should be a ratio, like 4:3, or a positive number, not "<xsl:value-of select="$the-aspect" />"</xsl:message>
2985
3027
  <xsl:apply-templates select="." mode="location-report" />
2986
3028
  </xsl:when>
2987
3029
  <!-- survives as a number -->
@@ -3157,7 +3199,7 @@ Book (with parts), "section" at level 3
3157
3199
  <xsl:text>[</xsl:text>
3158
3200
  <xsl:value-of select="$str-id" />
3159
3201
  <xsl:text>]</xsl:text>
3160
- <xsl:message>PTX:WARNING: could not translate string with id "<xsl:value-of select="$str-id"/>" into language for code "<xsl:value-of select="$lang"/>"</xsl:message>
3202
+ <xsl:message>PTX:BUG: could not translate string with id "<xsl:value-of select="$str-id"/>" into language for code "<xsl:value-of select="$lang"/>"</xsl:message>
3161
3203
  </xsl:otherwise>
3162
3204
  </xsl:choose>
3163
3205
  </xsl:template>
@@ -3254,7 +3296,7 @@ Book (with parts), "section" at level 3
3254
3296
  <!-- At any given point in processing, we may want -->
3255
3297
  <!-- to know which language is in effect. We look -->
3256
3298
  <!-- up the tree for the "closest" indication of a -->
3257
- <!-- language for localization. The @locale-lang -->
3299
+ <!-- language for localization. The @pi:locale-lang -->
3258
3300
  <!-- attribute is set by the -assembly stylesheet, -->
3259
3301
  <!-- and guarantees the language is supported by an -->
3260
3302
  <!-- extant localization file. Result is a -->
@@ -3267,7 +3309,7 @@ Book (with parts), "section" at level 3
3267
3309
  <!-- $localizations/locale[@language = $lang] -->
3268
3310
 
3269
3311
  <xsl:template match="*" mode="ambient-language">
3270
- <xsl:value-of select="ancestor-or-self::*[@locale-lang][1]/@locale-lang"/>
3312
+ <xsl:value-of select="ancestor-or-self::*[@pi:locale-lang][1]/@pi:locale-lang"/>
3271
3313
  </xsl:template>
3272
3314
 
3273
3315
  <!-- Language direction -->
@@ -3669,24 +3711,16 @@ Book (with parts), "section" at level 3
3669
3711
  <!-- Identifiers and Labels -->
3670
3712
  <!-- ###################### -->
3671
3713
 
3672
- <!-- Identifiers are in flux, as of 2023-03-30. The "unique-id" is -->
3673
- <!-- an attribute built during the descent of the tree during the -->
3674
- <!-- pre-processor/assembly phase. As such, it is fast and ugly. -->
3675
- <!-- Do not let a reader catch sight of it in output ever, beacuase it -->
3676
- <!-- is ugly, and because it is not really permanant. That is what -->
3677
- <!-- "visible-id" is for. But constructing "visible-id" is very slow -->
3678
- <!-- (we hope to speed htat up as well). So we are transitioning to -->
3679
- <!-- the "unique-id" wherever possible, but with careful testing. -->
3714
+ <!-- The "unique-id" is an attribute built during the descent of the -->
3715
+ <!-- tree in the assembly phase, so it is fast to construct and fast -->
3716
+ <!-- to read back. It appears in filenames and URLs when an author -->
3717
+ <!-- has not provided a stable name (an authored "@label" is always -->
3718
+ <!-- preferred for anything a reader manages or shares), and it is -->
3719
+ <!-- not permanent: editing a document can renumber it. A former -->
3720
+ <!-- "visible-id" getter, once a slow reader-facing construction, -->
3721
+ <!-- became an alias of this one and was then retired. -->
3680
3722
  <xsl:template match="*" mode="unique-id">
3681
- <xsl:value-of select="@unique-id"/>
3682
- </xsl:template>
3683
-
3684
- <!-- These strings are used for items an author must manage -->
3685
- <!-- (image files) or that a reader will interact with (shared URLs) -->
3686
- <!-- Since items like filenames and URLs are sometimes shared across -->
3687
- <!-- conversions (or extractions) this template is in -common -->
3688
- <xsl:template match="*" mode="visible-id">
3689
- <xsl:value-of select="@unique-id"/>
3723
+ <xsl:value-of select="@pi:unique-id"/>
3690
3724
  </xsl:template>
3691
3725
 
3692
3726
  <!-- An image described by source code, using languages Asymptote, -->
@@ -3706,7 +3740,7 @@ Book (with parts), "section" at level 3
3706
3740
  <!-- @xml:id value was used to form the filename of an image described -->
3707
3741
  <!-- by source code (or a default was provided, like image-37). -->
3708
3742
  <xsl:when test="parent::image">
3709
- <xsl:apply-templates select="parent::image" mode="visible-id"/>
3743
+ <xsl:apply-templates select="parent::image" mode="unique-id"/>
3710
3744
  </xsl:when>
3711
3745
  <!-- Well-formed PTX source means we never reach the "otherwise" -->
3712
3746
  <xsl:otherwise>
@@ -3721,8 +3755,8 @@ Book (with parts), "section" at level 3
3721
3755
  <xsl:template match="pf:prefigure" mode="image-source-basename">
3722
3756
  <xsl:choose>
3723
3757
  <!-- Determine if @label is authored or generated for backwrd compatibility -->
3724
- <xsl:when test="not(@authored-label)">
3725
- <xsl:apply-templates select="." mode="visible-id"/>
3758
+ <xsl:when test="not(@pi:authored-label)">
3759
+ <xsl:apply-templates select="." mode="unique-id"/>
3726
3760
  <xsl:message>PTX:WARNING: you are encouraged to place a @label attribute on every "prefigure" element. Otherwise, associated image files will have unreliable filenames.</xsl:message>
3727
3761
  </xsl:when>
3728
3762
  <!-- this @label is now guaranteed to be authored -->
@@ -3745,21 +3779,23 @@ Book (with parts), "section" at level 3
3745
3779
  <!-- from an author, which we will dress up here. Notice that this can -->
3746
3780
  <!-- change when an author declares a new edition. -->
3747
3781
  <xsl:template match="exercise|program|datafile|query|&PROJECT-LIKE;|task|video[@youtube]|exercises|worksheet|interactive[@platform = 'doenetml']|interactive[@iframe]" mode="runestone-id">
3748
- <!-- With no @xml:id and no @label we realize the author has not given -->
3749
- <!-- any thought to a (semi-)peersistent identifire for the Runestone -->
3750
- <!-- database. So we call that out as an error. And we do not even -->
3751
- <!-- attempt to fallback to an automatically generated string, which -->
3752
- <!-- would be malleable over time and editing. -->
3753
- <!-- As part of backwards-compatibility, we copy old @xml:id values into -->
3754
- <!-- fresh @label. But have an internal @authored-label attribute whose -->
3755
- <!-- absence alerts us to the copying, which is now not best practice. -->
3782
+ <!-- With no @xml:id and no @label we realize the author has not given -->
3783
+ <!-- any thought to a (semi-)peersistent identifire for the Runestone -->
3784
+ <!-- database. So we call that out as an error. And we do not even -->
3785
+ <!-- attempt to fallback to an automatically generated string, which -->
3786
+ <!-- would be malleable over time and editing. -->
3787
+ <!-- As part of backwards-compatibility, we copy old @xml:id values into -->
3788
+ <!-- fresh @label. But have an internal @pi:authored-label attribute whose -->
3789
+ <!-- absence alerts us to the copying, which is now not best practice. -->
3790
+ <!-- These messages were disabled 2024-02-20 as unreliable. The cause -->
3791
+ <!-- was a pointer to another component resolving against the authored -->
3792
+ <!-- source, where the @pi:authored-label stamp does not exist; that is -->
3793
+ <!-- repaired, so the messages return. A plain static code listing is -->
3794
+ <!-- the one element reaching here that legitimately has no database -->
3795
+ <!-- identity and needs none, so it is exempt. -->
3756
3796
  <xsl:choose>
3757
- <!-- 2024-02-20: neuter thse warnings. Somehow, it seems @authored-label -->
3758
- <!-- is not very reliable. Were added in commit 29a42dc689cd772a -->
3759
- <!-- -->
3760
- <xsl:when test="true()"/>
3761
- <!-- -->
3762
- <xsl:when test="$b-host-runestone and not(@xml:id) and not(@authored-label)">
3797
+ <xsl:when test="self::program and not(@interactive = 'activecode' or @interactive = 'codelens')"/>
3798
+ <xsl:when test="$b-host-runestone and not(@xml:id) and not(@pi:authored-label)">
3763
3799
  <xsl:message>
3764
3800
  <xsl:text>PTX:ERROR: While building for a Runestone server, a PreTeXt "</xsl:text>
3765
3801
  <xsl:value-of select="local-name(.)"/>
@@ -3773,9 +3809,9 @@ Book (with parts), "section" at level 3
3773
3809
  </xsl:message>
3774
3810
  <xsl:apply-templates select="." mode="location-report"/>
3775
3811
  </xsl:when>
3776
- <xsl:when test="$b-host-runestone and not(@authored-label)">
3812
+ <xsl:when test="$b-host-runestone and not(@pi:authored-label)">
3777
3813
  <xsl:message>
3778
- <xsl:text>PTX:WARNING: While building for a Runestone server, a PreTeXt "</xsl:text>
3814
+ <xsl:text>PTX:FALLBACK: While building for a Runestone server, a PreTeXt "</xsl:text>
3779
3815
  <xsl:value-of select="local-name(.)"/>
3780
3816
  <xsl:text>" element&#xa;</xsl:text>
3781
3817
  <xsl:text>has been encountered without a @label attribute. For reasons of backward-compatibility &#xa;</xsl:text>
@@ -3835,7 +3871,7 @@ Book (with parts), "section" at level 3
3835
3871
  </xsl:template>
3836
3872
 
3837
3873
  <!-- Need a unique filename for codelens traces -->
3838
- <!-- visible-id can change if an xml:id is added to program for other reasons -->
3874
+ <!-- unique-id can change if an xml:id is added to program for other reasons -->
3839
3875
  <!-- Can't vary with build target (so no runestone-id) -->
3840
3876
  <!-- Should generally mirror rs-id but without prefix -->
3841
3877
  <xsl:template match="program[@interactive = 'codelens']" mode="runestone-codelens-trace-filename">
@@ -3843,10 +3879,10 @@ Book (with parts), "section" at level 3
3843
3879
  <!-- If part of exercise-like, use that label, otherwise own -->
3844
3880
  <!-- This is an implicit use of &PROJECT-LIKE; and should be kept in sync -->
3845
3881
  <xsl:when test="parent::exercise|parent::task|parent::project|parent::activity|parent::exploration|parent::investigation">
3846
- <xsl:value-of select="../@unique-id"/>
3882
+ <xsl:value-of select="../@pi:unique-id"/>
3847
3883
  </xsl:when>
3848
3884
  <xsl:otherwise>
3849
- <xsl:value-of select="@unique-id"/>
3885
+ <xsl:value-of select="@pi:unique-id"/>
3850
3886
  </xsl:otherwise>
3851
3887
  </xsl:choose>
3852
3888
  <xsl:text>.js</xsl:text>
@@ -3920,7 +3956,7 @@ Book (with parts), "section" at level 3
3920
3956
  <!-- or is defined to be a null string in a particular conversion stylesheet, in which -->
3921
3957
  <!-- case no extra space is added. -->
3922
3958
  <xsl:template name="case-cycle-delimiter-space">
3923
- <xsl:message>PTX:BUG A "case" has "direction" equal to "cycle", but the conversion for this output target does not have a "delimiter space" symbol defined. The maintainer for this output target may wish to know about this (or may wish to set the "delimiter space" symbol to be a null string to suppress this warning message).</xsl:message>
3959
+ <xsl:message>PTX:BUG: A "case" has "direction" equal to "cycle", but the conversion for this output target does not have a "delimiter space" symbol defined. The maintainer for this output target may wish to know about this (or may wish to set the "delimiter space" symbol to be a null string to suppress this warning message).</xsl:message>
3924
3960
  <xsl:apply-templates select="." mode="location-report"/>
3925
3961
  </xsl:template>
3926
3962
 
@@ -3929,8 +3965,8 @@ Book (with parts), "section" at level 3
3929
3965
  <xsl:param name="to" />
3930
3966
  <xsl:variable name="format-code">
3931
3967
  <xsl:choose>
3932
- <xsl:when test="self::node()[@format-code]">
3933
- <xsl:value-of select="./@format-code" />
3968
+ <xsl:when test="self::node()[@pi:format-code]">
3969
+ <xsl:value-of select="./@pi:format-code" />
3934
3970
  </xsl:when>
3935
3971
  <xsl:otherwise>1</xsl:otherwise>
3936
3972
  </xsl:choose>
@@ -3947,7 +3983,7 @@ Book (with parts), "section" at level 3
3947
3983
  <xsl:otherwise><xsl:value-of select="$to" /></xsl:otherwise>
3948
3984
  </xsl:choose>
3949
3985
  </xsl:variable>
3950
- <xsl:variable name="original-marker-suffix" select="./@marker-suffix" />
3986
+ <xsl:variable name="original-marker-suffix" select="./@pi:marker-suffix" />
3951
3987
  <xsl:variable name="marker-suffix">
3952
3988
  <xsl:choose>
3953
3989
  <!-- Strip out any trailing dot from the marker format. -->
@@ -3961,12 +3997,12 @@ Book (with parts), "section" at level 3
3961
3997
  </xsl:variable>
3962
3998
  <xsl:call-template name="formatted-case-cycle">
3963
3999
  <xsl:with-param name="from">
3964
- <xsl:value-of select="./@marker-prefix" />
4000
+ <xsl:value-of select="./@pi:marker-prefix" />
3965
4001
  <xsl:number value="$adjusted-from" format="{$format-code}" />
3966
4002
  <xsl:value-of select="$marker-suffix" />
3967
4003
  </xsl:with-param>
3968
4004
  <xsl:with-param name="to">
3969
- <xsl:value-of select="./@marker-prefix" />
4005
+ <xsl:value-of select="./@pi:marker-prefix" />
3970
4006
  <xsl:number value="$adjusted-to" format="{$format-code}" />
3971
4007
  <xsl:value-of select="$marker-suffix" />
3972
4008
  </xsl:with-param>
@@ -4306,7 +4342,7 @@ Book (with parts), "section" at level 3
4306
4342
  <xsl:if test="$normalized-aspect = 0">
4307
4343
  <xsl:message>PTX:FATAL: an @aspect attribute equal to zero will cause serious errors.</xsl:message>
4308
4344
  <xsl:apply-templates select="." mode="location-report" />
4309
- <xsl:message terminate="yes">Quitting...</xsl:message>
4345
+ <xsl:message terminate="yes">PTX:FATAL: Quitting...</xsl:message>
4310
4346
  </xsl:if>
4311
4347
 
4312
4348
  <!-- Perhaps save for debugging -->
@@ -4488,7 +4524,7 @@ Book (with parts), "section" at level 3
4488
4524
  <!-- count the elements destined for panels -->
4489
4525
  <xsl:variable name="number-panels" select="count(*)" />
4490
4526
  <xsl:if test="$sbsdebug">
4491
- <xsl:message>N:<xsl:value-of select="$number-panels" />:N</xsl:message>
4527
+ <xsl:message>PTX:DEBUG: N:<xsl:value-of select="$number-panels" />:N</xsl:message>
4492
4528
  </xsl:if>
4493
4529
  <!-- Add to RTF -->
4494
4530
  <number-panels>
@@ -4534,7 +4570,7 @@ Book (with parts), "section" at level 3
4534
4570
  </xsl:choose>
4535
4571
  </xsl:variable>
4536
4572
  <xsl:if test="$sbsdebug">
4537
- <xsl:message>VA:<xsl:value-of select="$valigns" />:VA</xsl:message>
4573
+ <xsl:message>PTX:DEBUG: VA:<xsl:value-of select="$valigns" />:VA</xsl:message>
4538
4574
  </xsl:if>
4539
4575
  <!-- check length (author-supplied could be wrong) -->
4540
4576
  <xsl:variable name="nspaces-valigns" select="string-length($valigns) - string-length(translate($valigns, ' ', ''))" />
@@ -4542,7 +4578,7 @@ Book (with parts), "section" at level 3
4542
4578
  <xsl:when test="$nspaces-valigns &lt; $number-panels">
4543
4579
  <xsl:message>PTX:FATAL: a &lt;sidebyside&gt; or &lt;sbsgroup&gt; does not have enough "@valigns" (maybe you did not specify enough?)</xsl:message>
4544
4580
  <xsl:apply-templates select="." mode="location-report" />
4545
- <xsl:message terminate="yes"> That's fatal. Sorry. Quitting...</xsl:message>
4581
+ <xsl:message terminate="yes">PTX:FATAL: Quitting...</xsl:message>
4546
4582
  </xsl:when>
4547
4583
  <xsl:when test="$nspaces-valigns &gt; $number-panels">
4548
4584
  <xsl:message>PTX:WARNING: a &lt;sidebyside&gt; or &lt;sbsgroup&gt; has extra "@valigns" (did you confuse singular and plural attribute names?)</xsl:message>
@@ -4694,7 +4730,7 @@ Book (with parts), "section" at level 3
4694
4730
  </xsl:choose>
4695
4731
  </xsl:variable>
4696
4732
  <xsl:if test="$sbsdebug">
4697
- <xsl:message>M:<xsl:value-of select="$left-margin" />:<xsl:value-of select="$right-margin" />:M</xsl:message>
4733
+ <xsl:message>PTX:DEBUG: M:<xsl:value-of select="$left-margin" />:<xsl:value-of select="$right-margin" />:M</xsl:message>
4698
4734
  </xsl:if>
4699
4735
  <!-- error check for reasonable values -->
4700
4736
  <!-- When there are three values, the "left" margin still -->
@@ -4739,7 +4775,7 @@ Book (with parts), "section" at level 3
4739
4775
  </xsl:choose>
4740
4776
  </xsl:variable>
4741
4777
  <xsl:if test="$sbsdebug">
4742
- <xsl:message>W:<xsl:value-of select="$widths" />:W</xsl:message>
4778
+ <xsl:message>PTX:DEBUG: W:<xsl:value-of select="$widths" />:W</xsl:message>
4743
4779
  </xsl:if>
4744
4780
  <!-- check length (author-supplied could be wrong) -->
4745
4781
  <xsl:variable name="nspaces-widths" select="string-length($widths) - string-length(translate($widths, ' ', ''))" />
@@ -4747,7 +4783,7 @@ Book (with parts), "section" at level 3
4747
4783
  <xsl:when test="$nspaces-widths &lt; $number-panels">
4748
4784
  <xsl:message>PTX:FATAL: a &lt;sidebyside&gt; or &lt;sbsgroup&gt; does not have enough "@widths" (maybe you did not specify enough?)</xsl:message>
4749
4785
  <xsl:apply-templates select="." mode="location-report" />
4750
- <xsl:message terminate="yes"> That's fatal. Sorry. Quitting...</xsl:message>
4786
+ <xsl:message terminate="yes">PTX:FATAL: Quitting...</xsl:message>
4751
4787
  </xsl:when>
4752
4788
  <xsl:when test="$nspaces-widths &gt; $number-panels">
4753
4789
  <xsl:message>PTX:WARNING: a &lt;sidebyside&gt; or &lt;sbsgroup&gt; has extra "@widths" (did you confuse singular and plural attribute names?)</xsl:message>
@@ -4778,7 +4814,7 @@ Book (with parts), "section" at level 3
4778
4814
  <xsl:text>%</xsl:text>
4779
4815
  </xsl:variable>
4780
4816
  <xsl:if test="$sbsdebug">
4781
- <xsl:message>SW:<xsl:value-of select="$space-width" />:SW</xsl:message>
4817
+ <xsl:message>PTX:DEBUG: SW:<xsl:value-of select="$space-width" />:SW</xsl:message>
4782
4818
  </xsl:if>
4783
4819
  <!-- overall error check on space width -->
4784
4820
  <xsl:choose>
@@ -4871,6 +4907,32 @@ Book (with parts), "section" at level 3
4871
4907
  <!-- SideBySide Main Template -->
4872
4908
  <!-- ######################## -->
4873
4909
 
4910
+ <!-- Panels are converted first, each through the modal -->
4911
+ <!-- "panel-panel" template, and the results accumulate into a -->
4912
+ <!-- single result-tree fragment. That fragment, plus the computed -->
4913
+ <!-- layout, goes to the modal "compose-panels" template, which can -->
4914
+ <!-- wrap the finished panels but cannot place structure between -->
4915
+ <!-- them. The "panel-panel" parameters are the union of what the -->
4916
+ <!-- implementations need, so any one implementation may ignore -->
4917
+ <!-- some of them. This two-phase contract fits a conversion whose -->
4918
+ <!-- target expresses the entire layout declaratively on a -->
4919
+ <!-- container: HTML (CSS grid on a wrapping div; EPUB and Jupyter -->
4920
+ <!-- inherit), LaTeX (arguments of the "sidebyside" environment; -->
4921
+ <!-- Beamer and the solution manual inherit), and Reveal.js (CSS -->
4922
+ <!-- table display). A target that must interleave structure among -->
4923
+ <!-- the panels (XSL-FO: margin and gap table cells) or that has no -->
4924
+ <!-- horizontal layout at all (text, and Markdown by import; -->
4925
+ <!-- braille) instead overrides this template entirely and reuses -->
4926
+ <!-- the "layout-parameters" computation where meaningful; each -->
4927
+ <!-- such stylesheet documents its reasons. The panel vocabulary -->
4928
+ <!-- is context-dependent beyond what the schema expresses: an -->
4929
+ <!-- "exercise" panel only within a "worksheet" or "handout", a -->
4930
+ <!-- "slate" panel only within an "interactive", and never an -->
4931
+ <!-- "audio", "video", or "interactive", whose static -->
4932
+ <!-- representation is itself a manufactured "sidebyside", which -->
4933
+ <!-- must not nest. The validation-plus stylesheet enforces all -->
4934
+ <!-- three restrictions. -->
4935
+
4874
4936
  <xsl:template match="sidebyside">
4875
4937
  <xsl:param name="b-original" select="true()" />
4876
4938
  <xsl:param name="heading-level"/>
@@ -4913,23 +4975,10 @@ Book (with parts), "section" at level 3
4913
4975
  <xsl:message>~~~~~~~~~~~~~~~~~~~~</xsl:message>
4914
4976
  -->
4915
4977
 
4916
- <!-- "paragraphs" deprecated within sidebyside, 2018-05-02 -->
4917
- <!-- jsxgraph deprecated? Check -->
4918
-
4919
- <xsl:variable name="panels" select="p|pre|ol|ul|dl|program|console|poem|audio|video|interactive|slate|exercise|image|figure|table|listing|list|tabular|stack|jsxgraph|paragraphs" />
4978
+ <xsl:variable name="panels" select="&SBSPANEL;" />
4920
4979
 
4921
- <!-- We build up lists of various parts of a panel -->
4922
- <!-- It has setup (LaTeX), headers (titles), panels, -->
4923
- <!-- and captions. These then go to "compose-panels". -->
4924
- <!-- Implementations need to define modal templates -->
4925
- <!-- panel-header, panel-panel, panel-caption -->
4926
- <!-- The parameters passed to each is the union of what -->
4927
- <!-- is needed for LaTeX and HTML implementations. -->
4928
- <!-- Final results are collectively sent to modal -->
4929
- <!-- compose-panels -->
4930
- <!-- template to be arranged -->
4931
- <!-- TODO: Instead we could pass the $layout to the four, -->
4932
- <!-- and infer the $panel-number in the receiving templates. -->
4980
+ <!-- TODO: Instead we could pass the $layout to "panel-panel", -->
4981
+ <!-- and infer the $panel-number in the receiving templates. -->
4933
4982
 
4934
4983
  <xsl:variable name="panel-panels">
4935
4984
  <xsl:for-each select="$panels">
@@ -5004,7 +5053,7 @@ Book (with parts), "section" at level 3
5004
5053
  <xsl:param name="width" />
5005
5054
  <xsl:param name="heading-level"/>
5006
5055
 
5007
- <xsl:apply-templates select="tabular|image|p|pre|ol|ul|dl|audio|video|interactive|slate|program|console|exercise">
5056
+ <xsl:apply-templates select="&STACKABLE;">
5008
5057
  <xsl:with-param name="b-original" select="$b-original" />
5009
5058
  <xsl:with-param name="width" select="$width"/>
5010
5059
  <xsl:with-param name="heading-level" select="$heading-level"/>
@@ -5038,7 +5087,7 @@ Book (with parts), "section" at level 3
5038
5087
  <xsl:template match="li[p|ol|ul|dl]/text()">
5039
5088
  <xsl:variable name="text" select="normalize-space(.)" />
5040
5089
  <xsl:if test="$text">
5041
- <xsl:message>PTX:WARNING: Unstructured content within a list item is being ignored ("<xsl:value-of select="$text" />")</xsl:message>
5090
+ <xsl:message>PTX:ERROR: Unstructured content within a list item is being ignored ("<xsl:value-of select="$text" />")</xsl:message>
5042
5091
  <xsl:apply-templates select=".." mode="location-report" />
5043
5092
  </xsl:if>
5044
5093
  </xsl:template>
@@ -5144,7 +5193,7 @@ Book (with parts), "section" at level 3
5144
5193
  <xsl:when test="@marker='square'">square</xsl:when>
5145
5194
  <xsl:when test="@marker=''">none</xsl:when>
5146
5195
  <xsl:otherwise>
5147
- <xsl:message>ptx:ERROR: unordered list label (<xsl:value-of select="@marker" />) not recognized</xsl:message>
5196
+ <xsl:message>PTX:ERROR: unordered list label (<xsl:value-of select="@marker" />) not recognized</xsl:message>
5148
5197
  </xsl:otherwise>
5149
5198
  </xsl:choose>
5150
5199
  </xsl:when>
@@ -5587,7 +5636,7 @@ Book (with parts), "section" at level 3
5587
5636
  <xsl:when test="substring($raw-workspace, string-length($raw-workspace) - 0) = '%'">
5588
5637
  <xsl:variable name="approximate-inches" select="concat(substring($raw-workspace, 1, string-length($raw-workspace) - 1) div 10, 'in')"/>
5589
5638
  <xsl:value-of select="$approximate-inches"/>
5590
- <xsl:message>PTX:WARNING: as of 2020-03-17 worksheet exercises' workspace should be specified in 'in' or in 'cm'. Approximating a page fraction of <xsl:value-of select="@workspace"/> by <xsl:value-of select="$approximate-inches"/>.</xsl:message>
5639
+ <xsl:message>PTX:FALLBACK: as of 2020-03-17 worksheet exercises' workspace should be specified in 'in' or in 'cm'. Approximating a page fraction of <xsl:value-of select="@workspace"/> by <xsl:value-of select="$approximate-inches"/>.</xsl:message>
5591
5640
  <xsl:apply-templates select="." mode="location-report"/>
5592
5641
  </xsl:when>
5593
5642
  <xsl:when test="substring($raw-workspace, string-length($raw-workspace) - 1) = 'in'">
@@ -5597,7 +5646,7 @@ Book (with parts), "section" at level 3
5597
5646
  <xsl:value-of select="$raw-workspace"/>
5598
5647
  </xsl:when>
5599
5648
  <xsl:otherwise>
5600
- <xsl:message>PTX:WARNING: a worksheet exercises', project-likes' or tasks' workspace should be specified with units of 'in' or 'cm', and not as "<xsl:value-of select="@workspace"/>". Using a default of "2in".</xsl:message>
5649
+ <xsl:message>PTX:FALLBACK: a worksheet exercises', project-likes' or tasks' workspace should be specified with units of 'in' or 'cm', and not as "<xsl:value-of select="@workspace"/>". Using a default of "2in".</xsl:message>
5601
5650
  <xsl:text>2in</xsl:text>
5602
5651
  </xsl:otherwise>
5603
5652
  </xsl:choose>
@@ -5620,7 +5669,7 @@ Book (with parts), "section" at level 3
5620
5669
  <xsl:choose>
5621
5670
  <xsl:when test="self::task">project</xsl:when>
5622
5671
  <xsl:otherwise>
5623
- <xsl:value-of select="./@exercise-customization"/>
5672
+ <xsl:value-of select="./@pi:exercise-customization"/>
5624
5673
  </xsl:otherwise>
5625
5674
  </xsl:choose>
5626
5675
  </xsl:variable>
@@ -5641,7 +5690,7 @@ Book (with parts), "section" at level 3
5641
5690
  <exercise-component-report has-hint="{$b-has-reading-hint}" has-answer="{$b-has-reading-answer}" has-solution="{$b-has-reading-solution}"/>
5642
5691
  </xsl:when>
5643
5692
  <xsl:otherwise>
5644
- <xsl:message>PTX:ERROR: can't determine exercise type</xsl:message>
5693
+ <xsl:message>PTX:BUG: can't determine exercise type</xsl:message>
5645
5694
  <xsl:apply-templates select="." mode="location-report" />
5646
5695
  </xsl:otherwise>
5647
5696
  </xsl:choose>
@@ -5710,7 +5759,7 @@ Book (with parts), "section" at level 3
5710
5759
  <!-- template -->
5711
5760
  <xsl:variable name="scope" select="id(@scope)"/>
5712
5761
  <xsl:if test="not($scope)">
5713
- <xsl:message>PTX:WARNING: unresolved @scope ("<xsl:value-of select="@scope"/>") for a &lt;solutions&gt; division</xsl:message>
5762
+ <xsl:message>PTX:ERROR: unresolved @scope ("<xsl:value-of select="@scope"/>") for a &lt;solutions&gt; division</xsl:message>
5714
5763
  <xsl:apply-templates select="." mode="location-report" />
5715
5764
  </xsl:if>
5716
5765
  <xsl:if test="not($scope/self::book|$scope/self::article|$scope/self::chapter|$scope/self::section|$scope/self::subsection|$scope/self::subsubsection|$scope/self::exercises|$scope/self::worksheet|$scope/self::reading-questions)">
@@ -6361,7 +6410,7 @@ Book (with parts), "section" at level 3
6361
6410
  <!-- Printout Margins -->
6362
6411
  <!-- ################ -->
6363
6412
 
6364
- <xsl:template match="worksheet|handout" mode="printout-margin">
6413
+ <xsl:template match="&PRINTOUT;" mode="printout-margin">
6365
6414
  <xsl:param name="author-side"/>
6366
6415
  <xsl:param name="publisher-side"/>
6367
6416
  <xsl:choose>
@@ -7283,12 +7332,9 @@ Book (with parts), "section" at level 3
7283
7332
 
7284
7333
 
7285
7334
  <!-- Programming Language Names -->
7286
- <!-- Packages for listing and syntax highlighting -->
7287
- <!-- have their own ideas about the names of languages -->
7288
- <!-- We use keys to perform the translation -->
7289
- <!-- See: https://gist.github.com/frabad/4189876 -->
7290
- <!-- for motivation and document() syntax for standalone file -->
7291
- <!-- Also: see contributors in FCLA work -->
7335
+ <!-- Packages for listing and syntax highlighting -->
7336
+ <!-- have their own ideas about the names of languages -->
7337
+ <!-- We use keys to perform the translation -->
7292
7338
 
7293
7339
  <!-- The data: attribute is our usage, elements belong to -->
7294
7340
  <!-- other packages. Blank means not explicitly supported. -->
@@ -7311,64 +7357,63 @@ Book (with parts), "section" at level 3
7311
7357
  <!-- additional popular packages (e.g. numpy, pandas) -->
7312
7358
  <!-- are available. -->
7313
7359
 
7314
- <!-- Our strings (@ptx) are always all-lowercase, no symbols, no punctuation -->
7315
- <mb:programming>
7360
+ <!-- Our strings (@name) are always all-lowercase, no symbols, no punctuation -->
7361
+ <xsl:variable name="programming-language-rtf">
7316
7362
  <!-- Procedural -->
7317
- <language ptx="basic" active="" listings="Basic" prism="basic"/>
7318
- <language ptx="c" active="c" listings="C" prism="c"/>
7319
- <language ptx="cpp" active="cpp" listings="C++" prism="cpp"/>
7320
- <language ptx="go" active="" listings="C" prism="go"/>
7321
- <language ptx="java" active="java" listings="Java" prism="java"/>
7322
- <language ptx="javascript" active="javascript" listings="" prism="javascript"/>
7323
- <language ptx="kotlin" active="kotlin" listings="" prism="kotlin"/>
7324
- <language ptx="lua" active="" listings="Lua" prism="lua"/>
7325
- <language ptx="pascal" active="" listings="Pascal" prism="pascal"/>
7326
- <language ptx="perl" active="" listings="Perl" prism="perl"/>
7327
- <language ptx="python" active="python" listings="Python" prism="py"/>
7328
- <language ptx="python3" active="python3" listings="Python" prism="py"/>
7329
- <language ptx="r" active="" listings="R" prism="r"/>
7330
- <language ptx="s" active="" listings="S" prism="s"/>
7331
- <language ptx="sas" active="" listings="SAS" prism="s"/>
7332
- <language ptx="sage" active="" listings="Python" prism="py"/>
7333
- <language ptx="splus" active="" listings="[Plus]S" prism="s"/>
7334
- <language ptx="vbasic" active="" listings="[Visual]Basic" prism="visual-basic"/>
7335
- <language ptx="vbscript" active="" listings="VBscript" prism="visual-basic"/>
7363
+ <language name="basic" active="" listings="Basic" prism="basic"/>
7364
+ <language name="c" active="c" listings="C" prism="c"/>
7365
+ <language name="cpp" active="cpp" listings="C++" prism="cpp"/>
7366
+ <language name="go" active="" listings="C" prism="go"/>
7367
+ <language name="java" active="java" listings="Java" prism="java"/>
7368
+ <language name="javascript" active="javascript" listings="" prism="javascript"/>
7369
+ <language name="kotlin" active="kotlin" listings="" prism="kotlin"/>
7370
+ <language name="lua" active="" listings="Lua" prism="lua"/>
7371
+ <language name="pascal" active="" listings="Pascal" prism="pascal"/>
7372
+ <language name="perl" active="" listings="Perl" prism="perl"/>
7373
+ <language name="python" active="python" listings="Python" prism="py"/>
7374
+ <language name="python3" active="python3" listings="Python" prism="py"/>
7375
+ <language name="r" active="" listings="R" prism="r"/>
7376
+ <language name="s" active="" listings="S" prism="s"/>
7377
+ <language name="sas" active="" listings="SAS" prism="s"/>
7378
+ <language name="sage" active="" listings="Python" prism="py"/>
7379
+ <language name="splus" active="" listings="[Plus]S" prism="s"/>
7380
+ <language name="vbasic" active="" listings="[Visual]Basic" prism="visual-basic"/>
7381
+ <language name="vbscript" active="" listings="VBscript" prism="visual-basic"/>
7336
7382
  <!-- Others (esp. functional) -->
7337
- <language ptx="clojure" active="" listings="Lisp" prism="clojure"/>
7338
- <language ptx="lisp" active="" listings="Lisp" prism="lisp"/>
7339
- <language ptx="clisp" active="" listings="Lisp" prism="lisp"/>
7340
- <language ptx="elisp" active="" listings="Lisp" prism="elisp"/>
7341
- <language ptx="scheme" active="" listings="Lisp" prism="scheme"/>
7342
- <language ptx="racket" active="" listings="Lisp" prism="racket"/>
7343
- <language ptx="sql" active="sql" listings="SQL" prism="sql"/>
7344
- <language ptx="llvm" active="" listings="LLVM" prism="llvm"/>
7345
- <language ptx="matlab" active="" listings="Matlab" prism="matlab"/>
7346
- <language ptx="octave" active="octave" listings="Octave" prism="matlab"/>
7347
- <language ptx="ml" active="" listings="ML" prism=""/>
7348
- <language ptx="ocaml" active="" listings="[Objective]Caml" prism="ocaml"/>
7349
- <language ptx="fsharp" active="" listings="ML" prism="fsharp"/>
7383
+ <language name="clojure" active="" listings="Lisp" prism="clojure"/>
7384
+ <language name="lisp" active="" listings="Lisp" prism="lisp"/>
7385
+ <language name="clisp" active="" listings="Lisp" prism="lisp"/>
7386
+ <language name="elisp" active="" listings="Lisp" prism="elisp"/>
7387
+ <language name="scheme" active="" listings="Lisp" prism="scheme"/>
7388
+ <language name="racket" active="" listings="Lisp" prism="racket"/>
7389
+ <language name="sql" active="sql" listings="SQL" prism="sql"/>
7390
+ <language name="llvm" active="" listings="LLVM" prism="llvm"/>
7391
+ <language name="matlab" active="" listings="Matlab" prism="matlab"/>
7392
+ <language name="octave" active="octave" listings="Octave" prism="matlab"/>
7393
+ <language name="ml" active="" listings="ML" prism=""/>
7394
+ <language name="ocaml" active="" listings="[Objective]Caml" prism="ocaml"/>
7395
+ <language name="fsharp" active="" listings="ML" prism="fsharp"/>
7350
7396
  <!-- Text Manipulation -->
7351
- <language ptx="css" active="" listings="" prism="css"/>
7352
- <language ptx="latex" active="" listings="[LaTeX]TeX" prism="latex"/>
7353
- <language ptx="html" active="html" listings="HTML" prism="html"/>
7354
- <language ptx="tex" active="" listings="[plain]TeX" prism="tex"/>
7355
- <language ptx="xml" active="" listings="XML" prism="xml"/>
7356
- <language ptx="xslt" active="" listings="XSLT" prism="xml"/>
7357
- </mb:programming>
7397
+ <language name="css" active="" listings="" prism="css"/>
7398
+ <language name="latex" active="" listings="[LaTeX]TeX" prism="latex"/>
7399
+ <language name="html" active="html" listings="HTML" prism="html"/>
7400
+ <language name="tex" active="" listings="[plain]TeX" prism="tex"/>
7401
+ <language name="xml" active="" listings="XML" prism="xml"/>
7402
+ <language name="xslt" active="" listings="XSLT" prism="xml"/>
7403
+ </xsl:variable>
7404
+
7405
+ <xsl:variable name="programming-language-table"
7406
+ select="exsl:node-set($programming-language-rtf)"/>
7358
7407
 
7359
7408
  <!-- Define the key for indexing into the data list -->
7360
- <xsl:key name="proglang" match="language" use="@ptx" />
7361
- <!-- And make a variable with the context for key lookups useing that key -->
7362
- <!-- doing the 'document('')/*/mb:programming' repeatedly is expensive. -->
7363
- <!-- (Especially in program|pf[prism-language] -->
7364
- <xsl:variable name="proglang-key-context" select="exsl:node-set(document('')/*/mb:programming)"/>
7409
+ <xsl:key name="programming-language-key" match="language" use="@name"/>
7365
7410
 
7366
7411
  <!-- Define variables for default active language - will be picked up by -->
7367
7412
  <!-- RS manifest and can be a different string than the raw language. -->
7368
7413
  <xsl:variable name="default-active-programming-language">
7369
7414
  <xsl:if test="$version-docinfo/programs/@language">
7370
- <xsl:for-each select="$proglang-key-context">
7371
- <xsl:value-of select="key('proglang', $version-docinfo/programs/@language)/@active" />
7415
+ <xsl:for-each select="$programming-language-table">
7416
+ <xsl:value-of select="key('programming-language-key', $version-docinfo/programs/@language)/@active" />
7372
7417
  </xsl:for-each>
7373
7418
  </xsl:if>
7374
7419
  </xsl:variable>
@@ -7384,7 +7429,7 @@ Book (with parts), "section" at level 3
7384
7429
 
7385
7430
  <!-- For a parsons, use @language, default parsons language, or default -->
7386
7431
  <!-- programming language in that order of preference. -->
7387
- <xsl:template match="*[@exercise-interactive = 'parson' or @exercise-interactive = 'parson-horizontal']" mode="get-programming-language">
7432
+ <xsl:template match="*[@pi:exercise-interactive = 'parson' or @pi:exercise-interactive = 'parson-horizontal']" mode="get-programming-language">
7388
7433
  <xsl:choose>
7389
7434
  <xsl:when test="@language">
7390
7435
  <xsl:value-of select="@language" />
@@ -7400,12 +7445,12 @@ Book (with parts), "section" at level 3
7400
7445
 
7401
7446
  <!-- A whole <program> node comes in, -->
7402
7447
  <!-- text of ActiveCode name comes out -->
7403
- <xsl:template match="program|*[@exercise-interactive = 'parson' or @exercise-interactive = 'parson-horizontal']" mode="active-language">
7448
+ <xsl:template match="program|*[@pi:exercise-interactive = 'parson' or @pi:exercise-interactive = 'parson-horizontal']" mode="active-language">
7404
7449
  <xsl:variable name="language">
7405
7450
  <xsl:apply-templates select="." mode="get-programming-language"/>
7406
7451
  </xsl:variable>
7407
- <xsl:for-each select="$proglang-key-context">
7408
- <xsl:value-of select="key('proglang', $language)/@active" />
7452
+ <xsl:for-each select="$programming-language-table">
7453
+ <xsl:value-of select="key('programming-language-key', $language)/@active" />
7409
7454
  </xsl:for-each>
7410
7455
  </xsl:template>
7411
7456
 
@@ -7415,30 +7460,19 @@ Book (with parts), "section" at level 3
7415
7460
  <xsl:variable name="language">
7416
7461
  <xsl:apply-templates select="." mode="get-programming-language"/>
7417
7462
  </xsl:variable>
7418
- <xsl:for-each select="$proglang-key-context">
7419
- <xsl:value-of select="key('proglang', $language)/@listings" />
7463
+ <xsl:for-each select="$programming-language-table">
7464
+ <xsl:value-of select="key('programming-language-key', $language)/@listings" />
7420
7465
  </xsl:for-each>
7421
7466
  </xsl:template>
7422
7467
 
7423
- <!-- This works, without keys, and could be adapted to range over actual data in text -->
7424
- <!-- For example, this approach is used for contributors to FCLA -->
7425
- <!--
7426
- <xsl:template match="*" mode="listings-language">
7427
- <xsl:variable name="language">
7428
- <xsl:value-of select="@language"/>
7429
- </xsl:variable>
7430
- <xsl:value-of select="document('')/*/mb:programming/language[@ptx=$language]/listings"/>
7431
- </xsl:template>
7432
- -->
7433
-
7434
7468
  <!-- A whole <program> node comes in, -->
7435
7469
  <!-- text of prism name comes out -->
7436
7470
  <xsl:template match="program|pf" mode="prism-language">
7437
7471
  <xsl:variable name="language">
7438
7472
  <xsl:apply-templates select="." mode="get-programming-language"/>
7439
7473
  </xsl:variable>
7440
- <xsl:for-each select="$proglang-key-context">
7441
- <xsl:value-of select="key('proglang', $language)/@prism" />
7474
+ <xsl:for-each select="$programming-language-table">
7475
+ <xsl:value-of select="key('programming-language-key', $language)/@prism" />
7442
7476
  </xsl:for-each>
7443
7477
  </xsl:template>
7444
7478
 
@@ -8261,7 +8295,9 @@ Book (with parts), "section" at level 3
8261
8295
  <xsl:choose>
8262
8296
  <xsl:when test="$b-is-biblio-target">
8263
8297
  <xsl:text>,</xsl:text>
8264
- <xsl:call-template name="nbsp-character"/>
8298
+ <xsl:call-template name="character">
8299
+ <xsl:with-param name="name" select="'nbsp'"/>
8300
+ </xsl:call-template>
8265
8301
  <!-- this info should not be in an attribute! -->
8266
8302
  <xsl:apply-templates select="@detail" />
8267
8303
  </xsl:when>
@@ -8364,30 +8400,50 @@ Book (with parts), "section" at level 3
8364
8400
  <!-- brackets and detail before link manufacture -->
8365
8401
  <!-- Content passes with @first, not with @second -->
8366
8402
  <xsl:variable name="b-is-biblio-target" select="boolean($target-one/self::biblio)" />
8367
- <!-- Compose two text parts with an ndash, perhaps wrappped -->
8403
+ <!-- Compose two text parts with an ndash, perhaps wrapped. -->
8404
+ <!-- But custom text replaces the entire composition, so no -->
8405
+ <!-- endpoint texts, no ndash, and no bibliography brackets -->
8406
+ <!-- (matching their suppression for a single citation with -->
8407
+ <!-- custom text). -->
8368
8408
  <xsl:variable name="text">
8369
8409
  <xsl:if test="parent::mrow">
8370
8410
  <xsl:text>\text{</xsl:text>
8371
8411
  </xsl:if>
8372
- <xsl:if test="$b-is-biblio-target">
8373
- <xsl:text>[</xsl:text>
8374
- </xsl:if>
8375
- <xsl:apply-templates select="." mode="xref-text" >
8376
- <xsl:with-param name="target" select="$target-one" />
8377
- <xsl:with-param name="text-style" select="$text-style-one" />
8378
- <!-- pass content as an RTF, test vs. empty string, use copy-of -->
8379
- <xsl:with-param name="custom-text">
8380
- <xsl:apply-templates/>
8381
- </xsl:with-param>
8382
- </xsl:apply-templates>
8383
- <xsl:call-template name="ndash-character"/>
8384
- <xsl:apply-templates select="." mode="xref-text" >
8385
- <xsl:with-param name="target" select="$target-two" />
8386
- <xsl:with-param name="text-style" select="$text-style-two" />
8387
- </xsl:apply-templates>
8388
- <xsl:if test="$b-is-biblio-target">
8389
- <xsl:text>]</xsl:text>
8390
- </xsl:if>
8412
+ <xsl:choose>
8413
+ <xsl:when test="$text-style-one = 'custom'">
8414
+ <xsl:apply-templates select="." mode="xref-text" >
8415
+ <xsl:with-param name="target" select="$target-one" />
8416
+ <xsl:with-param name="text-style" select="$text-style-one" />
8417
+ <!-- pass content as an RTF, test vs. empty string, use copy-of -->
8418
+ <xsl:with-param name="custom-text">
8419
+ <xsl:apply-templates/>
8420
+ </xsl:with-param>
8421
+ </xsl:apply-templates>
8422
+ </xsl:when>
8423
+ <xsl:otherwise>
8424
+ <xsl:if test="$b-is-biblio-target">
8425
+ <xsl:text>[</xsl:text>
8426
+ </xsl:if>
8427
+ <xsl:apply-templates select="." mode="xref-text" >
8428
+ <xsl:with-param name="target" select="$target-one" />
8429
+ <xsl:with-param name="text-style" select="$text-style-one" />
8430
+ <!-- pass content as an RTF, test vs. empty string, use copy-of -->
8431
+ <xsl:with-param name="custom-text">
8432
+ <xsl:apply-templates/>
8433
+ </xsl:with-param>
8434
+ </xsl:apply-templates>
8435
+ <xsl:call-template name="character">
8436
+ <xsl:with-param name="name" select="'ndash'"/>
8437
+ </xsl:call-template>
8438
+ <xsl:apply-templates select="." mode="xref-text" >
8439
+ <xsl:with-param name="target" select="$target-two" />
8440
+ <xsl:with-param name="text-style" select="$text-style-two" />
8441
+ </xsl:apply-templates>
8442
+ <xsl:if test="$b-is-biblio-target">
8443
+ <xsl:text>]</xsl:text>
8444
+ </xsl:if>
8445
+ </xsl:otherwise>
8446
+ </xsl:choose>
8391
8447
  <xsl:if test="parent::mrow">
8392
8448
  <xsl:text>}</xsl:text>
8393
8449
  </xsl:if>
@@ -8540,7 +8596,7 @@ Book (with parts), "section" at level 3
8540
8596
 
8541
8597
  <!-- Warnings for a high-frequency mistake -->
8542
8598
  <xsl:template match="xref[not(@ref) and not(@first and @last) and not(@provisional)]">
8543
- <xsl:message>PTX:WARNING: A cross-reference (&lt;xref&gt;) must have a @ref attribute, a @first/@last attribute pair, or a @provisional attribute</xsl:message>
8599
+ <xsl:message>PTX:ERROR: A cross-reference (&lt;xref&gt;) must have a @ref attribute, a @first/@last attribute pair, or a @provisional attribute</xsl:message>
8544
8600
  <xsl:apply-templates select="." mode="location-report" />
8545
8601
  <xsl:call-template name="inline-warning">
8546
8602
  <xsl:with-param name="warning">
@@ -8611,11 +8667,7 @@ Book (with parts), "section" at level 3
8611
8667
  <!-- yes/no boolean for valid targets of an "xref" -->
8612
8668
  <!-- Initial list from entities file as of 2021-02-10 -->
8613
8669
  <!-- Others from test docs, public testing via pretext-dev -->
8614
- <!-- NB: "men" is historical. This element gets repaired -->
8615
- <!-- to a one-line "md" but the target is found in the -->
8616
- <!-- original source and is identified as an "men" element, -->
8617
- <!-- which really *should not* be not on this list. -->
8618
- <xsl:template match="&STRUCTURAL;|&DEFINITION-LIKE;|&THEOREM-LIKE;|&PROOF-LIKE;|&AXIOM-LIKE;|&REMARK-LIKE;|&COMPUTATION-LIKE;|&ASIDE-LIKE;|&OPENPROBLEM-LIKE;|&EXAMPLE-LIKE;|&PROJECT-LIKE;|&GOAL-LIKE;|&FIGURE-LIKE;|&SOLUTION-LIKE;|&DISCUSSION-LIKE;|exercise|task|subexercises|exercisegroup|poem|assemblage|paragraphs|li|fn|men|md|mrow|biblio|interactive/instructions|case|contributor|gi" mode="is-xref-target">
8670
+ <xsl:template match="&STRUCTURAL;|&DEFINITION-LIKE;|&THEOREM-LIKE;|&PROOF-LIKE;|&AXIOM-LIKE;|&REMARK-LIKE;|&COMPUTATION-LIKE;|&ASIDE-LIKE;|&OPENPROBLEM-LIKE;|&EXAMPLE-LIKE;|&PROJECT-LIKE;|&GOAL-LIKE;|&FIGURE-LIKE;|&SOLUTION-LIKE;|&DISCUSSION-LIKE;|exercise|task|subexercises|exercisegroup|poem|assemblage|paragraphs|li|fn|md|mrow|biblio|interactive/instructions|case|contributor|gi" mode="is-xref-target">
8619
8671
  <xsl:value-of select="'yes'"/>
8620
8672
  </xsl:template>
8621
8673
 
@@ -8631,15 +8683,15 @@ Book (with parts), "section" at level 3
8631
8683
  <!-- test/check initial ref of the list -->
8632
8684
  <xsl:otherwise>
8633
8685
  <xsl:variable name="initial" select="substring-before($ref-list, ' ')" />
8634
- <!-- Look up the ref in all relevant "documents": -->
8635
- <!-- the original source, and private solution file. -->
8636
- <!-- Count the number of successes, hoping it will be 1. -->
8637
- <!-- Long-term, this check should be performed in a second -->
8638
- <!-- pass on a completely assembled source, so the id() -->
8639
- <!-- function does not need to survey multiple documents. -->
8686
+ <!-- Look up the ref in the assembled tree: private -->
8687
+ <!-- solutions are merged and versions are resolved, so -->
8688
+ <!-- this is the truthful universe of targets — a ref to -->
8689
+ <!-- content excluded by the version in play is a genuine -->
8690
+ <!-- failure here, and the lookup never needs to survey -->
8691
+ <!-- more than one document. -->
8640
8692
  <xsl:variable name="hits">
8641
- <!-- always do a context shift to $original -->
8642
- <xsl:for-each select="$original">
8693
+ <!-- a context shift, so id() searches the assembled tree -->
8694
+ <xsl:for-each select="$root">
8643
8695
  <xsl:if test="id($initial)">
8644
8696
  <xsl:text>X</xsl:text>
8645
8697
  <xsl:variable name="target" select="id($initial)"/>
@@ -8810,7 +8862,7 @@ Book (with parts), "section" at level 3
8810
8862
  </xsl:variable>
8811
8863
  <xsl:if test="$the-title = ''">
8812
8864
  <xsl:message>
8813
- <xsl:text>PTX:WARNING: </xsl:text>
8865
+ <xsl:text>PTX:ERROR: </xsl:text>
8814
8866
  <xsl:text>An &lt;xref&gt; wants to build text using a title to identify the target, but the target (which has @xml:id "</xsl:text>
8815
8867
  <xsl:value-of select="@ref"/>
8816
8868
  <xsl:text>") has no title, not even a default title.</xsl:text>
@@ -8821,7 +8873,7 @@ Book (with parts), "section" at level 3
8821
8873
  <xsl:when test="$text-style = 'custom'">
8822
8874
  <xsl:if test="not($b-has-content)">
8823
8875
  <xsl:message>
8824
- <xsl:text>PTX:WARNING: </xsl:text>
8876
+ <xsl:text>PTX:ERROR: </xsl:text>
8825
8877
  <xsl:text>An &lt;xref&gt; wants to use custom text to describe the target, but no custom text was provided as the content of the "xref".</xsl:text>
8826
8878
  </xsl:message>
8827
8879
  <xsl:apply-templates select="." mode="location-report" />
@@ -8842,7 +8894,7 @@ Book (with parts), "section" at level 3
8842
8894
  </xsl:variable>
8843
8895
  <xsl:if test="($the-number = '') and not($b-is-contributor-target)">
8844
8896
  <xsl:message>
8845
- <xsl:text>PTX:WARNING: </xsl:text>
8897
+ <xsl:text>PTX:ERROR: </xsl:text>
8846
8898
  <xsl:text>An &lt;xref&gt; wants to build text using a number to identify the target, but the target (which has @xml:id "</xsl:text>
8847
8899
  <xsl:value-of select="@ref"/>
8848
8900
  <xsl:text>") does not have a number. You could try 'text="title"' or 'text="custom"' on the "xref".</xsl:text>
@@ -8986,13 +9038,13 @@ Book (with parts), "section" at level 3
8986
9038
  <!-- catch this first and provide no text at all (could provide busted text?) -->
8987
9039
  <!-- anonymous lists live in "p", but this is an unreliable indication -->
8988
9040
  <xsl:when test="($text-style = 'phrase-global' or $text-style = 'phrase-hybrid') and ($target/self::li and not($target/ancestor::list or $target/ancestor::objectives or $target/ancestor::outcomes or $target/ancestor::exercise))">
8989
- <xsl:message>PTX:WARNING: a cross-reference to a list item of an anonymous list ("<xsl:apply-templates select="$target" mode="serial-number" />") with 'phrase-global' and 'phrase-hybrid' styles for the xref text will yield no text at all, and possibly create unpredictable results in output</xsl:message>
9041
+ <xsl:message>PTX:ERROR: a cross-reference to a list item of an anonymous list ("<xsl:apply-templates select="$target" mode="serial-number" />") with 'phrase-global' and 'phrase-hybrid' styles for the xref text will yield no text at all, and possibly create unpredictable results in output</xsl:message>
8990
9042
  </xsl:when>
8991
9043
  <xsl:when test="$text-style = 'phrase-global' or $text-style = 'phrase-hybrid'">
8992
9044
  <!-- no content override in this case -->
8993
9045
  <!-- maybe we can relax this somehow? -->
8994
9046
  <xsl:if test="$b-has-content">
8995
- <xsl:message>PTX:WARNING: providing content ("<xsl:value-of select="." />") for an "xref" element is ignored for 'phrase-global' and 'phrase-hybrid' styles for xref text</xsl:message>
9047
+ <xsl:message>PTX:FALLBACK: providing content ("<xsl:value-of select="." />") for an "xref" element is ignored for 'phrase-global' and 'phrase-hybrid' styles for xref text</xsl:message>
8996
9048
  <xsl:apply-templates select="." mode="location-report" />
8997
9049
  </xsl:if>
8998
9050
  <!-- type-local first, no matter what -->
@@ -9054,7 +9106,7 @@ Book (with parts), "section" at level 3
9054
9106
  <!-- we can get here by a variety of routes.) -->
9055
9107
  <xsl:when test="$b-has-content">
9056
9108
  <xsl:message>
9057
- <xsl:text>PTX:WARNING: </xsl:text>
9109
+ <xsl:text>PTX:DEPRECATE: </xsl:text>
9058
9110
  <xsl:text>An &lt;xref&gt; requests a 'title' as its text but also provides alternate content. The construction is deprecated as of 2020-02-18. Instead, specify that xref/@text should be 'custom', either globally or on a per-xref basis.</xsl:text>
9059
9111
  </xsl:message>
9060
9112
  <xsl:apply-templates select="." mode="location-report" />
@@ -9091,7 +9143,9 @@ Book (with parts), "section" at level 3
9091
9143
  <xsl:text> </xsl:text>
9092
9144
  </xsl:when>
9093
9145
  <xsl:otherwise>
9094
- <xsl:call-template name="nbsp-character"/>
9146
+ <xsl:call-template name="character">
9147
+ <xsl:with-param name="name" select="'nbsp'"/>
9148
+ </xsl:call-template>
9095
9149
  </xsl:otherwise>
9096
9150
  </xsl:choose>
9097
9151
  </xsl:template>
@@ -9237,7 +9291,9 @@ Book (with parts), "section" at level 3
9237
9291
  <!-- connector, internationalize -->
9238
9292
  <xsl:text> of </xsl:text>
9239
9293
  <xsl:apply-templates select="$highest-match" mode="type-name" />
9240
- <xsl:call-template name="nbsp-character"/>
9294
+ <xsl:call-template name="character">
9295
+ <xsl:with-param name="name" select="'nbsp'"/>
9296
+ </xsl:call-template>
9241
9297
  <xsl:apply-templates select="$highest-match" mode="xref-number">
9242
9298
  <xsl:with-param name="xref" select="." />
9243
9299
  </xsl:apply-templates>
@@ -9312,7 +9368,9 @@ Book (with parts), "section" at level 3
9312
9368
  <!-- connector, internationalize -->
9313
9369
  <xsl:text> of </xsl:text>
9314
9370
  <xsl:apply-templates select="$targets-list" mode="type-name" />
9315
- <xsl:call-template name="nbsp-character"/>
9371
+ <xsl:call-template name="character">
9372
+ <xsl:with-param name="name" select="'nbsp'"/>
9373
+ </xsl:call-template>
9316
9374
  <xsl:apply-templates select="$targets-list" mode="xref-number">
9317
9375
  <xsl:with-param name="xref" select="." />
9318
9376
  </xsl:apply-templates>
@@ -9523,41 +9581,12 @@ Book (with parts), "section" at level 3
9523
9581
  <!-- Dashes and hyphens - worth reviewing -->
9524
9582
  <!-- http://www.cs.tut.fi/~jkorpela/dashes.html -->
9525
9583
 
9526
- <xsl:template name="nbsp-character">
9527
- <xsl:call-template name="warn-unimplemented-character">
9528
- <xsl:with-param name="char-name" select="'nbsp'"/>
9529
- </xsl:call-template>
9530
- </xsl:template>
9531
- <xsl:template match="nbsp">
9532
- <xsl:call-template name="nbsp-character"/>
9533
- </xsl:template>
9534
-
9535
- <xsl:template name="ndash-character">
9536
- <xsl:call-template name="warn-unimplemented-character">
9537
- <xsl:with-param name="char-name" select="'ndash'"/>
9538
- </xsl:call-template>
9539
- </xsl:template>
9540
- <xsl:template match="ndash">
9541
- <xsl:call-template name="ndash-character"/>
9542
- </xsl:template>
9543
-
9544
9584
  <!-- An mdash may have thin space around it, otherwise it -->
9545
9585
  <!-- should have none. It might be difficult to enforce this -->
9546
9586
  <!-- (we could!), but we don't. Instead, we make the thin-space -->
9547
- <!-- version a publisher option. So we need two base characters -->
9548
- <!-- as abstract templates and do everything else here. -->
9549
-
9550
- <xsl:template name="mdash-character">
9551
- <xsl:call-template name="warn-unimplemented-character">
9552
- <xsl:with-param name="char-name" select="'mdash'"/>
9553
- </xsl:call-template>
9554
- </xsl:template>
9555
-
9556
- <xsl:template name="thin-space-character">
9557
- <xsl:call-template name="warn-unimplemented-character">
9558
- <xsl:with-param name="char-name" select="'thin-space'"/>
9559
- </xsl:call-template>
9560
- </xsl:template>
9587
+ <!-- version a publisher option. So the "thin-space" character -->
9588
+ <!-- joins the representation table for that purpose, and the -->
9589
+ <!-- assembly of the pieces happens here. -->
9561
9590
 
9562
9591
  <!-- The variable, surrounding space. This approach is -->
9563
9592
  <!-- executed once, so not local to template for "mdash" -->
@@ -9567,21 +9596,21 @@ Book (with parts), "section" at level 3
9567
9596
  <xsl:text />
9568
9597
  </xsl:when>
9569
9598
  <xsl:when test="$emdash-space='thin'">
9570
- <xsl:call-template name="thin-space-character"/>
9599
+ <xsl:call-template name="character">
9600
+ <xsl:with-param name="name" select="'thin-space'"/>
9601
+ </xsl:call-template>
9571
9602
  </xsl:when>
9572
9603
  </xsl:choose>
9573
9604
  </xsl:variable>
9574
9605
 
9575
9606
  <xsl:template match="mdash">
9576
9607
  <xsl:value-of select="$emdash-space-char"/>
9577
- <xsl:call-template name="mdash-character"/>
9608
+ <xsl:call-template name="character">
9609
+ <xsl:with-param name="name" select="'mdash'"/>
9610
+ </xsl:call-template>
9578
9611
  <xsl:value-of select="$emdash-space-char"/>
9579
9612
  </xsl:template>
9580
9613
 
9581
- <!-- ################## -->
9582
- <!-- Special Characters -->
9583
- <!-- ################## -->
9584
-
9585
9614
 
9586
9615
  <!-- These are characters which may look really bad -->
9587
9616
  <!-- if faked from a keyboard (double brackets), -->
@@ -9598,6 +9627,137 @@ Book (with parts), "section" at level 3
9598
9627
  <xsl:text>]]]</xsl:text>
9599
9628
  </xsl:template>
9600
9629
 
9630
+ <!-- The table of character representations: one row per character, -->
9631
+ <!-- one column per representation, each read by a conversion's -->
9632
+ <!-- modal "character" template; a character whose rendering needs -->
9633
+ <!-- more than a column value (fonts, wrapper markup) gets a -->
9634
+ <!-- per-character template overriding that mode. Column notes: -->
9635
+ <!-- "unicode" the bare code point -->
9636
+ <!-- "latex" macro or construction; the reader appends an -->
9637
+ <!-- empty group ({}) unless latex-ending="no" -->
9638
+ <!-- "ascii" 7-bit stand-in for text's ascii election; -->
9639
+ <!-- absent = unimplemented, warns -->
9640
+ <!-- "webwork" PGML form for WeBWorK problem extraction; -->
9641
+ <!-- absent = unimplemented, warns -->
9642
+ <!-- "braille" absent = liblouis uses the "unicode" value; -->
9643
+ <!-- a value = a substitute character, since liblouis -->
9644
+ <!-- cannot use the true one; "none" = no rendering -->
9645
+ <!-- at all, warns -->
9646
+
9647
+ <xsl:variable name="character-rtf">
9648
+ <!-- U+00A0: NO-BREAK SPACE -->
9649
+ <!-- (the "&nbsp;" entity is undefined in XSL; always the numeric reference) -->
9650
+ <char name="nbsp" unicode="&#x00a0;" latex="~" latex-ending="no" ascii=" " webwork="[$NBSP]*"/>
9651
+ <!-- U+2013: EN DASH -->
9652
+ <char name="ndash" unicode="&#x2013;" latex="\textendash" ascii="-" webwork="[$NDASH]*"/>
9653
+ <!-- U+2014: EM DASH -->
9654
+ <char name="mdash" unicode="&#x2014;" latex="\textemdash" ascii="--" webwork="[$MDASH]*"/>
9655
+ <!-- U+2009: THIN SPACE -->
9656
+ <char name="thin-space" unicode="&#x2009;" latex="\," latex-ending="no" ascii=" " webwork=" "/>
9657
+ <!-- U+27E6: MATHEMATICAL LEFT WHITE SQUARE BRACKET -->
9658
+ <char name="ldblbracket" unicode="&#x27e6;" latex="\textlbrackdbl" braille="none"/>
9659
+ <!-- U+27E7: MATHEMATICAL RIGHT WHITE SQUARE BRACKET -->
9660
+ <char name="rdblbracket" unicode="&#x27e7;" latex="\textrbrackdbl" braille="none"/>
9661
+ <!-- U+27E8: MATHEMATICAL LEFT ANGLE BRACKET -->
9662
+ <char name="langle" unicode="&#x27e8;" latex="\textlangle" ascii="&lt;"/>
9663
+ <!-- U+27E9: MATHEMATICAL RIGHT ANGLE BRACKET -->
9664
+ <char name="rangle" unicode="&#x27e9;" latex="\textrangle" ascii="&gt;"/>
9665
+ <!-- U+2026: HORIZONTAL ELLIPSIS -->
9666
+ <char name="ellipsis" unicode="&#x2026;" latex="\textellipsis" ascii="..." webwork="..."/>
9667
+ <!-- U+00B7: MIDDLE DOT -->
9668
+ <!-- (sometimes like a decorative dash; tex.stackexchange.com/questions/19180) -->
9669
+ <char name="midpoint" unicode="&#x00b7;" latex="\textperiodcentered" ascii="*"/>
9670
+ <!-- U+2053: SWUNG DASH -->
9671
+ <char name="swungdash" unicode="&#x2053;" latex="\ptxswungdash" ascii="~" braille="~"/>
9672
+ <!-- U+2030: PER MILLE SIGN -->
9673
+ <char name="permille" unicode="&#x2030;" latex="\textperthousand" ascii="o/oo" braille="none"/>
9674
+ <!-- U+00B6: PILCROW SIGN -->
9675
+ <char name="pilcrow" unicode="&#x00b6;" latex="\textpilcrow" ascii="[pilcrow]"/>
9676
+ <!-- U+00A7: SECTION SIGN -->
9677
+ <char name="section-mark" unicode="&#x00a7;" latex="\textsection" ascii="[section]"/>
9678
+ <!-- U+2212: MINUS SIGN -->
9679
+ <char name="minus" unicode="&#x2212;" latex="\textminus" ascii="-"/>
9680
+ <!-- U+00D7: MULTIPLICATION SIGN -->
9681
+ <char name="times" unicode="&#x00d7;" latex="\texttimes" ascii="x"/>
9682
+ <!-- U+2044: FRACTION SLASH -->
9683
+ <!-- (the LaTeX form should not allow a linebreak; not tested) -->
9684
+ <char name="solidus" unicode="&#x2044;" latex="\textfractionsolidus" ascii="/" braille="/"/>
9685
+ <!-- U+00F7: DIVISION SIGN -->
9686
+ <char name="obelus" unicode="&#x00f7;" latex="\textdiv" ascii="/"/>
9687
+ <!-- U+00B1: PLUS-MINUS SIGN -->
9688
+ <char name="plusminus" unicode="&#x00b1;" latex="\textpm" ascii="+/-"/>
9689
+ <!-- U+00A9: COPYRIGHT SIGN -->
9690
+ <!-- (LaTeX form: tex.stackexchange.com/questions/1676) -->
9691
+ <char name="copyright" unicode="&#x00a9;" latex="\textcopyright" ascii="(c)"/>
9692
+ <!-- U+2117: SOUND RECORDING COPYRIGHT -->
9693
+ <char name="phonomark" unicode="&#x2117;" latex="\textcircledP" braille="none"/>
9694
+ <!-- U+1F12F: COPYLEFT SYMBOL -->
9695
+ <!-- (may not be universally available in fonts; Open C (U+0254) -->
9696
+ <!-- plus Combining Circle (U+20DD) can imitate) -->
9697
+ <char name="copyleft" unicode="&#x1f12f;" latex="\textcopyleft" braille="none"/>
9698
+ <!-- U+00AE: REGISTERED SIGN -->
9699
+ <!-- (Bringhurst: should be superscript; not so in a font is a -->
9700
+ <!-- font mistake, but a "sup" wrapper renders way too small in -->
9701
+ <!-- a correct font) -->
9702
+ <char name="registered" unicode="&#x00ae;" latex="\textregistered" ascii="(R)"/>
9703
+ <!-- U+2122: TRADE MARK SIGN -->
9704
+ <char name="trademark" unicode="&#x2122;" latex="\texttrademark" ascii="(TM)"/>
9705
+ <!-- U+2120: SERVICE MARK -->
9706
+ <char name="servicemark" unicode="&#x2120;" latex="\textservicemark" braille="none"/>
9707
+ <!-- U+00B0: DEGREE SIGN -->
9708
+ <char name="degree" unicode="&#x00b0;" latex="\textdegree" ascii="deg"/>
9709
+ <!-- U+2032: PRIME -->
9710
+ <!-- (a LaTeX math construction looks better, but needs protection -->
9711
+ <!-- during text-processing; Bringhurst: many text fonts lack a prime -->
9712
+ <!-- and/or double-prime glyph) -->
9713
+ <char name="prime" unicode="&#x2032;" latex="\textquotesingle" ascii="'"/>
9714
+ <!-- U+2033: DOUBLE PRIME -->
9715
+ <char name="dblprime" unicode="&#x2033;" latex="\textquotesingle\textquotesingle" ascii="''"/>
9716
+ </xsl:variable>
9717
+
9718
+ <xsl:variable name="character-table"
9719
+ select="exsl:node-set($character-rtf)"/>
9720
+
9721
+ <xsl:key name="character-key" match="char" use="@name"/>
9722
+
9723
+ <!-- Look up a character by name, then render it with the modal -->
9724
+ <!-- "character" implementation in effect. An unknown name is a -->
9725
+ <!-- defect in a calling template, not an authoring error. -->
9726
+ <xsl:template name="character">
9727
+ <xsl:param name="name"/>
9728
+ <!-- a key resolves within the document holding the context -->
9729
+ <!-- node, so step inside the table, a node-set of one node -->
9730
+ <xsl:for-each select="$character-table">
9731
+ <xsl:variable name="the-row" select="key('character-key', $name)"/>
9732
+ <xsl:choose>
9733
+ <xsl:when test="$the-row">
9734
+ <xsl:apply-templates select="$the-row" mode="character"/>
9735
+ </xsl:when>
9736
+ <xsl:otherwise>
9737
+ <xsl:message>PTX:BUG: the character named "<xsl:value-of select="$name"/>" is not in the character table</xsl:message>
9738
+ </xsl:otherwise>
9739
+ </xsl:choose>
9740
+ </xsl:for-each>
9741
+ </xsl:template>
9742
+
9743
+ <!-- A conversion without a modal "character" implementation gets -->
9744
+ <!-- a warning for every character in the table -->
9745
+ <xsl:template match="char" mode="character">
9746
+ <xsl:call-template name="warn-unimplemented-character">
9747
+ <xsl:with-param name="char-name" select="@name"/>
9748
+ </xsl:call-template>
9749
+ </xsl:template>
9750
+
9751
+ <!-- The empty source elements share one dispatcher; "mdash" is an -->
9752
+ <!-- exception (publisher-elected surrounding space), and the -->
9753
+ <!-- "thin-space" row has no element of its own (it exists for the -->
9754
+ <!-- "mdash" machinery and internal use) -->
9755
+ <xsl:template match="nbsp|ndash|ldblbracket|rdblbracket|langle|rangle|ellipsis|midpoint|swungdash|permille|pilcrow|section-mark|minus|times|solidus|obelus|plusminus|copyright|phonomark|copyleft|registered|trademark|servicemark|degree|prime|dblprime">
9756
+ <xsl:call-template name="character">
9757
+ <xsl:with-param name="name" select="local-name()"/>
9758
+ </xsl:call-template>
9759
+ </xsl:template>
9760
+
9601
9761
  <!-- A given document may use for different characters for quotations: -->
9602
9762
  <!-- -->
9603
9763
  <!-- left/right (open/close) by primary/secondary -->
@@ -9649,267 +9809,34 @@ Book (with parts), "section" at level 3
9649
9809
  <xsl:apply-templates select="." mode="rq-character"/>
9650
9810
  </xsl:template>
9651
9811
 
9652
- <!-- Left Double Bracket -->
9653
- <xsl:template name="ldblbracket-character">
9654
- <xsl:call-template name="warn-unimplemented-character">
9655
- <xsl:with-param name="char-name" select="'ldblbracket'"/>
9656
- </xsl:call-template>
9657
- </xsl:template>
9658
- <xsl:template match="ldblbracket">
9659
- <xsl:call-template name="ldblbracket-character"/>
9660
- </xsl:template>
9661
9812
 
9662
- <!-- Right Double Bracket -->
9663
- <xsl:template name="rdblbracket-character">
9664
- <xsl:call-template name="warn-unimplemented-character">
9665
- <xsl:with-param name="char-name" select="'rdblbracket'"/>
9666
- </xsl:call-template>
9667
- </xsl:template>
9668
- <xsl:template match="rdblbracket">
9669
- <xsl:call-template name="rdblbracket-character"/>
9670
- </xsl:template>
9671
9813
 
9672
- <!-- Left Angle Bracket -->
9673
- <xsl:template name="langle-character">
9674
- <xsl:call-template name="warn-unimplemented-character">
9675
- <xsl:with-param name="char-name" select="'langle'"/>
9676
- </xsl:call-template>
9677
- </xsl:template>
9678
- <xsl:template match="langle">
9679
- <xsl:call-template name="langle-character"/>
9680
- </xsl:template>
9681
9814
 
9682
- <!-- Right Angle Bracket -->
9683
- <xsl:template name="rangle-character">
9684
- <xsl:call-template name="warn-unimplemented-character">
9685
- <xsl:with-param name="char-name" select="'rangle'"/>
9686
- </xsl:call-template>
9687
- </xsl:template>
9688
- <xsl:template match="rangle">
9689
- <xsl:call-template name="rangle-character"/>
9690
- </xsl:template>
9691
9815
 
9692
- <!-- Ellipsis (dots), for text, not math -->
9693
- <xsl:template name="ellipsis-character">
9694
- <xsl:call-template name="warn-unimplemented-character">
9695
- <xsl:with-param name="char-name" select="'ellipsis'"/>
9696
- </xsl:call-template>
9697
- </xsl:template>
9698
- <xsl:template match="ellipsis">
9699
- <xsl:call-template name="ellipsis-character"/>
9700
- </xsl:template>
9701
9816
 
9702
- <!-- Midpoint -->
9703
- <!-- A centered dot used sometimes like a decorative dash -->
9704
- <xsl:template name="midpoint-character">
9705
- <xsl:call-template name="warn-unimplemented-character">
9706
- <xsl:with-param name="char-name" select="'midpoint'"/>
9707
- </xsl:call-template>
9708
- </xsl:template>
9709
- <xsl:template match="midpoint">
9710
- <xsl:call-template name="midpoint-character"/>
9711
- </xsl:template>
9712
9817
 
9713
- <!-- Swung Dash -->
9714
- <!-- A decorative dash, like a tilde, but bigger, and centered -->
9715
- <xsl:template name="swungdash-character">
9716
- <xsl:call-template name="warn-unimplemented-character">
9717
- <xsl:with-param name="char-name" select="'swungdash'"/>
9718
- </xsl:call-template>
9719
- </xsl:template>
9720
- <xsl:template match="swungdash">
9721
- <xsl:call-template name="swungdash-character"/>
9722
- </xsl:template>
9723
9818
 
9724
- <!-- Per Mille -->
9725
- <!-- Or, per thousand, like a percent sign -->
9726
- <xsl:template name="permille-character">
9727
- <xsl:call-template name="warn-unimplemented-character">
9728
- <xsl:with-param name="char-name" select="'permille'"/>
9729
- </xsl:call-template>
9730
- </xsl:template>
9731
- <xsl:template match="permille">
9732
- <xsl:call-template name="permille-character"/>
9733
- </xsl:template>
9734
9819
 
9735
- <!-- Pilcrow -->
9736
- <!-- Often used to mark the start of a paragraph -->
9737
- <xsl:template name="pilcrow-character">
9738
- <xsl:call-template name="warn-unimplemented-character">
9739
- <xsl:with-param name="char-name" select="'pilcrow'"/>
9740
- </xsl:call-template>
9741
- </xsl:template>
9742
- <xsl:template match="pilcrow">
9743
- <xsl:call-template name="pilcrow-character"/>
9744
- </xsl:template>
9745
9820
 
9746
- <!-- Section Mark -->
9747
- <!-- The stylized double-S to indicate section numbers -->
9748
- <xsl:template name="section-mark-character">
9749
- <xsl:call-template name="warn-unimplemented-character">
9750
- <xsl:with-param name="char-name" select="'section-mark'"/>
9751
- </xsl:call-template>
9752
- </xsl:template>
9753
- <xsl:template match="section-mark">
9754
- <xsl:call-template name="section-mark-character"/>
9755
- </xsl:template>
9756
9821
 
9757
- <!-- Minus -->
9758
- <!-- A hyphen/dash for use in text as subtraction or negation-->
9759
- <xsl:template name="minus-character">
9760
- <xsl:call-template name="warn-unimplemented-character">
9761
- <xsl:with-param name="char-name" select="'minus'"/>
9762
- </xsl:call-template>
9763
- </xsl:template>
9764
- <xsl:template match="minus">
9765
- <xsl:call-template name="minus-character"/>
9766
- </xsl:template>
9767
9822
 
9768
- <!-- Times -->
9769
- <!-- A "multiplication sign" symbol for use in text -->
9770
- <xsl:template name="times-character">
9771
- <xsl:call-template name="warn-unimplemented-character">
9772
- <xsl:with-param name="char-name" select="'times'"/>
9773
- </xsl:call-template>
9774
- </xsl:template>
9775
- <xsl:template match="times">
9776
- <xsl:call-template name="times-character"/>
9777
- </xsl:template>
9778
9823
 
9779
- <!-- Solidus -->
9780
- <!-- Fraction bar, not as steep as a forward slash -->
9781
- <xsl:template name="solidus-character">
9782
- <xsl:call-template name="warn-unimplemented-character">
9783
- <xsl:with-param name="char-name" select="'solidus'"/>
9784
- </xsl:call-template>
9785
- </xsl:template>
9786
- <xsl:template match="solidus">
9787
- <xsl:call-template name="solidus-character"/>
9788
- </xsl:template>
9789
9824
 
9790
- <!-- Obelus -->
9791
- <!-- A "division" symbol for use in text -->
9792
- <xsl:template name="obelus-character">
9793
- <xsl:call-template name="warn-unimplemented-character">
9794
- <xsl:with-param name="char-name" select="'obelus'"/>
9795
- </xsl:call-template>
9796
- </xsl:template>
9797
- <xsl:template match="obelus">
9798
- <xsl:call-template name="obelus-character"/>
9799
- </xsl:template>
9800
9825
 
9801
- <!-- Plus/Minus -->
9802
- <!-- The combined symbol -->
9803
- <xsl:template name="plusminus-character">
9804
- <xsl:call-template name="warn-unimplemented-character">
9805
- <xsl:with-param name="char-name" select="'plusminus'"/>
9806
- </xsl:call-template>
9807
- </xsl:template>
9808
- <xsl:template match="plusminus">
9809
- <xsl:call-template name="plusminus-character"/>
9810
- </xsl:template>
9811
9826
 
9812
- <!-- Copyright -->
9813
- <!-- Bringhurst: on baseline (i.e. not superscript) -->
9814
- <xsl:template name="copyright-character">
9815
- <xsl:call-template name="warn-unimplemented-character">
9816
- <xsl:with-param name="char-name" select="'copyright'"/>
9817
- </xsl:call-template>
9818
- </xsl:template>
9819
- <xsl:template match="copyright">
9820
- <xsl:call-template name="copyright-character"/>
9821
- </xsl:template>
9822
9827
 
9823
- <!-- Phonomark -->
9824
- <!-- copyright on sound recordings -->
9825
- <!-- Bringhurst: counterpart copyright on baseline -->
9826
- <xsl:template name="phonomark-character">
9827
- <xsl:call-template name="warn-unimplemented-character">
9828
- <xsl:with-param name="char-name" select="'phonomark'"/>
9829
- </xsl:call-template>
9830
- </xsl:template>
9831
- <xsl:template match="phonomark">
9832
- <xsl:call-template name="phonomark-character"/>
9833
- </xsl:template>
9834
9828
 
9835
- <!-- Copyleft -->
9836
- <!-- Bringhurst: counterpart copyright on baseline -->
9837
- <xsl:template name="copyleft-character">
9838
- <xsl:call-template name="warn-unimplemented-character">
9839
- <xsl:with-param name="char-name" select="'copyleft'"/>
9840
- </xsl:call-template>
9841
- </xsl:template>
9842
- <xsl:template match="copyleft">
9843
- <xsl:call-template name="copyleft-character"/>
9844
- </xsl:template>
9845
9829
 
9846
- <!-- Registered -->
9847
- <!-- Bringhurst: should be superscript -->
9848
- <xsl:template name="registered-character">
9849
- <xsl:call-template name="warn-unimplemented-character">
9850
- <xsl:with-param name="char-name" select="'registered'"/>
9851
- </xsl:call-template>
9852
- </xsl:template>
9853
- <xsl:template match="registered">
9854
- <xsl:call-template name="registered-character"/>
9855
- </xsl:template>
9856
9830
 
9857
- <!-- Trademark -->
9858
- <!-- Bringhurst: should be superscript -->
9859
- <xsl:template name="trademark-character">
9860
- <xsl:call-template name="warn-unimplemented-character">
9861
- <xsl:with-param name="char-name" select="'trademark'"/>
9862
- </xsl:call-template>
9863
- </xsl:template>
9864
- <xsl:template match="trademark">
9865
- <xsl:call-template name="trademark-character"/>
9866
- </xsl:template>
9867
9831
 
9868
- <!-- Servicemark -->
9869
- <!-- Bringhurst: counterpart trademark should be superscript -->
9870
- <xsl:template name="servicemark-character">
9871
- <xsl:call-template name="warn-unimplemented-character">
9872
- <xsl:with-param name="char-name" select="'servicemark'"/>
9873
- </xsl:call-template>
9874
- </xsl:template>
9875
- <xsl:template match="servicemark">
9876
- <xsl:call-template name="servicemark-character"/>
9877
- </xsl:template>
9878
9832
 
9879
9833
  <!-- Coordinates, Temperature, English distance -->
9880
9834
  <!-- Intended for simple non-technical uses, without too -->
9881
9835
  <!-- much overhead. The SI unit markup would be better -->
9882
9836
  <!-- suited for scientific or technical work. -->
9883
9837
 
9884
- <!-- Degree -->
9885
- <xsl:template name="degree-character">
9886
- <xsl:call-template name="warn-unimplemented-character">
9887
- <xsl:with-param name="char-name" select="'degree'"/>
9888
- </xsl:call-template>
9889
- </xsl:template>
9890
- <xsl:template match="degree">
9891
- <xsl:call-template name="degree-character"/>
9892
- </xsl:template>
9893
9838
 
9894
- <!-- Prime -->
9895
- <xsl:template name="prime-character">
9896
- <xsl:call-template name="warn-unimplemented-character">
9897
- <xsl:with-param name="char-name" select="'prime'"/>
9898
- </xsl:call-template>
9899
- </xsl:template>
9900
- <xsl:template match="prime">
9901
- <xsl:call-template name="prime-character"/>
9902
- </xsl:template>
9903
9839
 
9904
- <!-- Double Prime -->
9905
- <xsl:template name="dblprime-character">
9906
- <xsl:call-template name="warn-unimplemented-character">
9907
- <xsl:with-param name="char-name" select="'dblprime'"/>
9908
- </xsl:call-template>
9909
- </xsl:template>
9910
- <xsl:template match="dblprime">
9911
- <xsl:call-template name="dblprime-character"/>
9912
- </xsl:template>
9913
9840
 
9914
9841
  <!-- Characters for Tagging Equations -->
9915
9842
 
@@ -9970,15 +9897,23 @@ http://andrewmccarthy.ie/2014/11/06/swung-dash-in-latex/
9970
9897
  </xsl:template>
9971
9898
 
9972
9899
  <xsl:template match="dblbrackets">
9973
- <xsl:call-template name="ldblbracket-character"/>
9900
+ <xsl:call-template name="character">
9901
+ <xsl:with-param name="name" select="'ldblbracket'"/>
9902
+ </xsl:call-template>
9974
9903
  <xsl:apply-templates/>
9975
- <xsl:call-template name="rdblbracket-character"/>
9904
+ <xsl:call-template name="character">
9905
+ <xsl:with-param name="name" select="'rdblbracket'"/>
9906
+ </xsl:call-template>
9976
9907
  </xsl:template>
9977
9908
 
9978
9909
  <xsl:template match="angles">
9979
- <xsl:call-template name="langle-character"/>
9910
+ <xsl:call-template name="character">
9911
+ <xsl:with-param name="name" select="'langle'"/>
9912
+ </xsl:call-template>
9980
9913
  <xsl:apply-templates/>
9981
- <xsl:call-template name="rangle-character"/>
9914
+ <xsl:call-template name="character">
9915
+ <xsl:with-param name="name" select="'rangle'"/>
9916
+ </xsl:call-template>
9982
9917
  </xsl:template>
9983
9918
 
9984
9919
  <!-- ########## -->
@@ -10150,7 +10085,9 @@ http://andrewmccarthy.ie/2014/11/06/swung-dash-in-latex/
10150
10085
  <xsl:template match="biblio[@type='raw']/number">
10151
10086
  <xsl:text>no</xsl:text>
10152
10087
  <xsl:call-template name="biblio-period"/>
10153
- <xsl:call-template name="thin-space-character"/>
10088
+ <xsl:call-template name="character">
10089
+ <xsl:with-param name="name" select="'thin-space'"/>
10090
+ </xsl:call-template>
10154
10091
  <xsl:apply-templates/>
10155
10092
  </xsl:template>
10156
10093
 
@@ -10253,7 +10190,9 @@ http://andrewmccarthy.ie/2014/11/06/swung-dash-in-latex/
10253
10190
  <xsl:template match="biblio[@type='bibtex']/number">
10254
10191
  <xsl:text>no</xsl:text>
10255
10192
  <xsl:call-template name="biblio-period"/>
10256
- <xsl:call-template name="thin-space-character"/>
10193
+ <xsl:call-template name="character">
10194
+ <xsl:with-param name="name" select="'thin-space'"/>
10195
+ </xsl:call-template>
10257
10196
  <xsl:apply-templates select="text()"/>
10258
10197
  <xsl:apply-templates select="." mode="bibtex-separator">
10259
10198
  <xsl:with-param name="separator" select="' '"/>
@@ -10282,7 +10221,9 @@ http://andrewmccarthy.ie/2014/11/06/swung-dash-in-latex/
10282
10221
  <xsl:template match="biblio[@type='bibtex']/pages[@start]">
10283
10222
  <xsl:text>pp</xsl:text>
10284
10223
  <xsl:call-template name="biblio-period"/>
10285
- <xsl:call-template name="thin-space-character"/>
10224
+ <xsl:call-template name="character">
10225
+ <xsl:with-param name="name" select="'thin-space'"/>
10226
+ </xsl:call-template>
10286
10227
  <xsl:value-of select="@start"/><xsl:text>-</xsl:text><xsl:value-of select="@end"/>
10287
10228
  <xsl:apply-templates select="." mode="bibtex-separator">
10288
10229
  <xsl:with-param name="separator" select="', '"/>
@@ -10295,7 +10236,7 @@ http://andrewmccarthy.ie/2014/11/06/swung-dash-in-latex/
10295
10236
  <!-- Final period when no following-siblings -->
10296
10237
 
10297
10238
  <xsl:template match="biblio[not(@type = 'raw') and not(@type = 'bibtex')]/*">
10298
- <xsl:message>PTX:WARNING: a child of "biblio" (<xsl:value-of select="local-name()"/>) is not being processed. Please report me so this can be fixed.</xsl:message>
10239
+ <xsl:message>PTX:BUG: a child of "biblio" (<xsl:value-of select="local-name()"/>) is not being processed. Please report me so this can be fixed.</xsl:message>
10299
10240
  </xsl:template>
10300
10241
 
10301
10242
  <!-- Authors: no lead-in, names via the shared "contributor-names" -->
@@ -10563,19 +10504,33 @@ http://andrewmccarthy.ie/2014/11/06/swung-dash-in-latex/
10563
10504
 
10564
10505
  <xsl:template name="warning-line-by-line">
10565
10506
  <xsl:param name="warning" />
10566
- <xsl:variable name="after" select="substring-before($warning,'&#xa;')"/>
10507
+ <!-- the first line, which may be all of the text -->
10508
+ <xsl:variable name="first-line">
10509
+ <xsl:choose>
10510
+ <xsl:when test="contains($warning, '&#xa;')">
10511
+ <xsl:value-of select="substring-before($warning, '&#xa;')"/>
10512
+ </xsl:when>
10513
+ <xsl:otherwise>
10514
+ <xsl:value-of select="$warning"/>
10515
+ </xsl:otherwise>
10516
+ </xsl:choose>
10517
+ </xsl:variable>
10567
10518
  <xsl:choose>
10568
- <!-- no line breaks in warning, just print it -->
10569
- <xsl:when test="substring-before($warning,'&#xa;') = ''">
10570
- <xsl:message><xsl:value-of select="$warning" /></xsl:message>
10519
+ <!-- a message with no content is reported strangely -->
10520
+ <!-- by the processing library, a space displays well -->
10521
+ <xsl:when test="$first-line = ''">
10522
+ <xsl:message><xsl:text> </xsl:text></xsl:message>
10571
10523
  </xsl:when>
10572
10524
  <xsl:otherwise>
10573
- <xsl:message><xsl:value-of select="substring-before($warning,'&#xa;')" /></xsl:message>
10574
- <xsl:call-template name="warning-line-by-line">
10575
- <xsl:with-param name="warning" select="substring-after($warning,'&#xa;')" />
10576
- </xsl:call-template>
10525
+ <xsl:message><xsl:value-of select="$first-line"/></xsl:message>
10577
10526
  </xsl:otherwise>
10578
10527
  </xsl:choose>
10528
+ <!-- and the lines after the first, if any -->
10529
+ <xsl:if test="contains($warning, '&#xa;')">
10530
+ <xsl:call-template name="warning-line-by-line">
10531
+ <xsl:with-param name="warning" select="substring-after($warning, '&#xa;')"/>
10532
+ </xsl:call-template>
10533
+ </xsl:if>
10579
10534
  </xsl:template>
10580
10535
 
10581
10536
  <!-- Report the location of an element or attribute, for use after a -->
@@ -10701,7 +10656,7 @@ http://andrewmccarthy.ie/2014/11/06/swung-dash-in-latex/
10701
10656
  <xsl:text>&#xa;</xsl:text>
10702
10657
  <xsl:text> 1. Code generation is functional, but does not respect indentation&#xa;</xsl:text>
10703
10658
  <xsl:text> 2. LaTeX generation is functional, could be improved, 2020-11-11&#xa;</xsl:text>
10704
- <xsl:text> 2. HTML generation is functional, could be improved, 2020-11-11&#xa;</xsl:text>
10659
+ <xsl:text> 3. HTML generation is functional, could be improved, 2020-11-11&#xa;</xsl:text>
10705
10660
  </xsl:with-param>
10706
10661
  </xsl:call-template>
10707
10662
  </xsl:if>
@@ -10905,7 +10860,7 @@ http://andrewmccarthy.ie/2014/11/06/swung-dash-in-latex/
10905
10860
  </xsl:when>
10906
10861
  <xsl:otherwise>
10907
10862
  <xsl:text>P100Y</xsl:text>
10908
- <xsl:message>PTX:WARNING: "author.deprecations.all" should be "yes" or "no", not "<xsl:value-of select="$author.deprecations.all"/>", using the default value of "yes"</xsl:message>
10863
+ <xsl:message>PTX:FALLBACK: "author.deprecations.all" should be "yes" or "no", not "<xsl:value-of select="$author.deprecations.all"/>", using the default value of "yes"</xsl:message>
10909
10864
  </xsl:otherwise>
10910
10865
  </xsl:choose>
10911
10866
  </xsl:variable>
@@ -11203,11 +11158,18 @@ http://andrewmccarthy.ie/2014/11/06/swung-dash-in-latex/
11203
11158
  <xsl:with-param name="message" select="'the &quot;jsxgraph&quot; element has been deprecated, but remains functional, rework with the &quot;interactive&quot; element'" />
11204
11159
  </xsl:call-template>
11205
11160
  <!-- -->
11161
+ <!-- 2018-04-06 jsxgraph no longer a panel of a sidebyside -->
11162
+ <xsl:call-template name="deprecation-message">
11163
+ <xsl:with-param name="occurrences" select="&quot;$document-root//sidebyside/jsxgraph&quot;" />
11164
+ <xsl:with-param name="date-string" select="'2018-04-06'" />
11165
+ <xsl:with-param name="message" select="'a &quot;jsxgraph&quot; can no longer appear within a &quot;sidebyside&quot;, rework with the &quot;interactive&quot; element; as of 2026-07-22 the &quot;jsxgraph&quot; will be silently ignored'" />
11166
+ </xsl:call-template>
11167
+ <!-- -->
11206
11168
  <!-- 2018-05-02 paragraphs purely as a lightweight division -->
11207
11169
  <xsl:call-template name="deprecation-message">
11208
11170
  <xsl:with-param name="occurrences" select="&quot;$document-root//sidebyside/paragraphs&quot;" />
11209
11171
  <xsl:with-param name="date-string" select="'2018-04-06'" />
11210
- <xsl:with-param name="message" select="'a &quot;paragraphs&quot; can no longer appear within a &quot;sidebyside&quot;, replace with a &quot;stack&quot; containing multiple elements, such as &quot;p&quot;'" />
11172
+ <xsl:with-param name="message" select="'a &quot;paragraphs&quot; can no longer appear within a &quot;sidebyside&quot;, replace with a &quot;stack&quot; containing multiple elements, such as &quot;p&quot;; as of 2026-07-22 the &quot;paragraphs&quot; and its content will be silently ignored'" />
11211
11173
  </xsl:call-template>
11212
11174
  <!-- 2018-05-18 WeBWorK refactor no longer needs setup/var elements for static representations-->
11213
11175
  <xsl:call-template name="deprecation-message">
@@ -11415,7 +11377,7 @@ http://andrewmccarthy.ie/2014/11/06/swung-dash-in-latex/
11415
11377
  <xsl:call-template name="deprecation-message">
11416
11378
  <xsl:with-param name="occurrences" select="&quot;$docinfo/numbering/figures | $docinfo/numbering/exercises&quot;" />
11417
11379
  <xsl:with-param name="date-string" select="'2026-06-07'" />
11418
- <xsl:with-param name="message" select="'distinct numbering of figure-like and inline exercise blocks has been replaced by the &quot;numbering/figures&quot; and &quot;numbering/exercises&quot; entries in the publisher file. We will attempt to honor your intent. But please switch to using the Publishers File for configuration, as documented in the PreTeXt Guide.'"/>
11380
+ <xsl:with-param name="message" select="'distinct numbering of figure-like and inline exercise blocks has been replaced by the &quot;numbering/figures&quot; and &quot;numbering/exercises&quot; entries in the publisher file, and the &quot;docinfo&quot; form is now ignored. Please switch to using the Publishers File for configuration, as documented in the PreTeXt Guide.'"/>
11419
11381
  </xsl:call-template>
11420
11382
  <!-- -->
11421
11383
  <!-- 2017-08-25 once deprecated named lists to be captioned lists -->
@@ -11473,7 +11435,7 @@ http://andrewmccarthy.ie/2014/11/06/swung-dash-in-latex/
11473
11435
  <xsl:call-template name="deprecation-message">
11474
11436
  <xsl:with-param name="occurrences" select="&quot;$docinfo/numbering/division/@part&quot;" />
11475
11437
  <xsl:with-param name="date-string" select="'2021-02-14'" />
11476
- <xsl:with-param name="message" select="'docinfo/numbering/division/@part has been replaced by the numbering/divisions/@part-structure entry in the publisher file. We will attempt to honor your selection. But please switch to using the Publishers File for configuration, as documented in the PreTeXt Guide.'"/>
11438
+ <xsl:with-param name="message" select="'docinfo/numbering/division/@part has been replaced by the numbering/divisions/@part-structure entry in the publisher file, and is now ignored. Please switch to using the Publishers File for configuration, as documented in the PreTeXt Guide.'"/>
11477
11439
  </xsl:call-template>
11478
11440
  <!-- -->
11479
11441
  <!-- 2021-03-17 deprecate worksheet/pagebreak in favor of worksheet/page -->
@@ -11835,6 +11797,20 @@ http://andrewmccarthy.ie/2014/11/06/swung-dash-in-latex/
11835
11797
  <xsl:with-param name="message" select="'the &quot;@include-source&quot; attribute has been deprecated and it will be ignored. No replacement is planned.'"/>
11836
11798
  </xsl:call-template>
11837
11799
  <!-- -->
11800
+ <!-- 2026-07-08 "title" deprecated on "introduction"/"conclusion" of a traditional division -->
11801
+ <xsl:call-template name="deprecation-message">
11802
+ <xsl:with-param name="occurrences" select="&quot;$document-root//introduction[parent::article or parent::chapter or parent::appendix or parent::section or parent::subsection]/title | $document-root//conclusion[parent::article or parent::chapter or parent::appendix or parent::section or parent::subsection]/title&quot;" />
11803
+ <xsl:with-param name="date-string" select="'2026-07-08'" />
11804
+ <xsl:with-param name="message" select="'a &quot;title&quot; on an &quot;introduction&quot; or &quot;conclusion&quot; of a traditional division has been deprecated, and it will be ignored.'"/>
11805
+ </xsl:call-template>
11806
+ <!-- -->
11807
+ <!-- 2026-07-22 "audio", "video", "interactive" precluded within "sidebyside" -->
11808
+ <xsl:call-template name="deprecation-message">
11809
+ <xsl:with-param name="occurrences" select="&quot;$document-root//sidebyside//audio | $document-root//sidebyside//video | $document-root//sidebyside//interactive&quot;" />
11810
+ <xsl:with-param name="date-string" select="'2026-07-22'" />
11811
+ <xsl:with-param name="message" select="'an &quot;audio&quot;, &quot;video&quot;, or &quot;interactive&quot; element may not appear within a &quot;sidebyside&quot;, at any depth. Content may go missing with no further warning. Relocate the element outside the &quot;sidebyside&quot;.'"/>
11812
+ </xsl:call-template>
11813
+ <!-- -->
11838
11814
  </xsl:template>
11839
11815
 
11840
11816
  <!-- Miscellaneous -->