@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
@@ -143,10 +143,6 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
143
143
  </xsl:choose>
144
144
  </xsl:variable>
145
145
 
146
- <!-- Annotation -->
147
- <xsl:param name="html.annotation" select="''" />
148
- <xsl:variable name="b-activate-hypothesis" select="boolean($html.annotation='hypothesis')" />
149
-
150
146
  <!-- Should we build the SCORM manifest file? -->
151
147
  <xsl:param name="html.scorm" select="'no'" />
152
148
  <!-- b-host-scorm is true when building a SCORM package -->
@@ -187,6 +183,10 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
187
183
  <!-- so lightweight stylesheets can access the same logic. -->
188
184
  <xsl:variable name="chunk-level" select="$html-chunk-level"/>
189
185
 
186
+ <!-- A document with chunking set to 0, or with no chapters or sections -->
187
+ <!-- will be a single page. -->
188
+ <xsl:variable name="b-is-single-page" select="$chunk-level = 0 or ($b-is-article and count($document-root/section) = 0) or ($b-is-book and count($document-root//chapter) = 0)"/>
189
+
190
190
  <!-- HTML files as output -->
191
191
  <xsl:variable name="file-extension" select="'.html'" />
192
192
 
@@ -200,6 +200,10 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
200
200
  <!-- Used to identify if target is reveal.js instead of vanilla html -->
201
201
  <xsl:variable name="b-reveal-build" select="false()" />
202
202
 
203
+ <!-- Standard HTML builds start chunks from level 1. Other builds like epub -->
204
+ <!-- may need a different value. -->
205
+ <xsl:variable name="chunk-heading-level" select="1"/>
206
+
203
207
  <!-- ############### -->
204
208
  <!-- Source Analysis -->
205
209
  <!-- ############### -->
@@ -395,7 +399,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
395
399
  <!-- But first, we see if there is a coding error, due to -->
396
400
  <!-- the critical chunk level variable being overridden -->
397
401
  <xsl:if test="$chunk-level = ''">
398
- <xsl:message>PTX:BUG the $chunk-level variable has been left undefined&#xa;due to a change in a stylesheet that imports the HTML conversion&#xa;and the computation of an index page may fail spectacularly (infinite recursion?)"</xsl:message>
402
+ <xsl:message>PTX:BUG: the $chunk-level variable has been left undefined&#xa;due to a change in a stylesheet that imports the HTML conversion&#xa;and the computation of an index page may fail spectacularly (infinite recursion?)"</xsl:message>
399
403
  </xsl:if>
400
404
  <xsl:variable name="sanitized-ref">
401
405
  <xsl:choose>
@@ -416,7 +420,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
416
420
  <xsl:value-of select="$html-index-page-entered-ref"/>
417
421
  </xsl:when>
418
422
  <xsl:otherwise>
419
- <xsl:message>PTX:WARNING: the requested HTML index page cannot be constructed since "<xsl:value-of select="$html-index-page-entered-ref"/>" is not a complete web page at the current chunking level (level <xsl:value-of select="$chunk-level"/>). Defaults will be used instead</xsl:message>
423
+ <xsl:message>PTX:FALLBACK: the requested HTML index page cannot be constructed since "<xsl:value-of select="$html-index-page-entered-ref"/>" is not a complete web page at the current chunking level (level <xsl:value-of select="$chunk-level"/>). Defaults will be used instead</xsl:message>
420
424
  <xsl:text/>
421
425
  </xsl:otherwise>
422
426
  </xsl:choose>
@@ -487,15 +491,18 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
487
491
  <!-- The "file-wrap" routine should accept a $content -->
488
492
  <!-- parameter holding the contents of the body of the page -->
489
493
 
494
+ <!-- The HTML conversion (and hence its derivatives) opts in -->
495
+ <!-- to "division companion" chunks: introduction, conclusion, -->
496
+ <!-- objectives, outcomes of a division realized as a summary -->
497
+ <!-- page become pages themselves (see pretext-common.xsl) -->
498
+ <xsl:variable name="b-division-companion-chunks" select="true()"/>
499
+
490
500
  <!-- A complete page for a structural division -->
491
- <!-- Unlike the base implemenation in -common we pass a -->
492
- <!-- "heading-level", which begins at 2 to account for an "h1" -->
493
- <!-- being used in the masthead of the page infrastructure. -->
494
501
  <xsl:template match="&STRUCTURAL;" mode="chunk">
495
502
  <xsl:apply-templates select="." mode="file-wrap">
496
503
  <xsl:with-param name="content">
497
504
  <xsl:apply-templates select=".">
498
- <xsl:with-param name="heading-level" select="2"/>
505
+ <xsl:with-param name="heading-level" select="$chunk-heading-level"/>
499
506
  </xsl:apply-templates>
500
507
  </xsl:with-param>
501
508
  <!-- Set b-has-printout to true if the structural node is or contains a worksheet or handout -->
@@ -506,9 +513,6 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
506
513
  <!-- A summary page for a structural division -->
507
514
  <!-- Processing of a structural node realized as an -->
508
515
  <!-- intermediate/summary node. -->
509
- <!-- We pass in a "heading-level", which begins at 2 to -->
510
- <!-- account for an "h1" being used in the masthead of the -->
511
- <!-- page infrastructure. -->
512
516
  <xsl:template match="&STRUCTURAL;" mode="intermediate">
513
517
  <xsl:apply-templates select="." mode="file-wrap">
514
518
  <xsl:with-param name="content">
@@ -518,15 +522,15 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
518
522
  <section class="{local-name(.)}">
519
523
  <xsl:apply-templates select="." mode="html-id-attribute"/>
520
524
  <xsl:apply-templates select="." mode="section-heading">
521
- <xsl:with-param name="heading-level" select="2"/>
525
+ <xsl:with-param name="heading-level" select="$chunk-heading-level"/>
522
526
  </xsl:apply-templates>
523
527
  <xsl:apply-templates select="." mode="author-byline"/>
524
528
  <!-- Special case when building page for frontmatter without a titlepage -->
525
529
  <xsl:if test="self::frontmatter[not(titlepage)]">
526
530
  <xsl:call-template name="frontmatter-title" />
527
531
  </xsl:if>
528
- <xsl:apply-templates select="objectives|introduction|titlepage|abstract">
529
- <xsl:with-param name="heading-level" select="3"/>
532
+ <xsl:apply-templates select="titlepage|abstract">
533
+ <xsl:with-param name="heading-level" select="$chunk-heading-level + 1"/>
530
534
  </xsl:apply-templates>
531
535
  <!-- Links to subsidiary divisions, as a group of button/hyperlinks -->
532
536
  <nav class="summary-links">
@@ -534,9 +538,6 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
534
538
  <xsl:apply-templates select="*" mode="summary-nav" />
535
539
  </ul>
536
540
  </nav>
537
- <xsl:apply-templates select="conclusion|outcomes">
538
- <xsl:with-param name="heading-level" select="3"/>
539
- </xsl:apply-templates>
540
541
  <!-- Insert permalink -->
541
542
  <xsl:apply-templates select="." mode="permalink"/>
542
543
  </section>
@@ -571,9 +572,87 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
571
572
  </li>
572
573
  </xsl:template>
573
574
 
574
- <!-- introduction (etc.) and conclusion get dropped -->
575
+ <!-- Division companions become links, like the structural children; -->
576
+ <!-- document order places an "introduction" before the subdivision -->
577
+ <!-- links and a "conclusion" after, with no extra machinery -->
578
+ <xsl:template match="&DIVISION-COMPANION;" mode="summary-nav">
579
+ <!-- a link only when realized as a page (a conversion that -->
580
+ <!-- has not opted in renders no link, and no bare content) -->
581
+ <xsl:variable name="chunk">
582
+ <xsl:apply-templates select="." mode="is-chunk"/>
583
+ </xsl:variable>
584
+ <xsl:if test="$chunk = 'true'">
585
+ <xsl:variable name="url">
586
+ <xsl:apply-templates select="." mode="url" />
587
+ </xsl:variable>
588
+ <li>
589
+ <a href="{$url}" class="internal">
590
+ <span class="title">
591
+ <xsl:apply-templates select="." mode="division-companion-text"/>
592
+ </span>
593
+ </a>
594
+ </li>
595
+ </xsl:if>
596
+ </xsl:template>
597
+
598
+ <!-- everything else on a summary page gets dropped -->
575
599
  <xsl:template match="*" mode="summary-nav" />
576
600
 
601
+ <!-- Text for links (and ToC entries) to a division companion page. -->
602
+ <!-- "introduction"/"conclusion": the localized type-name only (an -->
603
+ <!-- authored title is silently ignored, pending deprecation). -->
604
+ <!-- "objectives"/"outcomes": the localized type-name, plus the -->
605
+ <!-- title when authored, mirroring the inline block headings. -->
606
+ <xsl:template match="introduction|conclusion" mode="division-companion-text">
607
+ <xsl:apply-templates select="." mode="type-name"/>
608
+ </xsl:template>
609
+
610
+ <xsl:template match="objectives|outcomes" mode="division-companion-text">
611
+ <xsl:apply-templates select="." mode="type-name"/>
612
+ <xsl:if test="title">
613
+ <xsl:text>: </xsl:text>
614
+ <xsl:apply-templates select="." mode="title-short"/>
615
+ </xsl:if>
616
+ </xsl:template>
617
+
618
+ <!-- A division companion realized as its own page -->
619
+ <xsl:template match="&DIVISION-COMPANION;" mode="chunk">
620
+ <xsl:apply-templates select="." mode="file-wrap">
621
+ <xsl:with-param name="content">
622
+ <xsl:apply-templates select="." mode="division-companion-page"/>
623
+ </xsl:with-param>
624
+ </xsl:apply-templates>
625
+ </xsl:template>
626
+
627
+ <!-- Page content: a manufactured heading (the link text), then the -->
628
+ <!-- children, much as the inline realization would present them -->
629
+ <xsl:template match="introduction|conclusion" mode="division-companion-page">
630
+ <xsl:text>&#xa;</xsl:text>
631
+ <section>
632
+ <xsl:attribute name="class">
633
+ <xsl:value-of select="local-name(.)" />
634
+ </xsl:attribute>
635
+ <xsl:apply-templates select="." mode="html-id-attribute"/>
636
+ <xsl:apply-templates select="." mode="heading-generic">
637
+ <xsl:with-param name="heading-level" select="$chunk-heading-level"/>
638
+ <xsl:with-param name="heading-title">
639
+ <xsl:apply-templates select="." mode="division-companion-text"/>
640
+ </xsl:with-param>
641
+ </xsl:apply-templates>
642
+ <xsl:apply-templates select="*">
643
+ <xsl:with-param name="heading-level" select="$chunk-heading-level + 1"/>
644
+ </xsl:apply-templates>
645
+ </section>
646
+ </xsl:template>
647
+
648
+ <!-- Page content: the ordinary block realization, whose heading -->
649
+ <!-- already displays the type-name and any authored title -->
650
+ <xsl:template match="objectives|outcomes" mode="division-companion-page">
651
+ <xsl:apply-templates select=".">
652
+ <xsl:with-param name="heading-level" select="$chunk-heading-level"/>
653
+ </xsl:apply-templates>
654
+ </xsl:template>
655
+
577
656
  <!-- Default template for content of a structural -->
