@pretextbook/pretext-html 0.16.0 → 0.17.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 (60) hide show
  1. package/README.md +77 -3
  2. package/assets/preview-html.xsl +56 -0
  3. package/assets/upstream.json +2 -2
  4. package/assets/xsl/entities.ent +14 -1
  5. package/assets/xsl/latex/pretext-latex-texstyle.xsl +5 -2
  6. package/assets/xsl/localizations/README.md +1 -1
  7. package/assets/xsl/localizations/af-ZA.xml +5 -6
  8. package/assets/xsl/localizations/bg-BG.xml +5 -6
  9. package/assets/xsl/localizations/ca-ES.xml +5 -6
  10. package/assets/xsl/localizations/cs-CZ.xml +5 -6
  11. package/assets/xsl/localizations/de-DE.xml +108 -108
  12. package/assets/xsl/localizations/en-US.xml +18 -17
  13. package/assets/xsl/localizations/es-ES.xml +5 -6
  14. package/assets/xsl/localizations/fi-FI.xml +5 -6
  15. package/assets/xsl/localizations/fr-CA.xml +5 -6
  16. package/assets/xsl/localizations/fr-FR.xml +5 -6
  17. package/assets/xsl/localizations/hu-HU.xml +5 -6
  18. package/assets/xsl/localizations/it-IT.xml +7 -7
  19. package/assets/xsl/localizations/ku-CKB.xml +5 -6
  20. package/assets/xsl/localizations/nl-NL.xml +5 -6
  21. package/assets/xsl/localizations/pt-BR.xml +4 -5
  22. package/assets/xsl/localizations/pt-PT.xml +4 -5
  23. package/assets/xsl/localizations/zh-HANS.xml +5 -6
  24. package/assets/xsl/pretext-assembly.xsl +154 -29
  25. package/assets/xsl/pretext-beamer.xsl +112 -10
  26. package/assets/xsl/pretext-braille-preprint.xsl +22 -3
  27. package/assets/xsl/pretext-common.xsl +117 -42
  28. package/assets/xsl/pretext-epub.xsl +74 -87
  29. package/assets/xsl/pretext-fo.xsl +115 -41
  30. package/assets/xsl/pretext-html.xsl +333 -102
  31. package/assets/xsl/pretext-latex-classic.xsl +48 -35
  32. package/assets/xsl/pretext-latex-common.xsl +160 -98
  33. package/assets/xsl/pretext-latex.xsl +12 -10
  34. package/assets/xsl/pretext-markdown.xsl +5 -3
  35. package/assets/xsl/pretext-numbers.xsl +28 -2
  36. package/assets/xsl/pretext-revealjs.xsl +44 -2
  37. package/assets/xsl/pretext-runestone-static.xsl +27 -4
  38. package/assets/xsl/pretext-runestone.xsl +112 -0
  39. package/assets/xsl/pretext-text.xsl +21 -14
  40. package/assets/xsl/publisher-variables.xsl +187 -47
  41. package/assets/xsl/support/extract-math.xsl +22 -2
  42. package/assets/xsl/support/package-math.xsl +9 -8
  43. package/assets/xsl/utilities/report-publisher-variables.xsl +4 -0
  44. package/assets/xsl-bundle.json +1 -1
  45. package/dist/cli-C0JwLhuv.js +1456 -0
  46. package/dist/cli.js +3 -3
  47. package/dist/html-static.d.ts +2 -2
  48. package/dist/index.browser.d.ts +9 -4
  49. package/dist/index.browser.js +1151 -841
  50. package/dist/index.d.ts +9 -3
  51. package/dist/index.js +50 -46
  52. package/dist/publication.d.ts +21 -0
  53. package/dist/renderer.d.ts +134 -13
  54. package/dist/skeleton.d.ts +68 -7
  55. package/dist/source-cache.d.ts +36 -0
  56. package/dist/sourcemap.d.ts +11 -1
  57. package/dist/subtree.d.ts +79 -0
  58. package/dist/xinclude.d.ts +40 -3
  59. package/package.json +1 -1
  60. package/dist/cli-ox-z2TCZ.js +0 -1145
@@ -358,6 +358,14 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
358
358
  <xsl:text>)</xsl:text>
359
359
  </xsl:template>
360
360
 