578
657
  <!-- division, which could be an entire page's -->
579
658
  <!-- worth, or just a subdivision within a page -->
@@ -632,7 +711,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
632
711
  <xsl:apply-templates select="." mode="author-byline"/>
633
712
  <!-- If there is watermark text, we print it here in an assistive p -->
634
713
  <!-- so that it is the first thing read by a screen-reader user. -->
635
- <xsl:if test="$b-watermark and $heading-level = 2">
714
+ <xsl:if test="$b-watermark and $heading-level = $chunk-heading-level">
636
715
  <p class="watermark">
637
716
  <xsl:text>Watermark text: </xsl:text>
638
717
  <xsl:value-of select="$watermark-text"/>
@@ -646,16 +725,12 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
646
725
  <!-- and the method is defined there. -->
647
726
  <xsl:apply-templates select="." mode="view-source-widget"/>
648
727
 
649
- <!-- This is usually recurrence, so increment heading-level, -->
650
- <!-- but "book" and "article" have an h1 masthead, so if -->
651
- <!-- this is the context, we just pass along the level of -->
652
- <!-- "2" which is supplied by the chunking templates -->
653
- <!-- N.B. the modal "solutions" templates increment -->
654
- <!-- $heading-level as "exercise" are produced, so -->
655
- <!-- we by-pass the increment here. -->
728
+ <!-- The "solutions" modal templates increment $heading-level -->
729
+ <!-- themselves, so bypassing the increment here avoids a skip -->
730
+ <!-- for both a solutions page and an inline "solutions". -->
656
731
  <xsl:variable name="next-level">
657
732
  <xsl:choose>
658
- <xsl:when test="self::book or self::article or self::solutions">
733
+ <xsl:when test="self::solutions">
659
734
  <xsl:value-of select="$heading-level"/>
660
735
  </xsl:when>
661
736
  <xsl:otherwise>
@@ -821,15 +896,47 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
821
896
  </xsl:if>
822
897
  </xsl:template>
823
898
 
824
- <!-- The front and back matter have their own style -->
825
- <xsl:template match="frontmatter|backmatter" mode="section-heading" />
899
+ <!-- The frontmatter has its own style -->
900
+ <xsl:template match="frontmatter" mode="section-heading" />
826
901
 
827
- <!-- A book or article is the top level, so the -->
828
- <!-- masthead might suffice, else an author can -->
829
- <!-- provide a frontmatter/titlepage to provide -->
830
- <!-- more specific information. In either event, -->
831
- <!-- a typical section heading is out of place. -->
832
- <xsl:template match="book|article" mode="section-heading" />
902
+ <!-- Fixed header for the backmatter contents. -->
903
+ <!-- We generally will hide this for sighted users. -->
904
+ <xsl:template match="backmatter" mode="section-heading">
905
+ <xsl:if test="not($b-is-single-page)">
906
+ <xsl:variable name="html-heading">
907
+ <xsl:apply-templates select="." mode="html-heading">
908
+ <xsl:with-param name="heading-level" select="$chunk-heading-level"/>
909
+ </xsl:apply-templates>
910
+ </xsl:variable>
911
+ <xsl:element name="{$html-heading}">
912
+ <xsl:attribute name="class">heading ptx-backmatter-heading</xsl:attribute>
913
+ <xsl:apply-templates select="." mode="type-name">
914
+ <xsl:with-param name="string-id" select="'backmatter'"/>
915
+ </xsl:apply-templates>
916
+ </xsl:element>
917
+ </xsl:if>
918
+ </xsl:template>
919
+
920
+ <!-- A book or article is the top level, using the title would be -->
921
+ <!-- duplicative of the banner. Instead, the page-specific header -->
922
+ <!-- announces that this is the table of contents unless build is -->
923
+ <!-- a single page. -->
924
+ <!-- We generally will hide this for sighted users. -->
925
+ <xsl:template match="book|article" mode="section-heading">
926
+ <xsl:if test="not($b-is-single-page)">
927
+ <xsl:variable name="html-heading">
928
+ <xsl:apply-templates select="." mode="html-heading">
929
+ <xsl:with-param name="heading-level" select="$chunk-heading-level"/>
930
+ </xsl:apply-templates>
931
+ </xsl:variable>
932
+ <xsl:element name="{$html-heading}">
933
+ <xsl:attribute name="class">heading ptx-toc-heading</xsl:attribute>
934
+ <xsl:apply-templates select="." mode="type-name">
935
+ <xsl:with-param name="string-id" select="'toc'"/>
936
+ </xsl:apply-templates>
937
+ </xsl:element>
938
+ </xsl:if>
939
+ </xsl:template>
833
940
 
834
941
  <!-- An abstract needs structure, and an ID for a -->
835
942
  <!-- link out of the ToC sidebar for an article -->
@@ -902,7 +1009,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
902
1009
  <xsl:apply-templates select="." mode="title-full" />
903
1010
  </span>
904
1011
  <!-- add print preview button for printouts -->
905
- <xsl:if test="(self::worksheet or self::handout)">
1012
+ <xsl:if test="(&PRINTOUT-FILTER;)">
906
1013
  <xsl:apply-templates select="." mode="standalone-printout-links"/>
907
1014
  </xsl:if>
908
1015
  </xsl:template>
@@ -912,7 +1019,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
912
1019
  <!-- print previews. A simple button with printer icon that reloads -->
913
1020
  <!-- the page with a url parameter that tells javascript to switch -->
914
1021
  <!-- to printout css and format all the pages and workspace. -->
915
- <xsl:template match="worksheet|handout" mode="standalone-printout-links">
1022
+ <xsl:template match="&PRINTOUT;" mode="standalone-printout-links">
916
1023
  <xsl:variable name="printout-id">
917
1024
  <xsl:apply-templates select="." mode="html-id"/>
918
1025
  </xsl:variable>
@@ -967,7 +1074,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
967
1074
  <!-- This is all within a .frontmatter class for CSS -->
968
1075
  <xsl:template match="titlepage">
969
1076
  <!-- Use a context-free template to generate -->
970
- <!-- an "h2" title/subtitle heading -->
1077
+ <!-- an "h1" title/subtitle heading -->
971
1078
  <xsl:call-template name="frontmatter-title"/>
972
1079
  <!-- text generator for title page items from "bibinfo" -->
973
1080
  <xsl:apply-templates select="$document-root/frontmatter/titlepage/titlepage-items" />
@@ -988,7 +1095,14 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
988
1095
  <!-- generated by a "frontmatter" element (including, e.g., an intermediate page). -->
989
1096
  <xsl:template name="frontmatter-title">
990
1097
  <xsl:variable name="b-has-subtitle" select="$document-root/subtitle"/>
991
- <h2 class="heading">
1098
+ <!-- heading level should match default chunk heading level -->
1099
+ <xsl:variable name="html-heading">
1100
+ <xsl:apply-templates select="." mode="html-heading">
1101
+ <xsl:with-param name="heading-level" select="$chunk-heading-level"/>
1102
+ </xsl:apply-templates>
1103
+ </xsl:variable>
1104
+ <xsl:element name="{$html-heading}">
1105
+ <xsl:attribute name="class">heading</xsl:attribute>
992
1106
  <span class="title">
993
1107
  <xsl:apply-templates select="$document-root" mode="title-full" />
994
1108
  </span>
@@ -997,7 +1111,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
997
1111
  <xsl:apply-templates select="$document-root" mode="subtitle" />
998
1112
  </span>
999
1113
  </xsl:if>
1000
- </h2>
1114
+ </xsl:element>
1001
1115
  </xsl:template>
1002
1116
 
1003
1117
  <!-- A "credit" required "title" followed by an author (or several) -->
@@ -1161,7 +1275,9 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
1161
1275
 
1162
1276
  <xsl:template match="bibinfo/copyright">
1163
1277
  <div class="para copyright">
1164
- <xsl:call-template name="copyright-character"/>
1278
+ <xsl:call-template name="character">
1279
+ <xsl:with-param name="name" select="'copyright'"/>
1280
+ </xsl:call-template>
1165
1281
  <xsl:apply-templates select="year" />
1166
1282
  <xsl:text> </xsl:text>
1167
1283
  <xsl:apply-templates select="holder" />
@@ -1830,7 +1946,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
1830
1946
  </xsl:template>
1831
1947
 
1832
1948
  <!-- The directories of knowls that are targets of references. Most, -->
1833
- <!-- but not all, filenames are based on the "visible-id" template, -->
1949
+ <!-- but not all, filenames are based on the "unique-id" template, -->
1834
1950
  <!-- but this is organized so alternate naming conventions can be used. -->
1835
1951
  <!-- The file extension is *.html so recognized as OK by Moodle, etc -->
1836
1952
  <xsl:template match="*" mode="knowl-filename">
@@ -1847,15 +1963,15 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
1847
1963
  </xsl:when>
1848
1964
  <xsl:when test="$origin = 'index'">
1849
1965
  <xsl:text>index/</xsl:text>