361
+ <!-- A "figure" may also stack subfigures vertically: a "stack" -->
362
+ <!-- holding only "figure", each subnumbered in the same way -->
363
+ <xsl:template match="figure/stack/figure" mode="serial-number">
364
+ <xsl:text>(</xsl:text>
365
+ <xsl:number format="a" count="figure"/>
366
+ <xsl:text>)</xsl:text>
367
+ </xsl:template>
368
+
361
369
  <!-- Serial Numbers: List Items -->
362
370
 
363
371
  <!-- First, the number of a list item within its own ordered list. This -->
@@ -586,6 +594,13 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
586
594
  <xsl:value-of select="@pi:struct"/>
587
595
  </xsl:template>
588
596
 
597
+ <!-- Structure Numbers: Slides -->
598
+ <!-- The number of the "section" holding a slide, or empty, as -->
599
+ <!-- decided in assembly by the numbering level of divisions -->
600
+ <xsl:template match="slide" mode="structure-number">
601
+ <xsl:value-of select="@pi:struct"/>
602
+ </xsl:template>
603
+
589
604
  <!-- Structure Numbers: Specialized Divisions -->
590
605
  <!-- Some divisions get their numbers from their parents, or -->
591
606
  <!-- in other ways. We are careful to do this by determining -->
@@ -669,6 +684,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
669
684
  <xsl:template match="figure/sbsgroup/sidebyside/figure | figure/sbsgroup/sidebyside/table | figure/sbsgroup/sidebyside/listing | figure/sbsgroup/sidebyside/list" mode="structure-number">
670
685
  <xsl:apply-templates select="parent::sidebyside/parent::sbsgroup/parent::figure" mode="number" />
671
686
  </xsl:template>
687
+ <xsl:template match="figure/stack/figure" mode="structure-number">
688
+ <xsl:apply-templates select="parent::stack/parent::figure" mode="number" />
689
+ </xsl:template>
672
690
 
673
691
  <!-- Structure Numbers: Equations -->
674
692
  <!-- "mrow" may be numbered, and bare "md" inherit a number from their -->
@@ -842,11 +860,12 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
842
860
  <xsl:text>:</xsl:text>
843
861
  </xsl:when>
844
862
  <!-- A figure-like inside a sidebyside (or -->
845
- <!-- sbsgroup) inside a figure is subnumbered -->
863
+ <!-- sbsgroup) inside a figure, or a figure in -->
864
+ <!-- a stack inside a figure, is subnumbered -->
846
865
  <!-- with a letter like "(a)", so the serial -->
847
866
  <!-- number already carries its own delimiter -->
848
867
  <!-- and no period separator is needed. -->
849
- <xsl:when test="(&FIGURE-FILTER;) and (parent::sidebyside/parent::figure or parent::sidebyside/parent::sbsgroup/parent::figure)"/>
868
+ <xsl:when test="(&FIGURE-FILTER;) and (parent::sidebyside/parent::figure or parent::sidebyside/parent::sbsgroup/parent::figure or self::figure[parent::stack/parent::figure])"/>
850
869
  <xsl:otherwise>
851
870
  <xsl:text>.</xsl:text>
852
871
  </xsl:otherwise>
@@ -878,6 +897,13 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
878
897
  </xsl:choose>
879
898
  </xsl:template>
880
899
 
900
+ <!-- Serial Numbers: Slides -->
901
+ <!-- Assembly counts every slide, through the slideshow or -->
902
+ <!-- within a section, by the numbering level of divisions -->
903
+ <xsl:template match="slide" mode="serial-number">
904
+ <xsl:value-of select="@pi:serial"/>
905
+ </xsl:template>
906
+
881
907
  <!-- Serial Numbers: Specialized Divisions -->
882
908
  <xsl:template match="exercises|solutions|worksheet|handout|reading-questions|references|glossary" mode="serial-number">
883
909
  <xsl:variable name="is-numbered">
@@ -66,6 +66,22 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
66
66
  <xsl:variable name="math-repr" select="document($mathfile)/pi:math-representations"/>
67
67
  <xsl:variable name="speech-repr" select="document($speechfile)/pi:math-representations"/>
68
68
 
69
+ <!-- Embedded mathematics is extracted as SVG with clause-ending -->
70
+ <!-- punctuation absorbed into display mathematics only, so the -->
71
+ <!-- text after inline mathematics must keep its punctuation. This -->
72
+ <!-- overrides the HTML value, which absorbs punctuation into all -->
73
+ <!-- mathematics, as MathJax does for online mathematics. -->
74
+ <xsl:variable name="math.punctuation.include">
75
+ <xsl:choose>
76
+ <xsl:when test="$b-reveal-embedded-math">
77
+ <xsl:text>display</xsl:text>
78
+ </xsl:when>
79
+ <xsl:otherwise>
80
+ <xsl:text>all</xsl:text>
81
+ </xsl:otherwise>
82
+ </xsl:choose>
83
+ </xsl:variable>
84
+
69
85
  <!-- Reveal.js output is one monolithic page, so heading levels are -->