1850
- <xsl:apply-templates select="." mode="visible-id" />
1966
+ <xsl:apply-templates select="." mode="unique-id" />
1851
1967
  </xsl:when>
1852
1968
  <xsl:when test="$origin = 'list-of'">
1853
1969
  <xsl:text>list-of/</xsl:text>
1854
- <xsl:apply-templates select="." mode="visible-id" />
1970
+ <xsl:apply-templates select="." mode="unique-id" />
1855
1971
  </xsl:when>
1856
1972
  <xsl:when test="$origin = 'notation'">
1857
1973
  <xsl:text>notation/</xsl:text>
1858
- <xsl:apply-templates select="." mode="visible-id" />
1974
+ <xsl:apply-templates select="." mode="unique-id" />
1859
1975
  </xsl:when>
1860
1976
  <!-- put a "location-report" template here to debug a bad knowl file -->
1861
1977
  <!-- (the file, or a reference to it) that lacks a subdirectory -->
@@ -1883,8 +1999,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
1883
1999
  <!-- progression corresponding to "section" and "article" nodes -->
1884
2000
  <!-- of the HTML tree. -->
1885
2001
  <!-- -->
1886
- <!-- We set the "heading-level" to "2" when chunking is initiated, -->
1887
- <!-- since we expect the masthead/banner to contain an "h1". -->
2002
+ <!-- We set the "heading-level" to "1" when chunking is initiated. -->
1888
2003
  <!-- Whenever a template processes its children, we increment the -->
1889
2004
  <!-- variable as we pass it down, so a template receives the correct -->
1890
2005
  <!-- level (and before it ever gets here, since we have consciously -->
@@ -1921,9 +2036,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
1921
2036
 
1922
2037
  <!-- Emit the "hN" tag name for a heading element. Every caller is -->
1923
2038
  <!-- expected to thread a $heading-level parameter through from the -->
1924
- <!-- chunk-template starting point (currently 2, accounting for the -->
1925
- <!-- masthead h1) via "body", "wrapped-content", and the various -->
1926
- <!-- heading-* helper templates. -->
2039
+ <!-- chunk-template starting point. -->
1927
2040
  <xsl:template match="*" mode="hN">
1928
2041
  <xsl:param name="heading-level" />
1929
2042
  <xsl:variable name="actual-heading-level">
@@ -1938,8 +2051,8 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
1938
2051
  <!-- and the various heading-* templates. If you see -->
1939
2052
  <!-- this message, locate the apply-templates chain -->
1940
2053
  <!-- that omitted the parameter and add it. -->
1941
- <xsl:message>PTX:BUG: "hN" template reached without a $heading-level parameter on element &lt;<xsl:value-of select="local-name(.)"/>&gt; at <xsl:for-each select="ancestor::*"><xsl:value-of select="local-name(.)"/><xsl:text>/</xsl:text></xsl:for-each><xsl:value-of select="local-name(.)"/>; defaulting to h2</xsl:message>
1942
- <xsl:text>2</xsl:text>
2054
+ <xsl:message>PTX:BUG: "hN" template reached without a $heading-level parameter on element &lt;<xsl:value-of select="local-name(.)"/>&gt; at <xsl:for-each select="ancestor::*"><xsl:value-of select="local-name(.)"/><xsl:text>/</xsl:text></xsl:for-each><xsl:value-of select="local-name(.)"/>; defaulting to h1</xsl:message>
2055
+ <xsl:text>1</xsl:text>
1943
2056
  </xsl:otherwise>
1944
2057
  </xsl:choose>
1945
2058
  </xsl:variable>
@@ -3840,9 +3953,9 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
3840
3953
  <!-- * Never for a "worksheet" - too messy for printing -->
3841
3954
  <!-- * Not hitting PROJECT-LIKE here, see elsewhere -->
3842
3955
  <xsl:variable name="b-tabbed-tasks" select="
3843
- (@exercise-customization = 'divisional' and $b-html-tabbed-tasks-divisional) or
3844
- (@exercise-customization = 'inline' and $b-html-tabbed-tasks-inline) or
3845
- (@exercise-customization = 'reading' and $b-html-tabbed-tasks-reading)"/>
3956
+ (@pi:exercise-customization = 'divisional' and $b-html-tabbed-tasks-divisional) or
3957
+ (@pi:exercise-customization = 'inline' and $b-html-tabbed-tasks-inline) or
3958
+ (@pi:exercise-customization = 'reading' and $b-html-tabbed-tasks-reading)"/>
3846
3959
  <xsl:choose>
3847
3960
  <xsl:when test="$b-tabbed-tasks">
3848
3961
  <!-- Use tabbed viewer from Runestone Components -->
@@ -3986,7 +4099,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
3986
4099
  <!-- be presented by a "tabbed" interface from Runestone -->
3987
4100
  <!-- components. Note: this test is simpler than for -->
3988
4101
  <!-- "exercise" since we know we have a PROJECT-LIKE and -->
3989
- <!-- do not need to consult @exercise-customization. -->
4102
+ <!-- do not need to consult @pi:exercise-customization. -->
3990
4103
  <xsl:choose>
3991
4104
  <xsl:when test="$b-html-tabbed-tasks-project">
3992
4105
  <!-- Use tabbed viewer from Runestone Components -->
@@ -4335,8 +4448,13 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
4335
4448
  <!-- When born use this heading -->
4336
4449
  <xsl:template match="&SOLUTION-LIKE;" mode="heading-birth">
4337
4450
  <xsl:param name="heading-level"/>
4451
+ <!-- consult the single "heading-birth-is-h" predicate, so the -->
4452
+ <!-- "body" heading-level increment cannot disagree with this -->
4453
+ <xsl:variable name="heads-with-h">
4454
+ <xsl:apply-templates select="." mode="heading-birth-is-h"/>
4455
+ </xsl:variable>
4338
4456
  <xsl:choose>
4339
- <xsl:when test="($knowl-example-solution = 'no') and ancestor::*[&EXAMPLE-FILTER;]">
4457
+ <xsl:when test="$heads-with-h = 'yes'">
4340
4458
  <xsl:apply-templates select="." mode="heading-non-singleton-number">
4341
4459
  <xsl:with-param name="heading-level" select="$heading-level"/>
4342
4460
  </xsl:apply-templates>
@@ -4435,7 +4553,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
4435
4553
  <!-- Largely a Runestone/database operation referencing -->
4436
4554
  <!-- existing questions supplied by the manifest, -->
4437
4555
  <!-- so we go straight to an HTML version -->
4438
- <xsl:template match="*[@exercise-interactive = 'select']" mode="exercise-components">
4556
+ <xsl:template match="*[@pi:exercise-interactive = 'select']" mode="exercise-components">
4439
4557
  <xsl:apply-templates select="." mode="runestone-to-interactive"/>
4440
4558
  </xsl:template>
4441
4559
 
@@ -4451,17 +4569,17 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
4451
4569
  <!-- The "runestone-to-interactive" templates will combine a -->
4452
4570
  <!-- "regular" PreTeXt statement together with some additional -->
4453
4571
  <!-- interactive material to make a hybrid "statement" -->
4454
- <xsl:template match="*[(@exercise-interactive = 'truefalse') or
4455
- (@exercise-interactive = 'multiplechoice') or
4456
- (@exercise-interactive = 'parson') or
4457
- (@exercise-interactive = 'parson-horizontal') or
4458
- (@exercise-interactive = 'cardsort') or
4459
- (@exercise-interactive = 'matching') or
4460
- (@exercise-interactive = 'clickablearea') or
4461
- (@exercise-interactive = 'fillin-basic') or
4462
- (@exercise-interactive = 'coding') or
4463
- (@exercise-interactive = 'dual') or
4464
- (@exercise-interactive = 'shortanswer')]" mode="exercise-components">
4572
+ <xsl:template match="*[(@pi:exercise-interactive = 'truefalse') or
4573
+ (@pi:exercise-interactive = 'multiplechoice') or
4574
+ (@pi:exercise-interactive = 'parson') or
4575
+ (@pi:exercise-interactive = 'parson-horizontal') or
4576
+ (@pi:exercise-interactive = 'cardsort') or
4577
+ (@pi:exercise-interactive = 'matching') or
4578
+ (@pi:exercise-interactive = 'clickablearea') or
4579
+ (@pi:exercise-interactive = 'fillin-basic') or
4580
+ (@pi:exercise-interactive = 'coding') or
4581
+ (@pi:exercise-interactive = 'dual') or
4582
+ (@pi:exercise-interactive = 'shortanswer')]" mode="exercise-components">
4465
4583
  <xsl:param name="b-original"/>
4466
4584
  <xsl:param name="block-type"/>
4467
4585
  <xsl:param name="heading-level"/>
@@ -4485,7 +4603,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
4485
4603
 
4486
4604
  <!-- Dynamic fillin is broken out separately because the test for -->
4487
4605
  <!-- correctness as well as feedback is dynamically chosen. -->
4488
- <xsl:template match="*[@exercise-interactive = 'fillin']" mode="exercise-components">
4606
+ <xsl:template match="*[@pi:exercise-interactive = 'fillin']" mode="exercise-components">
4489
4607
  <xsl:param name="b-original"/>
4490
4608
  <xsl:param name="block-type"/>
4491
4609
  <xsl:param name="heading-level"/>
@@ -5203,11 +5321,15 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
5203
5321
  <xsl:apply-templates select="." mode="heading-generic">
5204
5322
  <xsl:with-param name="heading-level" select="$heading-level"/>
5205
5323
  <xsl:with-param name="heading-title">
5206
- <xsl:call-template name="langle-character"/>
5324
+ <xsl:call-template name="character">
5325
+ <xsl:with-param name="name" select="'langle'"/>
5326
+ </xsl:call-template>
5207
5327
  <xsl:apply-templates select="." mode="number"/>
5208
5328
  <xsl:text> </xsl:text>
5209
5329
  <xsl:apply-templates select="." mode="title-full"/>
5210
- <xsl:call-template name="rangle-character"/>
5330
+ <xsl:call-template name="character">
5331
+ <xsl:with-param name="name" select="'rangle'"/>
5332
+ </xsl:call-template>
5211
5333
  <!-- U+2261 ≡ IDENTICAL TO -->
5212
5334
  <xsl:text> &#x2261;</xsl:text>
5213
5335
  </xsl:with-param>
@@ -5244,6 +5366,29 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
5244
5366
  <!-- are in the order presented above: simple first, -->
5245
5367
  <!-- and top-down when components are also knowled. -->
5246
5368
 
5369
+ <!-- Does a block's "heading-birth" emit an actual "h" at its -->
5370
+ <!-- level? Consulted by the "body" increment and the "solution" -->
5371
+ <!-- heading-birth so their notion of an "h" heading stays one. -->
5372
+ <xsl:template match="*" mode="heading-birth-is-h">
5373
+ <xsl:text>yes</xsl:text>
5374
+ </xsl:template>
5375
+
5376
+ <xsl:template match="&FIGURE-LIKE;" mode="heading-birth-is-h">
5377
+ <xsl:text>no</xsl:text>
5378
+ </xsl:template>
5379
+
5380
+ <xsl:template match="&SOLUTION-LIKE;" mode="heading-birth-is-h">
5381
+ <xsl:choose>
5382
+ <!-- an example's solution, shown un-knowled, is a numbered "h" -->
5383
+ <xsl:when test="($knowl-example-solution = 'no') and ancestor::*[&EXAMPLE-FILTER;]">
5384
+ <xsl:text>yes</xsl:text>
5385
+ </xsl:when>
5386
+ <xsl:otherwise>
5387
+ <xsl:text>no</xsl:text>
5388
+ </xsl:otherwise>
5389
+ </xsl:choose>
5390
+ </xsl:template>
5391
+
5247
5392
 
5248
5393
  <xsl:template match="&REMARK-LIKE;|&COMPUTATION-LIKE;|&DEFINITION-LIKE;|&ASIDE-LIKE;|poem|&FIGURE-LIKE;|assemblage|blockquote|paragraphs|&GOAL-LIKE;|&OPENPROBLEM-LIKE;|&EXAMPLE-LIKE;|subexercises|exercisegroup|exercise|&PROJECT-LIKE;|task|&SOLUTION-LIKE;|&DISCUSSION-LIKE;|&THEOREM-LIKE;|&AXIOM-LIKE;|&PROOF-LIKE;|case|fn|contributor|biblio|biblio/note|interactive/instructions|fragment" mode="body">
5249
5394
  <xsl:param name="b-original" select="true()"/>
@@ -5296,11 +5441,25 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
5296
5441
  <xsl:apply-templates select="." mode="view-source-widget"/>
5297
5442
  <!-- Then actual content, respecting b-original flag -->
5298
5443
  <!-- Pass $block-type for Sage cells to know environs -->
5299
- <!-- Increment heading-level for descendant blocks -->
5444
+ <!-- Descendant blocks step down a heading level, unless -->
5445
+ <!-- this block heads with something other than an "h"; -->
5446
+ <!-- the "heading-birth-is-h" predicate decides. -->
5447
+ <xsl:variable name="heads-with-h">
5448
+ <xsl:apply-templates select="." mode="heading-birth-is-h"/>
5449
+ </xsl:variable>
5300
5450
  <xsl:apply-templates select="." mode="wrapped-content">
5301
5451
  <xsl:with-param name="b-original" select="$b-original" />
5302
5452
  <xsl:with-param name="block-type" select="$block-type" />
5303
- <xsl:with-param name="heading-level" select="$heading-level + 1"/>
5453
+ <xsl:with-param name="heading-level">
5454
+ <xsl:choose>
5455
+ <xsl:when test="$heads-with-h = 'no'">
5456
+ <xsl:value-of select="$heading-level"/>
5457
+ </xsl:when>
5458
+ <xsl:otherwise>
5459
+ <xsl:value-of select="$heading-level + 1"/>
5460
+ </xsl:otherwise>
5461
+ </xsl:choose>
5462
+ </xsl:with-param>
5304
5463
  </xsl:apply-templates>