70
86
  <!-- threaded, not chunked. The slideshow title (h1) and subtitle -->
71
87
  <!-- (h2) are fixed. A "section" is always level 2 (sections never -->
@@ -178,6 +194,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
178
194
  <xsl:text>.reveal .slides section.valign-top { top: 0 !important; }&#xa;</xsl:text>
179
195
  <xsl:text>.reveal .slides section.valign-middle.present { display: flex !important; flex-direction: column; justify-content: center; top: 0 !important; height: 100% !important; }&#xa;</xsl:text>
180
196
  <xsl:text>.reveal .slides section.valign-bottom.present { display: flex !important; flex-direction: column; justify-content: flex-end; top: 0 !important; height: 100% !important; }&#xa;</xsl:text>
197
+ <!-- A slide without a number still gets the number's box, -->
198
+ <!-- which reveal.js displays with an inline style -->
199
+ <xsl:if test="$b-reveal-slide-numbering">
200
+ <xsl:text>.reveal .slide-number:has(.slide-number-a:empty) { display: none !important; }&#xa;</xsl:text>
201
+ </xsl:if>
181
202
  </style>
182
203
  <!-- no diagcess machinery with embedded mathematics: an -->
183
204
  <!-- annotated PreFigure diagram is then a static image -->
@@ -251,6 +272,20 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
251
272
  <xsl:value-of select="$reveal-navigation-mode"/>
252
273
  <xsl:text>',&#xa;</xsl:text>
253
274
  <xsl:text> progress: false,&#xa;</xsl:text>
275
+ <!-- reveal.js displays what this function returns, so a -->
276
+ <!-- slide shows the number PreTeXt computed for it, the -->
277
+ <!-- same in every navigation mode, and any other slide -->
278
+ <!-- (title, abstract, section title) shows nothing -->
279
+ <xsl:text> slideNumber: </xsl:text>
280
+ <xsl:choose>
281
+ <xsl:when test="$b-reveal-slide-numbering">
282
+ <xsl:text>function(slide) { return [(slide &amp;&amp; slide.dataset.slideNumber) || '']; }</xsl:text>
283
+ </xsl:when>
284
+ <xsl:otherwise>
285
+ <xsl:text>false</xsl:text>
286
+ </xsl:otherwise>
287
+ </xsl:choose>
288
+ <xsl:text>,&#xa;</xsl:text>
254
289
  <!-- reveal.js "center" vertically centers every slide, -->
255
290
  <!-- so it realizes a document-wide "middle" default; -->
256
291
  <!-- a "top" or "bottom" default disables it, and slides -->
@@ -448,6 +483,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
448
483
  <xsl:apply-templates select="." mode="valign"/>
449
484
  </xsl:with-param>
450
485
  </xsl:call-template>
486
+ <xsl:if test="$b-reveal-slide-numbering">
487
+ <xsl:attribute name="data-slide-number">
488
+ <xsl:apply-templates select="." mode="number"/>
489
+ </xsl:attribute>
490
+ </xsl:if>
451
491
  <xsl:variable name="slide-hN">
452
492
  <xsl:apply-templates select="." mode="hN">
453
493
  <xsl:with-param name="heading-level" select="$reveal-slide-heading-level"/>
@@ -628,7 +668,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
628
668
 
629
669
  <!-- Images get wrapped in a div with @class="fragment" if they are -->
630
670
  <!-- paused -->
631
- <xsl:template match="image[not(ancestor::sidebyside) and (@pause='yes')]">
671
+ <xsl:template match="image[not(&SBS-LAYOUT-FILTER;) and (@pause='yes')]">
632
672
  <div class="fragment">
633
673
  <xsl:apply-imports/>
634
674
  </div>
@@ -757,7 +797,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
757
797
  <!-- match covers all mathematics. Slides never link to an -->
758
798
  <!-- equation (a cross-reference renders as its text), so no HTML -->
759
799
  <!-- id is placed, unlike EPUB. -->
760
- <xsl:template match="m|md[mrow]">
800
+ <!-- Music notation ("n", "scaledeg", "timesignature", "chord") -->
801
+ <!-- is set as inline math, so it has a representation as well. -->
802
+ <xsl:template match="m|md[mrow]|n|scaledeg|timesignature|chord">
761
803
  <xsl:choose>
762
804
  <xsl:when test="$b-reveal-embedded-math">
763
805
  <!-- NB: math-representation file writes with "unique-id" -->
@@ -691,6 +691,29 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
691
691
  </solution>
692
692
  </xsl:template>
693
693
 
694
+ <!-- A card ("premise" or "response") is copied as-is -->
695
+ <xsl:template match="premise|response" mode="cardsort-card-static">
696
+ <xsl:copy-of select="."/>
697
+ </xsl:template>
698
+
699
+ <!-- Experimental, see "debug.advanced.feedback": a card of a -->
700
+ <!-- "cardsort" may have a "statement" and a "feedback". The -->
701
+ <!-- card becomes the content of the "statement", while any -->
702
+ <!-- "feedback" is dropped. -->
703
+ <xsl:template match="cardsort/match/premise|cardsort/match/response" mode="cardsort-card-static">
704
+ <xsl:copy>
705
+ <xsl:copy-of select="@*"/>
706
+ <xsl:choose>
707
+ <xsl:when test="$b-debug-advanced-feedback and statement">
708
+ <xsl:copy-of select="statement/node()"/>
709
+ </xsl:when>
710
+ <xsl:otherwise>
711
+ <xsl:copy-of select="node()"/>
712
+ </xsl:otherwise>
713
+ </xsl:choose>
714
+ </xsl:copy>
715
+ </xsl:template>
716
+
694
717
  <!-- Exercise statement as a tabular -->
695
718
 
696
719
  <!-- For a problem statement, we use a response list re-ordered -->
@@ -709,7 +732,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
709
732
  <xsl:variable name="sorted-premises-rtf">
710
733
  <xsl:for-each select="match/premise|premise">
711
734
  <xsl:sort select="@order"/>
712
- <xsl:copy-of select="."/>
735
+ <xsl:apply-templates select="." mode="cardsort-card-static"/>
713
736
  </xsl:for-each>
714
737
  </xsl:variable>
715
738
  <xsl:variable name="sorted-premises" select="exsl:node-set($sorted-premises-rtf)"/>
@@ -718,7 +741,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
718
741
  <xsl:variable name="sorted-responses-rtf">
719
742
  <xsl:for-each select="match/response|response">
720
743
  <xsl:sort select="@order"/>
721
- <xsl:copy-of select="."/>
744
+ <xsl:apply-templates select="." mode="cardsort-card-static"/>
722
745
  </xsl:for-each>
723
746
  </xsl:variable>
724
747
  <xsl:variable name="sorted-responses" select="exsl:node-set($sorted-responses-rtf)"/>
@@ -790,7 +813,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
790
813
  <p>
791
814
  <xsl:choose>
792
815
  <xsl:when test="response">
793
- <xsl:copy-of select="response"/>
816
+ <xsl:apply-templates select="response" mode="cardsort-card-static"/>
794
817
  </xsl:when>
795
818
  <xsl:otherwise>
796
819
  <xsl:text>(</xsl:text>
@@ -804,7 +827,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
804
827
  <ul>
805
828
  <xsl:for-each select="premise">
806
829
  <li>
807
- <xsl:copy-of select="."/>
830
+ <xsl:apply-templates select="." mode="cardsort-card-static"/>
808
831
  </li>
809
832
  </xsl:for-each>
810
833
  </ul>
@@ -1608,7 +1608,19 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1608
1608
 
1609
1609
  <!-- Carsort Problem -->
1610
1610
 
1611
+ <!-- Experimental, see "debug.advanced.feedback": XML for Runestone -->
1611
1612
  <xsl:template match="*[@pi:exercise-interactive = 'cardsort']" mode="runestone-to-interactive">
1613
+ <xsl:choose>
1614
+ <xsl:when test="$b-debug-advanced-feedback">
1615
+ <xsl:apply-templates select="." mode="cardsort-xml"/>
1616
+ </xsl:when>
1617
+ <xsl:otherwise>
1618
+ <xsl:apply-templates select="." mode="cardsort-html"/>
1619
+ </xsl:otherwise>
1620
+ </xsl:choose>
1621
+ </xsl:template>
1622
+
1623
+ <xsl:template match="*[@pi:exercise-interactive = 'cardsort']" mode="cardsort-html">
1612
1624
  <div class="ptx-runestone-container">
1613
1625
  <div class="runestone cardsort_section">
1614
1626
  <ul data-component="dragndrop" data-question_label="" style="visibility: hidden;">
@@ -1660,6 +1672,106 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1660
1672
  </div>
1661
1673
  </xsl:template>
1662
1674
 
1675
+ <!-- Experimental, see "debug.advanced.feedback". The XML form -->
1676
+ <!-- Runestone reads for "matching" and for "dragndrop", which -->
1677
+ <!-- allows a "feedback" on each card. The exercise's "feedback" -->
1678
+ <!-- is always first, even when empty, so a Runestone that looks -->
1679
+ <!-- for the first "feedback" never finds a card's "feedback". -->
1680
+ <!-- Identifications are those of the HTML form: a "premise" is a -->
1681
+ <!-- "_drag" and a "response" is a "_drop". A "premise" without a -->
1682
+ <!-- "response" gets no "answer", making it a distractor. -->
1683
+ <xsl:template match="*[@pi:exercise-interactive = 'cardsort']" mode="cardsort-xml">
1684
+ <xsl:variable name="rsid">
1685
+ <xsl:apply-templates select="." mode="runestone-id"/>
1686
+ </xsl:variable>
1687
+ <div class="ptx-runestone-container">
1688
+ <div class="runestone cardsort_section">
1689
+ <div data-component="dragndrop" data-question_label="">
1690
+ <xsl:apply-templates select="." mode="runestone-id-attribute"/>
1691
+ <script type="text/xml">
1692
+ <dragndrop>
1693
+ <statement>
1694
+ <xsl:apply-templates select="statement"/>
1695
+ </statement>
1696
+ <feedback>
1697
+ <xsl:apply-templates select="feedback"/>
1698
+ </feedback>
1699
+ <xsl:apply-templates select="cardsort/match/premise" mode="cardsort-xml">
1700
+ <xsl:with-param name="rsid" select="$rsid"/>
1701
+ </xsl:apply-templates>
1702
+ <xsl:apply-templates select="cardsort/match/response" mode="cardsort-xml">
1703
+ <xsl:with-param name="rsid" select="$rsid"/>
1704
+ </xsl:apply-templates>
1705
+ <xsl:apply-templates select="cardsort/match/premise" mode="cardsort-xml-answer">
1706
+ <xsl:with-param name="rsid" select="$rsid"/>
1707
+ </xsl:apply-templates>
1708
+ </dragndrop>
1709
+ </script>
1710
+ </div>
1711
+ </div>
1712
+ </div>
1713
+ </xsl:template>
1714
+
1715
+ <!-- A card, with an optional "feedback" -->
1716
+ <xsl:template match="premise|response" mode="cardsort-xml">
1717
+ <xsl:param name="rsid"/>
1718
+ <xsl:element name="{local-name(.)}">
1719
+ <id>
1720
+ <xsl:apply-templates select="." mode="cardsort-xml-id">
1721
+ <xsl:with-param name="rsid" select="$rsid"/>
1722
+ </xsl:apply-templates>
1723
+ </id>
1724
+ <label>
1725
+ <xsl:choose>
1726
+ <xsl:when test="statement">
1727
+ <xsl:apply-templates select="statement/node()"/>
1728
+ </xsl:when>
1729
+ <xsl:otherwise>
1730
+ <xsl:apply-templates select="node()"/>
1731
+ </xsl:otherwise>
1732
+ </xsl:choose>
1733
+ </label>
1734
+ <xsl:if test="feedback">
1735
+ <feedback>
1736
+ <xsl:apply-templates select="feedback"/>
1737
+ </feedback>
1738
+ </xsl:if>
1739
+ </xsl:element>
1740
+ </xsl:template>
1741
+
1742
+ <!-- A "premise" matches the "response" of its "match", if any -->
1743
+ <xsl:template match="premise" mode="cardsort-xml-answer">
1744
+ <xsl:param name="rsid"/>
1745
+ <xsl:if test="../response">
1746
+ <answer>
1747
+ <xsl:attribute name="premise">
1748
+ <xsl:apply-templates select="." mode="cardsort-xml-id">
1749
+ <xsl:with-param name="rsid" select="$rsid"/>
1750
+ </xsl:apply-templates>
1751
+ </xsl:attribute>
1752
+ <xsl:attribute name="response">
1753
+ <xsl:apply-templates select="../response" mode="cardsort-xml-id">
1754
+ <xsl:with-param name="rsid" select="$rsid"/>
1755
+ </xsl:apply-templates>
1756
+ </xsl:attribute>
1757
+ </answer>
1758
+ </xsl:if>
1759
+ </xsl:template>
1760
+
1761
+ <xsl:template match="premise" mode="cardsort-xml-id">
1762
+ <xsl:param name="rsid"/>
1763
+ <xsl:value-of select="$rsid"/>
1764
+ <xsl:text>_drag</xsl:text>
1765
+ <xsl:number count="premise" from="cardsort" level="any"/>
1766
+ </xsl:template>
1767
+
1768
+ <xsl:template match="response" mode="cardsort-xml-id">
1769
+ <xsl:param name="rsid"/>
1770
+ <xsl:value-of select="$rsid"/>
1771
+ <xsl:text>_drop</xsl:text>
1772
+ <xsl:number count="response" from="cardsort" level="any"/>
1773
+ </xsl:template>
1774
+
1663
1775
  <!-- A "category" is simply the sequence number of an -->
1664
1776
  <!-- enclosing "match" element, which serves to group -->
1665
1777
  <!-- any number of "premise" with zero or one "response", -->
@@ -1077,9 +1077,10 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1077
1077
  <xsl:text>&#xa;&#xa;</xsl:text>
1078
1078
  </xsl:template>
1079
1079
 
1080
- <!-- The heading line of a block: type, number when there is one, -->
1081
- <!-- a parenthesized creator for the theorem-like and axiom-like, -->
1082
- <!-- title when there is one -->
1080
+ <!-- The heading line of a block: type, number when there is one, -->
1081
+ <!-- title when there is one, for a mathematical block the -->
1082
+ <!-- parenthesized attribution (creator and origins), and a period -->
1083
+ <!-- only when neither follows the number -->
1083
1084
  <xsl:template match="*" mode="block-heading">
1084
1085
  <xsl:call-template name="block-heading-line">
1085
1086
  <xsl:with-param name="heading">
@@ -1091,20 +1092,19 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1091
1092
  <xsl:text> </xsl:text>
1092
1093
  <xsl:value-of select="$the-number"/>
1093
1094
  </xsl:if>
1094
- <xsl:if test="creator and (&THEOREM-FILTER; or &AXIOM-FILTER;)">
1095
+ <xsl:variable name="b-attribution" select="(creator or origins) and (&THEOREM-FILTER; or &AXIOM-FILTER; or &DEFINITION-FILTER; or &OPENPROBLEM-FILTER;)"/>
1096
+ <xsl:if test="not(title) and not($b-attribution)">
1097
+ <xsl:text>.</xsl:text>
1098
+ </xsl:if>
1099
+ <xsl:if test="title">
1100
+ <xsl:text> </xsl:text>
1101
+ <xsl:apply-templates select="." mode="title-full"/>
1102
+ </xsl:if>
1103
+ <xsl:if test="$b-attribution">
1095
1104
  <xsl:text> (</xsl:text>
1096
- <xsl:apply-templates select="." mode="creator-full"/>
1105
+ <xsl:apply-templates select="." mode="attribution-full"/>
1097
1106
  <xsl:text>)</xsl:text>
1098
1107
  </xsl:if>
1099
- <xsl:choose>
1100
- <xsl:when test="title">
1101
- <xsl:text> </xsl:text>
1102
- <xsl:apply-templates select="." mode="title-full"/>
1103
- </xsl:when>
1104
- <xsl:otherwise>
1105
- <xsl:text>.</xsl:text>
1106
- </xsl:otherwise>
1107
- </xsl:choose>
1108
1108
  </xsl:with-param>
1109
1109
  </xsl:call-template>
1110
1110
  </xsl:template>
@@ -1317,6 +1317,13 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1317
1317
  <xsl:apply-templates/>
1318
1318
  </xsl:template>
1319
1319
 
1320
+ <!-- A "stack" within a "figure" holds subfigures, each a -->
1321
+ <!-- "figure" with its own caption, subnumbered "(a)", "(b)", -->
1322
+ <!-- ...; the enclosing figure captions the whole. -->
1323
+ <xsl:template match="figure/stack">
1324
+ <xsl:apply-templates select="figure"/>
1325
+ </xsl:template>
1326
+
1320
1327
  <!-- ##### -->
1321
1328
  <!-- Lists -->
1322
1329
  <!-- ##### -->