5305
5464
  <!-- Apply workspace div (but not in project, exercises or tasks, -->
5306
5465
  <!-- since they get them applied in their exercise-content -->
@@ -5929,7 +6088,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
5929
6088
  <!-- Utility templates to translate PTX -->
5930
6089
  <!-- enumeration style to HTML list-style-type -->
5931
6090
  <xsl:template match="ol|ol-marker" mode="html-list-class">
5932
- <xsl:variable name="mbx-format-code" select="./@format-code" />
6091
+ <xsl:variable name="mbx-format-code" select="./@pi:format-code" />
5933
6092
  <xsl:choose>
5934
6093
  <xsl:when test="$mbx-format-code = '0'">decimal</xsl:when>
5935
6094
  <xsl:when test="$mbx-format-code = '1'">decimal</xsl:when>
@@ -5970,7 +6129,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
5970
6129
  <xsl:variable name="mbx-format-code">
5971
6130
  <xsl:choose>
5972
6131
  <xsl:when test="self::ol">
5973
- <xsl:value-of select="./@format-code" />
6132
+ <xsl:value-of select="./@pi:format-code" />
5974
6133
  </xsl:when>
5975
6134
  <xsl:otherwise>
5976
6135
  <xsl:apply-templates select="." mode="format-code" />
@@ -6022,7 +6181,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
6022
6181
  </xsl:for-each >
6023
6182
  </xsl:template>
6024
6183
 
6025
- <xsl:template match="ol[not(@marker) and @format-code = 'a' and @ordered-list-level = '1']" mode="ol-marker-class">
6184
+ <xsl:template match="ol[not(@marker) and @pi:format-code = 'a' and @pi:ordered-list-level = '1']" mode="ol-marker-class">
6026
6185
  <xsl:text>lower-alpha-level-1</xsl:text>
6027
6186
  </xsl:template>
6028
6187
 
@@ -6030,10 +6189,10 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
6030
6189
 
6031
6190
  <xsl:template match="ol[@marker]" mode="ol-markers">
6032
6191
  <xsl:element name="ol-marker">
6033
- <xsl:copy-of select="@format-code"/>
6192
+ <xsl:copy-of select="@pi:format-code"/>
6034
6193
  <xsl:copy-of select="@marker"/>
6035
- <xsl:copy-of select="@marker-prefix"/>
6036
- <xsl:copy-of select="@marker-suffix"/>
6194
+ <xsl:copy-of select="@pi:marker-prefix"/>
6195
+ <xsl:copy-of select="@pi:marker-suffix"/>
6037
6196
  <xsl:attribute name="classname">
6038
6197
  <xsl:text>ol-marker-</xsl:text>
6039
6198
  <xsl:value-of select="position()" />
@@ -6047,11 +6206,11 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
6047
6206
  <xsl:text>ol.</xsl:text>
6048
6207
  <xsl:value-of select="./@classname"/>
6049
6208
  <xsl:text> &gt; li::marker { content: &quot;</xsl:text>
6050
- <xsl:value-of select="./@marker-prefix" />
6209
+ <xsl:value-of select="./@pi:marker-prefix" />
6051
6210
  <xsl:text>&quot;counter(list-item,</xsl:text>
6052
6211
  <xsl:apply-templates select="." mode="html-list-class" />
6053
6212
  <xsl:text>)&quot;</xsl:text>
6054
- <xsl:value-of select="./@marker-suffix" />
6213
+ <xsl:value-of select="./@pi:marker-suffix" />
6055
6214
  <xsl:text> &quot;; }&#xa;</xsl:text>
6056
6215
  </xsl:template>
6057
6216
 
@@ -6400,7 +6559,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
6400
6559
  </xsl:when>
6401
6560
  <!-- failure -->
6402
6561
  <xsl:otherwise>
6403
- <xsl:message>PTX:ERROR: the Asymptote diagram produced in "<xsl:value-of select="$image-xml"/>" needs to be available relative to the primary source file, or if available it is perhaps ill-formed and its width cannot be determined (which you might report as a bug). We might be able to proceed as if the diagram is square, but results can be unpredictable.</xsl:message>
6562
+ <xsl:message>PTX:FALLBACK: the Asymptote diagram produced in "<xsl:value-of select="$image-xml"/>" needs to be available relative to the primary source file, or if available it is perhaps ill-formed and its width cannot be determined (which you might report as a bug). We might be able to proceed as if the diagram is square, but results can be unpredictable.</xsl:message>
6404
6563
  <!-- reasonable guess at points/pixels -->
6405
6564
  <xsl:text>400</xsl:text>
6406
6565
  </xsl:otherwise>
@@ -6422,7 +6581,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
6422
6581
  </xsl:when>
6423
6582
  <!-- failure -->
6424
6583
  <xsl:otherwise>
6425
- <xsl:message>PTX:ERROR: the Asymptote diagram produced in "<xsl:value-of select="$image-xml"/>" needs to be available relative to the primary source file, or if available it is perhaps ill-formed and its height cannot be determined (which you might report as a bug). We might be able to proceed as if the diagram is square, but results can be unpredictable.</xsl:message>
6584
+ <xsl:message>PTX:FALLBACK: the Asymptote diagram produced in "<xsl:value-of select="$image-xml"/>" needs to be available relative to the primary source file, or if available it is perhaps ill-formed and its height cannot be determined (which you might report as a bug). We might be able to proceed as if the diagram is square, but results can be unpredictable.</xsl:message>
6426
6585
  <!-- reasonable guess at points/pixels -->
6427
6586
  <xsl:text>400</xsl:text>
6428
6587
  </xsl:otherwise>
@@ -6589,7 +6748,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
6589
6748
  <xsl:when test="latex-image">
6590
6749
  <xsl:apply-templates select="$image-svg-xml/svg:svg/*" mode="svg-unique-ids">
6591
6750
  <xsl:with-param name="svg-unique-id">
6592
- <xsl:value-of select="@unique-id"/>
6751
+ <xsl:value-of select="@pi:unique-id"/>
6593
6752
  </xsl:with-param>
6594
6753
  </xsl:apply-templates>
6595
6754
  </xsl:when>
@@ -6644,7 +6803,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
6644
6803
 
6645
6804
  <!-- Utility template so "aria-describedby" values are consistent -->
6646
6805
  <xsl:template match="image|interactive[@platform|@desmos|@calcplot3d|@circuitjs|@iframe]" mode="describedby-id">
6647
- <xsl:apply-templates select="." mode="visible-id"/>
6806
+ <xsl:apply-templates select="." mode="unique-id"/>
6648
6807
  <xsl:text>-description</xsl:text>
6649
6808
  </xsl:template>
6650
6809
 
@@ -6941,11 +7100,13 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
6941
7100
  </xsl:element>
6942
7101
  </xsl:template>
6943
7102
 
6944
- <!-- We take in all three rows and package -->
6945
- <!-- them up inside an overriding "sidebyside" -->
6946
- <!-- div containing three "sbsrow" divs. Purely -->
6947
- <!-- a container, never a target, so no xml:id -->
6948
- <!-- in source, so no HTML id on div.sidebyside -->
7103
+ <!-- The finished panels arrive as one opaque fragment and are -->
7104
+ <!-- copied, untouched, into a "sidebyside" div holding a single -->
7105
+ <!-- "sbsrow" grid div. All layout (margins, column widths, column -->
7106
+ <!-- gap) is declared as CSS on the containers, so wrapping the -->
7107
+ <!-- panels as a unit is exactly the right granularity. Purely a -->
7108
+ <!-- container, never a target, so no xml:id in source, no HTML id -->
7109
+ <!-- on the div. -->
6949
7110
  <xsl:template match="sidebyside" mode="compose-panels">
6950
7111
  <xsl:param name="layout" />
6951
7112
  <xsl:param name="panels" />
@@ -7248,11 +7409,11 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
7248
7409
  <!-- this *must* be first for maximum utility -->
7249
7410
  <xsl:call-template name="skip-to-content-link" />
7250
7411
  <xsl:apply-templates select="." mode="latex-macros" />
7251
- <header id="ptx-masthead" class="ptx-masthead">
7412
+ <header id="ptx-masthead" class="ptx-masthead" role="banner">
7252
7413
  <div class="ptx-banner">
7253
7414
  <xsl:call-template name="brand-logo" />
7254
7415
  <div class="title-container">
7255
- <h1 class="heading">
7416
+ <div class="heading ptx-banner-heading">
7256
7417
  <xsl:variable name="root-filename">
7257
7418
  <xsl:apply-templates select="$document-root" mode="containing-filename" />
7258
7419
  </xsl:variable>
@@ -7270,7 +7431,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
7270
7431
  </span>
7271
7432
  </xsl:if>
7272
7433
  </a>
7273
- </h1>
7434
+ </div>
7274
7435
  <!-- Serial list of authors/editors -->
7275
7436
  <xsl:if test="$b-html-banner-byline">
7276
7437
  <p class="byline">
@@ -8429,9 +8590,9 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
8429
8590
  </xsl:template>
8430
8591
 
8431
8592
  <!-- The @id attribute of an HTML element is critical. -->
8432
- <!-- We supply the "visible-id". -->
8593
+ <!-- We supply the "unique-id". -->
8433
8594
  <xsl:template match="*" mode="html-id">
8434
- <xsl:apply-templates select="." mode="visible-id"/>
8595
+ <xsl:apply-templates select="." mode="unique-id"/>
8435
8596
  </xsl:template>
8436
8597
 
8437
8598
  <!-- And a convenience template to make an id attribute. -->
@@ -8452,9 +8613,9 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
8452
8613
  <!-- is banned in Javascript, so we make a "no-dash" version, -->
8453
8614
  <!-- by replacing a hyphen by a double-underscore. -->
8454
8615
  <!-- NB: This runs some non-zero probability of breaking uniqueness -->
8455
- <xsl:template match="*" mode="visible-id-no-dash">
8616
+ <xsl:template match="*" mode="unique-id-no-dash">
8456
8617
  <xsl:variable name="the-id">
8457
- <xsl:apply-templates select="." mode="visible-id" />
8618
+ <xsl:apply-templates select="." mode="unique-id" />
8458
8619
  </xsl:variable>
8459
8620
  <xsl:value-of select="str:replace($the-id, '-', '__')" />
8460
8621
  </xsl:template>
@@ -8688,56 +8849,6 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
8688
8849
  </s>
8689
8850
  </xsl:template>
8690
8851
 
8691
- <!-- Copyright symbol -->
8692
- <xsl:template name="copyright-character">
8693
- <xsl:text>&#xa9;</xsl:text>
8694
- </xsl:template>
8695
-
8696
- <!-- Phonomark symbol -->
8697
- <xsl:template name="phonomark-character">
8698
- <xsl:text>&#x2117;</xsl:text>
8699
- </xsl:template>
8700
-
8701
- <!-- Copyleft symbol -->
8702
- <!-- May not be universally available in fonts -->
8703
- <!-- Open C (U+254) plus Combining Circle (U+20dd) can imitate -->
8704
- <xsl:template name="copyleft-character">
8705
- <xsl:text>&#x1f12f;</xsl:text>
8706
- </xsl:template>
8707
-
8708
- <!-- Registered symbol -->
8709
- <!-- Bringhurst: should be superscript -->
8710
- <!-- We consider it a font mistake if not superscripted, -->
8711
- <!-- since if we use a "sup" tag then a correct font will -->
8712
- <!-- get way too small -->
8713
- <xsl:template name="registered-character">
8714
- <xsl:text>&#xae;</xsl:text>
8715
- </xsl:template>
8716
-
8717
- <!-- Trademark symbol -->
8718
- <xsl:template name="trademark-character">
8719
- <xsl:text>&#x2122;</xsl:text>
8720
- </xsl:template>
8721
-
8722
- <!-- Servicemark symbol -->
8723
- <xsl:template name="servicemark-character">
8724
- <xsl:text>&#x2120;</xsl:text>
8725
- </xsl:template>
8726
-
8727
- <!-- Degree -->
8728
- <xsl:template name="degree-character">
8729
- <xsl:text>&#xb0;</xsl:text>
8730
- </xsl:template>
8731
-
8732
- <!-- Prime -->
8733
- <xsl:template name="prime-character">
8734
- <xsl:text>&#x2032;</xsl:text>
8735
- </xsl:template>
8736
-
8737
- <xsl:template name="dblprime-character">
8738
- <xsl:text>&#x2033;</xsl:text>
8739
- </xsl:template>
8740
-
8741
8852
  <!-- Characters for Tagging Equations -->
8742
8853
 
8743
8854
  <!-- 'SIX POINTED BLACK STAR' (U+2736) -->
@@ -8774,7 +8885,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
8774
8885
  <!-- https://groups.google.com/forum/#!topic/mathjax-users/IEivs1D7ntM -->
8775
8886
  <xsl:template match="fillin[not(parent::m or parent::mrow)]">
8776
8887
  <xsl:choose>
8777
- <xsl:when test="ancestor::statement/../@exercise-interactive='fillin'">
8888
+ <xsl:when test="ancestor::statement/../@pi:exercise-interactive='fillin'">
8778
8889
  <xsl:apply-imports />
8779
8890
  </xsl:when>
8780
8891
  <xsl:otherwise>
@@ -9033,110 +9144,9 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
9033
9144
  </xsl:apply-templates>
9034
9145
  </xsl:template>
9035
9146
 
9036
- <!-- Left Double Bracket -->
9037
- <!-- MATHEMATICAL LEFT WHITE SQUARE BRACKET -->
9038
- <xsl:template name="ldblbracket-character">
9039
- <xsl:text>&#x27e6;</xsl:text>
9040
- </xsl:template>
9041
-
9042
- <!-- Right Double Bracket -->
9043
- <!-- MATHEMATICAL RIGHT WHITE SQUARE BRACKET -->
9044
- <xsl:template name="rdblbracket-character">
9045
- <xsl:text>&#x27e7;</xsl:text>
9046
- </xsl:template>
9047
-
9048
- <!-- Left Angle Bracket -->
9049
- <!-- LEFT ANGLE BRACKET -->
9050
- <!-- U+2329 was once used and caused a validator warning -->
9051
- <!-- "Text run is not in Unicode Normalization Form C" (NFC) -->
9052
- <xsl:template name="langle-character">
9053
- <xsl:text>&#x3008;</xsl:text>
9054
- </xsl:template>
9055
-
9056
- <!-- Right Angle Bracket -->
9057
- <!-- RIGHT ANGLE BRACKET -->
9058
- <!-- U+232A was once used and caused a validator warning -->
9059
- <!-- "Text run is not in Unicode Normalization Form C" (NFC) -->
9060
- <xsl:template name="rangle-character">
9061
- <xsl:text>&#x3009;</xsl:text>
9062
- </xsl:template>
9063
-
9064
9147
 
9065
9148
  <!-- Other Miscellaneous Symbols, Constructions -->
9066
9149
 
9067
- <!-- Ellipsis (dots), for text, not math -->
9068
- <xsl:template name="ellipsis-character">
9069
- <xsl:text>&#x2026;</xsl:text>
9070
- </xsl:template>
9071
-
9072
- <!-- Midpoint -->
9073
- <!-- A centered dot used sometimes like a decorative dash -->
9074
- <!-- Bringhurst: Not Unicode +387, "GREEK ANO TELEIA" -->
9075
- <xsl:template name="midpoint-character">
9076
- <xsl:text>&#xb7;</xsl:text>
9077
- </xsl:template>
9078
-
9079
- <!-- Swung Dash -->
9080
- <!-- A decorative dash, like a tilde, but bigger, and centered -->
9081
- <xsl:template name="swungdash-character">
9082
- <xsl:text>&#x2053;</xsl:text>
9083
- </xsl:template>
9084
-
9085
- <!-- Per Mille -->
9086
- <!-- Or, per thousand, like a percent sign -->
9087
- <xsl:template name="permille-character">
9088
- <xsl:text>&#x2030;</xsl:text>
9089
- </xsl:template>
9090
-
9091
- <!-- Pilcrow -->
9092
- <!-- Often used to mark the start of a paragraph -->
9093
- <xsl:template name="pilcrow-character">
9094
- <xsl:text>&#xb6;</xsl:text>
9095
- </xsl:template>
9096
-
9097
- <!-- Section Mark -->
9098
- <!-- The stylized double-S to indicate section numbers -->
9099
- <xsl:template name="section-mark-character">
9100
- <xsl:text>&#xa7;</xsl:text>
9101
- </xsl:template>
9102
-
9103
- <!-- Minus -->
9104
- <!-- A hyphen/dash for use in text as subtraction or negation-->
9105
- <xsl:template name="minus-character">
9106
- <xsl:text>&#x2212;</xsl:text>
9107
- </xsl:template>
9108
-
9109
- <!-- Times -->
9110
- <!-- A "multiplication sign" symbol for use in text -->
9111
- <!-- Styled to enhance, consensus at Google Group was -->
9112
- <!-- font-size: larger; vertical-align: -.2ex; -->
9113
- <xsl:template name="times-character">
9114
- <xsl:element name="span">
9115
- <xsl:attribute name="class">
9116
- <xsl:text>times-sign</xsl:text>
9117
- </xsl:attribute>
9118
- <xsl:text>&#xd7;</xsl:text>
9119
- </xsl:element>
9120
- </xsl:template>
9121
-
9122
- <!-- Solidus -->
9123
- <!-- Fraction bar, not as steep as a forward slash -->
9124
- <xsl:template name="solidus-character">
9125
- <xsl:text>&#x2044;</xsl:text>
9126
- </xsl:template>
9127
-
9128
- <!-- Obelus -->
9129
- <!-- A "division" symbol for use in text -->
9130
- <xsl:template name="obelus-character">
9131
- <xsl:text>&#xf7;</xsl:text>
9132
- </xsl:template>
9133
-
9134
- <!-- Plus/Minus -->
9135
- <!-- The combined symbol -->
9136
- <xsl:template name="plusminus-character">
9137
- <xsl:text>&#xb1;</xsl:text>
9138
- </xsl:template>
9139
-
9140
9150
  <!-- Foreign words/idioms -->
9141
9151
  <!-- Rutter, Web Typography, p.50 advocates a "span" with -->
9142
9152
  <!-- a "lang" attribute for foreign words so screen readers -->
@@ -9331,35 +9341,34 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
9331
9341
  <!-- Special Characters -->
9332
9342
  <!-- ################## -->
9333
9343
 
9334
- <!-- These are specific instances of abstract templates -->
9335
- <!-- See the similar section of pretext-common.xsl for more -->
9336
-
9337
- <!-- Non-breaking space, which "joins" two words as a unit -->
9338
- <!-- Using &nbsp; does not travel well into node-set() in common file -->
9339
- <!-- http://stackoverflow.com/questions/31870 -->
9340
- <!-- /using-a-html-entity-in-xslt-e-g-nbsp -->
9341
- <!-- Should create UTF-8 anyway: -->
9342
- <!-- https://html.spec.whatwg.org/multipage/semantics.html#charset -->
9344
+ <!-- Each character is the bare Unicode code point, read from the -->
9345
+ <!-- representation table in pretext-common.xsl; an exception -->
9346
+ <!-- needing markup overrides the modal template, per character -->
9343
9347
 
9344
- <xsl:template name="nbsp-character">
9345
- <xsl:text>&#xa0;</xsl:text>
9346
- </xsl:template>
9347
-
9348
- <xsl:template name="ndash-character">
9349
- <xsl:text>&#8211;</xsl:text>
9350
- </xsl:template>
9351
-
9352
- <xsl:template name="mdash-character">
9353
- <xsl:text>&#8212;</xsl:text>
9348
+ <xsl:template match="char" mode="character">
9349
+ <xsl:choose>
9350
+ <xsl:when test="@unicode">
9351
+ <xsl:value-of select="@unicode"/>
9352
+ </xsl:when>
9353
+ <xsl:otherwise>
9354
+ <xsl:call-template name="warn-unimplemented-character">
9355
+ <xsl:with-param name="char-name" select="@name"/>
9356
+ </xsl:call-template>
9357
+ </xsl:otherwise>
9358
+ </xsl:choose>
9354
9359
  </xsl:template>
9355
9360
 
9356
- <!-- The abstract template for "mdash" consults a publisher option -->
9357
- <!-- for thin space, or no space, surrounding an em-dash. So the -->
9358
- <!-- "thin-space-character" is needed for that purpose, and does -->
9359
- <!-- not have an associated empty PTX element. -->
9360
-
9361
- <xsl:template name="thin-space-character">
9362
- <xsl:text>&#8201;</xsl:text>
9361
+ <!-- Times -->
9362
+ <!-- A "multiplication sign" symbol for use in text -->
9363
+ <!-- Styled to enhance, consensus at Google Group was -->
9364
+ <!-- font-size: larger; vertical-align: -.2ex; -->
9365
+ <xsl:template match="char[@name = 'times']" mode="character">
9366
+ <xsl:element name="span">
9367
+ <xsl:attribute name="class">
9368
+ <xsl:text>times-sign</xsl:text>
9369
+ </xsl:attribute>
9370
+ <xsl:text>&#xd7;</xsl:text>
9371
+ </xsl:element>
9363
9372
  </xsl:template>
9364
9373
 
9365
9374
  <!-- -->
@@ -9464,7 +9473,9 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
9464
9473
  <xsl:template match="fragref">
9465
9474
  <xsl:variable name="target" select="id(@ref)"/>
9466
9475
  <span>
9467
- <xsl:call-template name="langle-character"/>
9476
+ <xsl:call-template name="character">
9477
+ <xsl:with-param name="name" select="'langle'"/>
9478
+ </xsl:call-template>
9468
9479
  <xsl:apply-templates select="." mode="xref-link">
9469
9480
  <xsl:with-param name="target" select="$target" />
9470
9481
  <!-- "fragref" is isomorpic to "xref" as a link -->
@@ -9475,7 +9486,9 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
9475
9486
  </xsl:apply-templates>
9476
9487
  <xsl:text> </xsl:text>
9477
9488
  <xsl:apply-templates select="$target" mode="number"/>
9478
- <xsl:call-template name="rangle-character"/>
9489
+ <xsl:call-template name="character">
9490
+ <xsl:with-param name="name" select="'rangle'"/>
9491
+ </xsl:call-template>
9479
9492
  </span>
9480
9493
  <br/>
9481
9494
  </xsl:template>
@@ -9836,14 +9849,12 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
9836
9849
  </xsl:apply-templates>
9837
9850
  <!-- (2) Identical content, but now isolated on a reader-friendly page -->
9838
9851
  <!-- (we skip this for portable html) -->
9839
- <!-- The standalone page has its own masthead h1, so headings inside -->
9840
- <!-- start fresh at h2. -->
9841
9852
  <xsl:if test="not($b-portable-html)">
9842
9853
  <xsl:apply-templates select="." mode="standalone-page" >
9843
9854
  <xsl:with-param name="content">
9844
9855
  <xsl:apply-templates select="." mode="interactive-core">
9845
9856
  <xsl:with-param name="is-standalone" select="true()"/>
9846
- <xsl:with-param name="heading-level" select="2"/>
9857
+ <xsl:with-param name="heading-level" select="1"/>
9847
9858
  </xsl:apply-templates>
9848
9859
  </xsl:with-param>
9849
9860
  </xsl:apply-templates>
@@ -9863,7 +9874,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
9863
9874
  <!-- We want to recognize an "interactive" authored -->
9864
9875
  <!-- in an "exercise" (or similar) which originated -->
9865
9876
  <!-- from a "dual" dynamic/static exercise. -->
9866
- <xsl:variable name="b-in-dual-exercise" select="ancestor::*[@exercise-interactive = 'dual']"/>
9877
+ <xsl:variable name="b-in-dual-exercise" select="ancestor::*[@pi:exercise-interactive = 'dual']"/>
9867
9878
  <xsl:choose>
9868
9879
  <!-- A DoenetML interactive lives two lives. Plain 'ol PreTeXt, -->
9869
9880
  <!-- supported by a Doenet CDN for its interactivity. But when -->
@@ -10318,11 +10329,32 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
10318
10329
  </canvas>
10319
10330
  </xsl:template>
10320
10331
 
10321
- <!-- HTML Code -->
10322
- <!-- Simply create deep-copy of HTML elements -->
10323
- <!-- TODO: should this be a div, with width and height? -->
10332
+ <!-- HTML Code -->
10333
+ <!-- Simply create deep-copy of HTML elements -->
10334
+ <!-- TODO: should this be a div, with width and height? -->
10335
+ <!-- Authored HTML goes into the page verbatim. But a plain -->
10336
+ <!-- "xsl:copy-of" materializes every namespace in scope at the -->
10337
+ <!-- source location as a declaration on the copy: the source -->
10338
+ <!-- file's own declarations (such as XInclude) and any -->
10339
+ <!-- namespace employed by the assembly machinery. So instead -->
10340
+ <!-- we rebuild each element, which carries along only the -->
10341
+ <!-- namespaces actually in use. -->
10324
10342
  <xsl:template match="slate[@surface = 'html']">
10325
- <xsl:copy-of select="*" />
10343
+ <xsl:apply-templates select="*" mode="copy-authored-html"/>
10344
+ </xsl:template>
10345
+
10346
+ <!-- Attributes in the internal namespace are the assembly's -->
10347
+ <!-- identification stamps, not the author's work, so they stay -->
10348
+ <!-- out of the copy. -->
10349
+ <xsl:template match="*" mode="copy-authored-html">
10350
+ <xsl:element name="{name()}" namespace="{namespace-uri()}">
10351
+ <xsl:copy-of select="@*[namespace-uri(.) != 'http://pretextbook.org/2020/pretext/internal']"/>
10352
+ <xsl:apply-templates select="node()" mode="copy-authored-html"/>
10353
+ </xsl:element>
10354
+ </xsl:template>
10355
+
10356
+ <xsl:template match="text()|comment()|processing-instruction()" mode="copy-authored-html">
10357
+ <xsl:copy/>
10326
10358
  </xsl:template>
10327
10359
 
10328
10360
  <!-- Similar to the "div" surface, but with class information -->
@@ -10386,7 +10418,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
10386
10418
  <!-- ensure identifier does not lead with a digit, so "ggb_". -->
10387
10419
  <xsl:variable name="applet-name">
10388
10420
  <xsl:text>ggb_</xsl:text>
10389
- <xsl:apply-templates select="." mode="visible-id-no-dash" />
10421
+ <xsl:apply-templates select="." mode="unique-id-no-dash" />
10390
10422
  </xsl:variable>
10391
10423
  <!-- And a Javascript identifier for the parameters -->
10392
10424
  <xsl:variable name="applet-parameters">
@@ -10406,7 +10438,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
10406
10438
  </xsl:variable>
10407
10439
  <!-- And an HTML unique identifier -->
10408
10440
  <xsl:variable name="applet-container">
10409
- <xsl:apply-templates select="." mode="visible-id" />
10441
+ <xsl:apply-templates select="." mode="unique-id" />
10410
10442
  <xsl:text>-container</xsl:text>
10411
10443
  </xsl:variable>
10412
10444
  <!-- Javascript API for loading GeoGebra -->
@@ -10462,7 +10494,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
10462
10494
  <xsl:text>",&#xa;</xsl:text>
10463
10495
  </xsl:when>
10464
10496
  <xsl:when test="@geogebra">
10465
- <xsl:message>PTX Warning: "geogebra" attribute on "slate" element is deprecated; use "material" attribute</xsl:message>
10497
+ <xsl:message>PTX:DEPRECATE: "geogebra" attribute on "slate" element is deprecated; use "material" attribute</xsl:message>
10466
10498
  <xsl:text>material_id:"</xsl:text>
10467
10499
  <xsl:value-of select="@geogebra" />
10468
10500
  <xsl:text>",&#xa;</xsl:text>
@@ -10586,7 +10618,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
10586
10618
  <!-- the div that jsxgraph will take over -->
10587
10619
  <xsl:element name="div">
10588
10620
  <xsl:attribute name="id">
10589
- <xsl:apply-templates select="." mode="visible-id" />
10621
+ <xsl:apply-templates select="." mode="unique-id" />
10590
10622
  </xsl:attribute>
10591
10623
  <xsl:attribute name="class">
10592
10624
  <xsl:text>jxgbox</xsl:text>
@@ -10602,7 +10634,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
10602
10634
  </xsl:attribute>
10603
10635
  <!-- Put the board in the appropriate container. -->
10604
10636
  <xsl:attribute name="container">
10605
- <xsl:apply-templates select="." mode="visible-id" />
10637
+ <xsl:apply-templates select="." mode="unique-id" />
10606
10638
  </xsl:attribute>
10607
10639
  <xsl:if test="@boundingbox">
10608
10640
  <xsl:attribute name="boundingbox">
@@ -10632,7 +10664,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
10632
10664
  </xsl:attribute>
10633
10665
  <xsl:text>function parseJessie(code) {&#xa;</xsl:text>
10634
10666
  <xsl:text> let board = JXG.JSXGraph.initBoard('</xsl:text>
10635
- <xsl:apply-templates select="." mode="visible-id" />
10667
+ <xsl:apply-templates select="." mode="unique-id" />
10636
10668
  <xsl:text>', {</xsl:text>
10637
10669
  <xsl:if test="@boundingbox">
10638
10670
  <xsl:text>boundingbox:[</xsl:text>
@@ -10900,7 +10932,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
10900
10932
  </xsl:template>
10901
10933
 
10902
10934
  <xsl:template match="interactive" mode="get-resize-behavior">
10903
- <xsl:variable name="platform" select="@interactive-platform"/>
10935
+ <xsl:variable name="platform" select="@pi:interactive-platform"/>
10904
10936
  <xsl:choose>
10905
10937
  <xsl:when test="@resize-behavior != ''">
10906
10938
  <xsl:value-of select="@resize-behavior"/>
@@ -11000,7 +11032,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
11000
11032
  <!-- the div to hold the JSX output -->
11001
11033
  <xsl:element name="div">
11002
11034
  <xsl:attribute name="id">
11003
- <xsl:apply-templates select="." mode="visible-id" />
11035
+ <xsl:apply-templates select="." mode="unique-id" />
11004
11036
  </xsl:attribute>
11005
11037
  <xsl:attribute name="class">
11006
11038
  <xsl:text>jxgbox</xsl:text>
@@ -11108,10 +11140,10 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
11108
11140
  <!-- (or PROJECT-LIKE). So in this case (only) we place -->
11109
11141
  <!-- an id value on the div.exercise-wrapper that is -->
11110
11142
  <!-- derived from the parent. Otherwise, we use the -->
11111
- <!-- parent @assembly-id with a "-ww-inner" suffix. -->
11143
+ <!-- parent @pi:assembly-id with a "-ww-inner" suffix. -->
11112
11144
  <!-- The suffix ensures the inner wrapper's DOM id is -->
11113
11145
  <!-- distinct from the enclosing "exercise" article's -->
11114
- <!-- id (which also holds the @assembly-id value). -->
11146
+ <!-- id (which also holds the @pi:assembly-id value). -->
11115
11147
  <!-- Without the suffix, JavaScript (handleWW) would -->
11116
11148
  <!-- look up the inner id with getElementById and find -->
11117
11149
  <!-- the outer "exercise" article instead. -->
@@ -11122,7 +11154,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
11122
11154
  <xsl:text>-ww-rs</xsl:text>
11123
11155
  </xsl:when>
11124
11156
  <xsl:otherwise>
11125
- <xsl:value-of select="concat(@assembly-id, '-ww-inner')"/>
11157
+ <xsl:value-of select="concat(@pi:assembly-id, '-ww-inner')"/>
11126
11158
  </xsl:otherwise>
11127
11159
  </xsl:choose>
11128
11160
  </xsl:variable>
@@ -11270,7 +11302,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
11270
11302
  </xsl:variable>
11271
11303
  <!-- build the iframe -->
11272
11304
  <!-- mimicking Mike Gage's blog post -->
11273
- <iframe name="{concat(@assembly-id, '-ww-inner')}" width="{$design-width}" src="{$the-url}" data-seed="{static/@seed}"/>
11305
+ <iframe name="{concat(@pi:assembly-id, '-ww-inner')}" width="{$design-width}" src="{$the-url}" data-seed="{static/@seed}"/>
11274
11306
  <script>
11275
11307
  <xsl:text>iFrameResize({log:true,inPageLinks:true,resizeFrom:'child',checkOrigin:["</xsl:text>
11276
11308
  <xsl:value-of select="$webwork-server" />
@@ -11523,11 +11555,15 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
11523
11555
  <!-- this *must* be first for maximum utility -->
11524
11556
  <xsl:call-template name="skip-to-content-link" />
11525
11557
  <!-- HTML5 body/header will be a "banner" landmark automatically -->
11526
- <header id="ptx-masthead" class="ptx-masthead">
11558
+ <header id="ptx-masthead" class="ptx-masthead" role="banner">
11527
11559
  <div class="ptx-banner">
11528
11560
  <xsl:call-template name="brand-logo" />
11529
11561
  <div class="title-container">
11530
- <h1 class="heading">
11562
+ <xsl:variable name="banner-heading-element-type">
11563
+ <xsl:apply-templates select="." mode="banner-heading-element-type"/>
11564
+ </xsl:variable>
11565
+ <xsl:element name="{$banner-heading-element-type}">
11566
+ <xsl:attribute name="class">heading ptx-banner-heading</xsl:attribute>
11531
11567
  <xsl:variable name="root-filename">
11532
11568
  <xsl:apply-templates select="$document-root" mode="containing-filename" />
11533
11569
  </xsl:variable>
@@ -11545,7 +11581,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
11545
11581
  </span>
11546
11582
  </xsl:if>
11547
11583
  </a>
11548
- </h1>
11584
+ </xsl:element>
11549
11585
  <!-- Serial list of authors/editors -->
11550
11586
  <xsl:if test="$b-html-banner-byline">
11551
11587
  <p class="byline">
@@ -11554,7 +11590,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
11554
11590
  </p>
11555
11591
  </xsl:if>
11556
11592
  </div> <!-- title-container -->
11557
- </div> <!-- banner -->
11593
+ </div> <!-- banner -->
11558
11594
  </header> <!-- masthead -->
11559
11595
  <xsl:apply-templates select="." mode="primary-navigation"/>
11560
11596
  <xsl:apply-templates select="." mode="latex-macros"/>
@@ -11618,6 +11654,24 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
11618
11654
  </exsl:document>
11619
11655
  </xsl:template>
11620
11656
 
11657
+ <!-- Most pages get a plain div for the banner title element as content will have an h1 -->
11658
+ <xsl:template match="*" mode="banner-heading-element-type">
11659
+ <xsl:text>div</xsl:text>
11660
+ </xsl:template>
11661
+
11662
+ <!-- Root page for a single page document needs h1 as the banner title element -->
11663
+ <!-- as there will not be on in page contents. -->
11664
+ <xsl:template match="book|article" mode="banner-heading-element-type">
11665
+ <xsl:choose>
11666
+ <xsl:when test="$b-is-single-page">
11667
+ <xsl:text>h1</xsl:text>
11668
+ </xsl:when>
11669
+ <xsl:otherwise>
11670
+ <xsl:text>div</xsl:text>
11671
+ </xsl:otherwise>
11672
+ </xsl:choose>
11673
+ </xsl:template>
11674
+
11621
11675
  <!-- Templates that can be overriden to inject into various -->
11622
11676
  <!-- points in the HTML page. See file-wrap above for locations. -->
11623
11677
  <xsl:template match="*" mode="file-wrap-head-pre"/>
@@ -11632,7 +11686,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
11632
11686
  <xsl:param name="content" />
11633
11687
  <xsl:variable name="filename">
11634
11688
  <!-- do not use "containing-filename" may be different -->
11635
- <xsl:apply-templates select="." mode="visible-id" />
11689
+ <xsl:apply-templates select="." mode="unique-id" />
11636
11690
  <text>.html</text>
11637
11691
  </xsl:variable>
11638
11692
  <exsl:document href="{$filename}" method="html" indent="yes" encoding="UTF-8" doctype-system="about:legacy-compat">
@@ -11906,15 +11960,25 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
11906
11960
 
11907
11961
  <!-- TODO: perhaps isolate logic to return nodes and put into "common" -->
11908
11962
 
11963
+ <!-- Is a node a unit of the linear page order? The structural -->
11964
+ <!-- nodes are; so is a division companion realized as a page -->
11965
+ <xsl:template match="*" mode="is-linear-unit">
11966
+ <xsl:apply-templates select="." mode="is-structural"/>
11967
+ </xsl:template>
11968
+
11969
+ <xsl:template match="&DIVISION-COMPANION;" mode="is-linear-unit">
11970
+ <xsl:apply-templates select="." mode="is-chunk"/>
11971
+ </xsl:template>
11972
+
11909
11973
  <!-- Check if the XML tree has a preceding/following/parent node -->
11910
- <!-- Then check if it is a document node (structural) -->
11974
+ <!-- Then check if it is a page of the reading order -->
11911
11975
  <!-- If so, compute the URL for the node -->
11912
11976
  <!-- NB: tree urls maybe enabled as a processing option -->
11913
11977
  <xsl:template match="*" mode="previous-tree-url">
11914
11978
  <xsl:if test="preceding-sibling::*">
11915
11979
  <xsl:variable name="preceding" select="preceding-sibling::*[1]" />
11916
11980
  <xsl:variable name="structural">
11917
- <xsl:apply-templates select="$preceding" mode="is-structural" />
11981
+ <xsl:apply-templates select="$preceding" mode="is-linear-unit" />
11918
11982
  </xsl:variable>
11919
11983
  <xsl:if test="$structural='true'">
11920
11984
  <xsl:apply-templates select="$preceding" mode="url" />
@@ -11927,7 +11991,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
11927
11991
  <xsl:if test="following-sibling::*">
11928
11992
  <xsl:variable name="following" select="following-sibling::*[1]" />
11929
11993
  <xsl:variable name="structural">
11930
- <xsl:apply-templates select="$following" mode="is-structural" />
11994
+ <xsl:apply-templates select="$following" mode="is-linear-unit" />
11931
11995
  </xsl:variable>
11932
11996
  <xsl:if test="$structural='true'">
11933
11997
  <xsl:apply-templates select="$following" mode="url" />
@@ -11965,11 +12029,11 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
11965
12029
  <xsl:choose>
11966
12030
  <xsl:when test="$intermediate='true'">
11967
12031
  <!-- Descend once, will always have a child that is structural -->
11968
- <xsl:variable name="first-structural-child" select="*[&STRUCTURAL-FILTER;][1]" />
12032
+ <xsl:variable name="first-structural-child" select="*[&STRUCTURAL-FILTER; or ($b-division-companion-chunks and (&DIVISION-COMPANION-FILTER;))][1]" />
11969
12033
  <xsl:apply-templates select="$first-structural-child" mode="url" />
11970
12034
  <!-- remainder is a basic check, could be removed -->
11971
12035
  <xsl:variable name="structural">
11972
- <xsl:apply-templates select="$first-structural-child" mode="is-structural" />
12036
+ <xsl:apply-templates select="$first-structural-child" mode="is-linear-unit" />
11973
12037
  </xsl:variable>
11974
12038
  <xsl:if test="$structural='false'">
11975
12039
  <xsl:message>PTX:ERROR: descending into first node of an intermediate page (<xsl:value-of select="local-name($first-structural-child)" />) that is non-structural; maybe your source has incorrect structure</xsl:message>
@@ -11990,7 +12054,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
11990
12054
  <xsl:if test="following-sibling::*">
11991
12055
  <xsl:variable name="following" select="following-sibling::*[1]" />
11992
12056
  <xsl:variable name="structural">
11993
- <xsl:apply-templates select="$following" mode="is-structural" />
12057
+ <xsl:apply-templates select="$following" mode="is-linear-unit" />
11994
12058
  </xsl:variable>
11995
12059
  <xsl:if test="$structural='true'">
11996
12060
  <!-- A normal sibling following -->
@@ -12024,7 +12088,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
12024
12088
  <xsl:if test="preceding-sibling::*">
12025
12089
  <xsl:variable name="preceding" select="preceding-sibling::*[1]" />
12026
12090
  <xsl:variable name="structural">
12027
- <xsl:apply-templates select="$preceding" mode="is-structural" />
12091
+ <xsl:apply-templates select="$preceding" mode="is-linear-unit" />
12028
12092
  </xsl:variable>
12029
12093
  <xsl:if test="$structural='true'">
12030
12094
  <!-- A normal sibling precedin, result is just a sentinel-->
@@ -12064,11 +12128,11 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
12064
12128
  <xsl:apply-templates select="." mode="url" />
12065
12129
  </xsl:when>
12066
12130
  <xsl:otherwise>
12067
- <xsl:variable name="last-structural-child" select="*[&STRUCTURAL-FILTER;][last()]" />
12131
+ <xsl:variable name="last-structural-child" select="*[&STRUCTURAL-FILTER; or ($b-division-companion-chunks and (&DIVISION-COMPANION-FILTER;))][last()]" />
12068
12132
  <xsl:apply-templates select="$last-structural-child" mode="previous-descent-url" />
12069
12133
  <!-- remainder is a basic check, could be removed -->
12070
12134
  <xsl:variable name="structural">
12071
- <xsl:apply-templates select="$last-structural-child" mode="is-structural" />
12135
+ <xsl:apply-templates select="$last-structural-child" mode="is-linear-unit" />
12072
12136
  </xsl:variable>
12073
12137
  <xsl:if test="$structural='false'">
12074
12138
  <xsl:message>PTX:ERROR: descending into last node of an intermediate page (<xsl:value-of select="local-name($last-structural-child)" />) that is non-structural</xsl:message>
@@ -12926,6 +12990,35 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
12926
12990
  </li>
12927
12991
  </xsl:template>
12928
12992
 
12993
+ <!-- A division companion earns a ToC entry when it is a page -->
12994
+ <xsl:template match="&DIVISION-COMPANION;" mode="toc-item">
12995
+ <xsl:variable name="chunk">
12996
+ <xsl:apply-templates select="." mode="is-chunk"/>
12997
+ </xsl:variable>
12998
+ <xsl:if test="$chunk = 'true'">
12999
+ <xsl:variable name="the-url">
13000
+ <xsl:apply-templates select="." mode="url"/>
13001
+ </xsl:variable>
13002
+ <li>
13003
+ <xsl:attribute name="class">
13004
+ <xsl:text>toc-item toc-</xsl:text>
13005
+ <xsl:value-of select="local-name()"/>
13006
+ </xsl:attribute>
13007
+ <!-- copy id of this li for use in customization pass -->
13008
+ <xsl:attribute name="uid">
13009
+ <xsl:value-of select="@pi:unique-id"/>
13010
+ </xsl:attribute>
13011
+ <div class="toc-title-box">
13012
+ <a href="{$the-url}" class="internal">
13013
+ <span class="title">
13014
+ <xsl:apply-templates select="." mode="division-companion-text"/>
13015
+ </span>
13016
+ </a>
13017
+ </div>
13018
+ </li>
13019
+ </xsl:if>
13020
+ </xsl:template>
13021
+
12929
13022
  <!-- Recurse through un-interesting elements -->
12930
13023
  <!-- NB: pass along current page -->
12931
13024
  <!-- Will pickup blocks, etc on unstructured divisions while picking up specialized divisions -->
@@ -12947,7 +13040,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
12947
13040
  </xsl:attribute>
12948
13041
  <!-- copy id of this li for use in customization pass, will remove there -->
12949
13042
  <xsl:attribute name="uid">
12950
- <xsl:value-of select="@unique-id"/>
13043
+ <xsl:value-of select="@pi:unique-id"/>
12951
13044
  </xsl:attribute>
12952
13045
  <div class="toc-title-box">
12953
13046
  <a href="{$the-url}" class="internal">
@@ -12975,7 +13068,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
12975
13068
  <xsl:variable name="toc-contents" select="exsl:node-set($toc-contents-rtf)"/>
12976
13069
 
12977
13070
  <!-- get the unique id of the current page -->
12978
- <xsl:variable name="uid" select="@unique-id"/>
13071
+ <xsl:variable name="uid" select="@pi:unique-id"/>
12979
13072
  <!-- use that to find the ToC node for that page -->
12980
13073
  <xsl:variable name="this-page-node" select="$toc-contents//*[@uid = $uid]"/>
12981
13074
  <!-- ancestor list will allow us to identify when we are in the path to the page -->
@@ -14473,7 +14566,9 @@ TODO:
14473
14566
  </a>
14474
14567
  </xsl:when>
14475
14568
  <xsl:otherwise>
14569
+ <span id="logo-link" class="logo-link">
14476
14570
  <img src="{$location}" alt="Logo image"/>
14571
+ </span>
14477
14572
  </xsl:otherwise>
14478
14573
  </xsl:choose>
14479
14574
  </xsl:if>
@@ -14599,7 +14694,7 @@ TODO:
14599
14694
  <!-- We put page-margins-attributes only on printout sections -->
14600
14695
  <xsl:template match="*" mode="page-margins-attribute"/>
14601
14696
 
14602
- <xsl:template match="worksheet|handout" mode="page-margins-attribute">
14697
+ <xsl:template match="&PRINTOUT;" mode="page-margins-attribute">
14603
14698
  <xsl:attribute name="data-margins">
14604
14699
  <!-- A space-separated list for top, right, bottom, and left margins -->
14605
14700
  <xsl:apply-templates select="." mode="printout-margin">
@@ -14627,7 +14722,7 @@ TODO:
14627
14722
  <!-- Add data-* attributes for headers and footers -->
14628
14723
  <xsl:template match="*" mode="page-header-footer-attributes"/>
14629
14724
 
14630
- <xsl:template match="worksheet|handout" mode="page-header-footer-attributes">
14725
+ <xsl:template match="&PRINTOUT;" mode="page-header-footer-attributes">
14631
14726
  <xsl:if test="not($ws-header-first-left = '')">
14632
14727
  <xsl:attribute name="data-header-first-left">
14633
14728
  <xsl:value-of select="normalize-space($ws-header-first-left)"/>