@pretextbook/pretext-html 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/preview-html.xsl +16 -0
- package/assets/upstream.json +1 -1
- package/assets/xsl/extract-dynamic.xsl +54 -3
- package/assets/xsl/extract-gdscript.xsl +61 -0
- package/assets/xsl/extract-sageplot.xsl +3 -0
- package/assets/xsl/localizations/it-IT.xml +37 -41
- package/assets/xsl/pretext-assembly.xsl +188 -24
- package/assets/xsl/pretext-beamer.xsl +57 -12
- package/assets/xsl/pretext-common.xsl +156 -28
- package/assets/xsl/pretext-epub.xsl +0 -5
- package/assets/xsl/pretext-fo.xsl +110 -48
- package/assets/xsl/pretext-html.xsl +147 -54
- package/assets/xsl/pretext-jupyter.xsl +1 -0
- package/assets/xsl/pretext-latex-classic.xsl +2 -2
- package/assets/xsl/pretext-latex-common.xsl +268 -134
- package/assets/xsl/pretext-latex.xsl +16 -6
- package/assets/xsl/pretext-numbers.xsl +10 -0
- package/assets/xsl/pretext-revealjs.xsl +68 -1
- package/assets/xsl/pretext-runestone-fitb.xsl +179 -84
- package/assets/xsl/pretext-runestone-static.xsl +72 -20
- package/assets/xsl/pretext-runestone.xsl +27 -4
- package/assets/xsl/pretext-text-utilities.xsl +7 -0
- package/assets/xsl/pretext-text.xsl +17 -0
- package/assets/xsl/publisher-variables.xsl +39 -0
- package/assets/xsl-bundle.json +1 -1
- package/dist/cli-BUrNZxov.js +1098 -0
- package/dist/cli.js +1 -1
- package/dist/html-static.d.ts +2 -2
- package/dist/index.browser.js +595 -386
- package/dist/index.d.ts +4 -0
- package/dist/index.js +35 -30
- package/dist/renderer.d.ts +35 -0
- package/dist/skeleton.d.ts +41 -0
- package/dist/xrefs.d.ts +54 -0
- package/package.json +1 -1
- package/dist/cli-Bcn4t3B1.js +0 -871
|
@@ -418,6 +418,43 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
418
418
|
</xsl:copy>
|
|
419
419
|
</xsl:template>
|
|
420
420
|
|
|
421
|
+
<!-- The highest format version of the substitutions file this stylesheet -->
|
|
422
|
+
<!-- knows how to read. Version 1 is the form in which an "eval-subst" -->
|
|
423
|
+
<!-- carries "latex" and "plain" children. Files written before that -->
|
|
424
|
+
<!-- distinction existed carry no @version and hold text directly; they -->
|
|
425
|
+
<!-- are read as version 0 by the fallback in "dynamic-representation". -->
|
|
426
|
+
<xsl:variable name="dynamic-substitutions-format" select="1"/>
|
|
427
|
+
|
|
428
|
+
<!-- The root of this pass, which runs once, and so is where a check on -->
|
|
429
|
+
<!-- the substitutions file as a whole belongs rather than at each of the -->
|
|
430
|
+
<!-- individual lookups. Without this the file would be read by a -->
|
|
431
|
+
<!-- stylesheet older than the script that wrote it, and the mismatch -->
|
|
432
|
+
<!-- would surface as substitutions quietly coming out wrong instead of -->
|
|
433
|
+
<!-- as a statement of what is actually the matter. -->
|
|
434
|
+
<xsl:template match="/" mode="dynamic-substitution">
|
|
435
|
+
<xsl:if test="($exercise-style = 'static') and not($b-extracting) and not($dynamic-substitutions-file = '')">
|
|
436
|
+
<xsl:variable name="recorded" select="document($dynamic-substitutions-file,$original)/*/@version"/>
|
|
437
|
+
<!-- A missing @version is an older file, and is silent: the -->
|
|
438
|
+
<!-- representation template already falls back for those. Only a -->
|
|
439
|
+
<!-- version from the future is worth saying anything about. -->
|
|
440
|
+
<xsl:if test="$recorded > $dynamic-substitutions-format">
|
|
441
|
+
<xsl:message>
|
|
442
|
+
<xsl:text>PTX:WARNING: the dynamic substitutions file records format version </xsl:text>
|
|
443
|
+
<xsl:value-of select="$recorded"/>
|
|
444
|
+
<xsl:text>,
</xsl:text>
|
|
445
|
+
<xsl:text>but this version of PreTeXt reads version </xsl:text>
|
|
446
|
+
<xsl:value-of select="$dynamic-substitutions-format"/>
|
|
447
|
+
<xsl:text> at the newest. The file was written by a
</xsl:text>
|
|
448
|
+
<xsl:text>newer PreTeXt, and dynamic exercises may come out wrong. Either update
</xsl:text>
|
|
449
|
+
<xsl:text>PreTeXt, or delete the file and let this version generate it again.</xsl:text>
|
|
450
|
+
</xsl:message>
|
|
451
|
+
</xsl:if>
|
|
452
|
+
</xsl:if>
|
|
453
|
+
<xsl:copy>
|
|
454
|
+
<xsl:apply-templates select="node()|@*" mode="dynamic-substitution"/>
|
|
455
|
+
</xsl:copy>
|
|
456
|
+
</xsl:template>
|
|
457
|
+
|
|
421
458
|
<xsl:template match="node()|@*" mode="representations">
|
|
422
459
|
<xsl:copy>
|
|
423
460
|
<xsl:apply-templates select="node()|@*" mode="representations"/>
|
|
@@ -621,21 +658,23 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
621
658
|
<!-- them it is the identity, so we skip the full-tree copy. NB: a -->
|
|
622
659
|
<!-- new template in the mode must be reflected in this test. -->
|
|
623
660
|
<xsl:variable name="b-has-dynamic-markup" select="boolean($assembly-label//setup | $assembly-label//numcmp | $assembly-label//strcmp | $assembly-label//jscmp | $assembly-label//mathcmp | $assembly-label//logic | $assembly-label//fillin[@ansobj] | $assembly-label//eval[@obj])"/>
|
|
661
|
+
<!-- "assembly-id-only" emits $assembly-label, so every pass below is -->
|
|
662
|
+
<!-- discarded in that mode. $post-label is empty then, and each later -->
|
|
663
|
+
<!-- pass takes its input from $post-label, so each one copies nothing -->
|
|
664
|
+
<!-- and opens no file. The test is written once, here, instead of -->
|
|
665
|
+
<!-- being repeated in every pass: libxslt computes a global variable -->
|
|
666
|
+
<!-- even when nothing uses the result, so a pass is not skipped just -->
|
|
667
|
+
<!-- by leaving its variable unread. -->
|
|
668
|
+
<xsl:variable name="post-label" select="$assembly-label[not($b-assembly-id-only)]"/>
|
|
624
669
|
<xsl:variable name="dynamic-rtf">
|
|
625
670
|
<xsl:if test="$b-has-dynamic-markup">
|
|
626
|
-
<xsl:apply-templates select="$
|
|
671
|
+
<xsl:apply-templates select="$post-label" mode="dynamic-substitution"/>
|
|
627
672
|
</xsl:if>
|
|
628
673
|
</xsl:variable>
|
|
629
|
-
<xsl:variable name="dynamic" select="exsl:node-set($dynamic-rtf)[$b-has-dynamic-markup] | $
|
|
674
|
+
<xsl:variable name="dynamic" select="exsl:node-set($dynamic-rtf)[$b-has-dynamic-markup] | $post-label[not($b-has-dynamic-markup)]"/>
|
|
630
675
|
|
|
631
676
|
<xsl:variable name="representations-rtf">
|
|
632
|
-
<xsl:
|
|
633
|
-
<!-- short-circuit to stop after adding @pi:assembly-id -->
|
|
634
|
-
<xsl:when test="$b-assembly-id-only"/>
|
|
635
|
-
<xsl:otherwise>
|
|
636
|
-
<xsl:apply-templates select="$dynamic" mode="representations"/>
|
|
637
|
-
</xsl:otherwise>
|
|
638
|
-
</xsl:choose>
|
|
677
|
+
<xsl:apply-templates select="$dynamic" mode="representations"/>
|
|
639
678
|
</xsl:variable>
|
|
640
679
|
<xsl:variable name="representations" select="exsl:node-set($representations-rtf)"/>
|
|
641
680
|
|
|
@@ -1651,7 +1690,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1651
1690
|
|
|
1652
1691
|
<!-- Identify this evaluate's position among its siblings and its name, -->
|
|
1653
1692
|
<!-- to locate the corresponding fillin by name first, position second. -->
|
|
1654
|
-
<xsl:variable name="eval-position" select="count(preceding-sibling::evaluate) + 1"/>
|
|
1693
|
+
<xsl:variable name="eval-position" select="count(preceding-sibling::evaluate[not(@all='yes')]) + 1"/>
|
|
1655
1694
|
<xsl:variable name="eval-name" select="@name"/>
|
|
1656
1695
|
|
|
1657
1696
|
<!-- Navigate to the exercise/project/task parent of evaluation -->
|
|
@@ -1691,7 +1730,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1691
1730
|
</xsl:when>
|
|
1692
1731
|
<xsl:otherwise>
|
|
1693
1732
|
<xsl:message>PTX:WARNING: fillin in "<xsl:value-of
|
|
1694
|
-
select="$exercise-parent/@
|
|
1733
|
+
select="$exercise-parent/@pi:original-id"/>" has @answer but
|
|
1695
1734
|
@mode is missing or not recognized (expected 'number' or
|
|
1696
1735
|
'string'). No default correct test synthesized.</xsl:message>
|
|
1697
1736
|
</xsl:otherwise>
|
|
@@ -1738,8 +1777,14 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1738
1777
|
</xsl:variable>
|
|
1739
1778
|
<xsl:variable name="eval-subs" select="document($dynamic-substitutions-file,$original)"/>
|
|
1740
1779
|
<xsl:variable name="object" select="@ansobj"/>
|
|
1780
|
+
<xsl:variable name="recorded" select="$eval-subs//dynamic-substitution[@id=$parent-id]/eval-subst[@obj=$object]"/>
|
|
1781
|
+
<!-- An answer is typeset as mathematics for the same modes that -->
|
|
1782
|
+
<!-- "fillin-solution" in pretext-runestone-static.xsl wraps in -->
|
|
1783
|
+
<!-- "m", so the two have to agree on which representation to use. -->
|
|
1741
1784
|
<xsl:variable name="substitution">
|
|
1742
|
-
<xsl:
|
|
1785
|
+
<xsl:apply-templates select="$recorded" mode="dynamic-representation">
|
|
1786
|
+
<xsl:with-param name="b-latex" select="(@mode = 'math') or (@mode = 'number')"/>
|
|
1787
|
+
</xsl:apply-templates>
|
|
1743
1788
|
</xsl:variable>
|
|
1744
1789
|
<xsl:copy>
|
|
1745
1790
|
<xsl:attribute name="answer">
|
|
@@ -1769,8 +1814,17 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1769
1814
|
</xsl:variable>
|
|
1770
1815
|
<xsl:variable name="eval-subs" select="document($dynamic-substitutions-file,$original)"/>
|
|
1771
1816
|
<xsl:variable name="object" select="@obj"/>
|
|
1817
|
+
<xsl:variable name="recorded" select="$eval-subs//dynamic-substitution[@id=$parent-id]/eval-subst[@obj=$object]"/>
|
|
1818
|
+
<!-- The value lands wherever the "eval" stood, so the surrounding -->
|
|
1819
|
+
<!-- markup decides which representation is wanted. This is the -->
|
|
1820
|
+
<!-- same test the HTML version makes when it wraps a reference in -->
|
|
1821
|
+
<!-- "toTeX" in pretext-runestone-fitb.xsl , and the two must -->
|
|
1822
|
+
<!-- agree. "md" is included because its single-line form holds -->
|
|
1823
|
+
<!-- text directly, with no "mrow" for an ancestor step to find. -->
|
|
1772
1824
|
<xsl:variable name="substitution">
|
|
1773
|
-
<xsl:
|
|
1825
|
+
<xsl:apply-templates select="$recorded" mode="dynamic-representation">
|
|
1826
|
+
<xsl:with-param name="b-latex" select="boolean(ancestor::m|ancestor::md|ancestor::mrow)"/>
|
|
1827
|
+
</xsl:apply-templates>
|
|
1774
1828
|
</xsl:variable>
|
|
1775
1829
|
<xsl:value-of select="$substitution"/>
|
|
1776
1830
|
</xsl:when>
|
|
@@ -1785,6 +1839,49 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1785
1839
|
</xsl:choose>
|
|
1786
1840
|
</xsl:template>
|
|
1787
1841
|
|
|
1842
|
+
<!-- Pick a recorded substitution's representation. -->
|
|
1843
|
+
<!-- -->
|
|
1844
|
+
<!-- One generated object is routinely referenced more than once, and -->
|
|
1845
|
+
<!-- not always in the same way: as the answer of a "fillin" and again -->
|
|
1846
|
+
<!-- inside an "m" in the solution, say. Those want different strings -->
|
|
1847
|
+
<!-- from the same object, and the substitutions file is keyed only by -->
|
|
1848
|
+
<!-- the object, so it cannot record which was meant. Instead it records -->
|
|
1849
|
+
<!-- both, and the caller, which does know its own context, chooses. -->
|
|
1850
|
+
<!-- -->
|
|
1851
|
+
<!-- Substitution files generated before this distinction existed hold -->
|
|
1852
|
+
<!-- text and no children; that text is used for either request. -->
|
|
1853
|
+
<xsl:template match="eval-subst" mode="dynamic-representation">
|
|
1854
|
+
<xsl:param name="b-latex" select="false()"/>
|
|
1855
|
+
<!-- Each representation is independent: a request for one never looks -->
|
|
1856
|
+
<!-- at whether the other happens to be present. A v1 substitution -->
|
|
1857
|
+
<!-- carries both children together, or neither (the legacy case, -->
|
|
1858
|
+
<!-- below), never just one, but the fallback is written per-child -->
|
|
1859
|
+
<!-- regardless, since that is the contract, not an assumption about -->
|
|
1860
|
+
<!-- which files exist. -->
|
|
1861
|
+
<xsl:choose>
|
|
1862
|
+
<xsl:when test="$b-latex">
|
|
1863
|
+
<xsl:choose>
|
|
1864
|
+
<xsl:when test="latex">
|
|
1865
|
+
<xsl:value-of select="latex"/>
|
|
1866
|
+
</xsl:when>
|
|
1867
|
+
<xsl:otherwise>
|
|
1868
|
+
<xsl:value-of select="."/>
|
|
1869
|
+
</xsl:otherwise>
|
|
1870
|
+
</xsl:choose>
|
|
1871
|
+
</xsl:when>
|
|
1872
|
+
<xsl:otherwise>
|
|
1873
|
+
<xsl:choose>
|
|
1874
|
+
<xsl:when test="plain">
|
|
1875
|
+
<xsl:value-of select="plain"/>
|
|
1876
|
+
</xsl:when>
|
|
1877
|
+
<xsl:otherwise>
|
|
1878
|
+
<xsl:value-of select="."/>
|
|
1879
|
+
</xsl:otherwise>
|
|
1880
|
+
</xsl:choose>
|
|
1881
|
+
</xsl:otherwise>
|
|
1882
|
+
</xsl:choose>
|
|
1883
|
+
</xsl:template>
|
|
1884
|
+
|
|
1788
1885
|
<!-- An #eval child of test is implicit mathcmp. -->
|
|
1789
1886
|
<xsl:template match="test/eval[@obj]" mode="dynamic-substitution">
|
|
1790
1887
|
<xsl:choose>
|
|
@@ -2955,6 +3052,39 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2955
3052
|
</xsl:element>
|
|
2956
3053
|
</xsl:template>
|
|
2957
3054
|
|
|
3055
|
+
<!-- 2026-07-31: a footnote within a "tabular" cell becomes a "tn" -->
|
|
3056
|
+
<!-- table note, lettered and placed at the bottom of the table -->
|
|
3057
|
+
<!-- (Notes to tables: CMoS 18th ed., 3.77-3.81; specific notes -->
|
|
3058
|
+
<!-- at 3.80). Any identification attributes are orphaned: a -->
|
|
3059
|
+
<!-- "tn" is not a cross-reference target. -->
|
|
3060
|
+
<xsl:template match="tabular//fn" mode="repair">
|
|
3061
|
+
<tn>
|
|
3062
|
+
<xsl:apply-templates select="node()" mode="repair"/>
|
|
3063
|
+
</tn>
|
|
3064
|
+
</xsl:template>
|
|
3065
|
+
|
|
3066
|
+
<!-- A "tn" authored as a block sibling of a cell's paragraphs is -->
|
|
3067
|
+
<!-- relocated to the tail of the paragraph it follows, where its -->
|
|
3068
|
+
<!-- mark belongs typographically; conversions then treat every -->
|
|
3069
|
+
<!-- "tn" as inline. A "tn" amid the mixed text of a cell is -->
|
|
3070
|
+
<!-- already inline, and is untouched. -->
|
|
3071
|
+
<xsl:template match="cell[p]/tn" mode="repair"/>
|
|
3072
|
+
|
|
3073
|
+
<xsl:template match="cell/p" mode="repair">
|
|
3074
|
+
<xsl:copy>
|
|
3075
|
+
<xsl:apply-templates select="@*|node()" mode="repair"/>
|
|
3076
|
+
<xsl:apply-templates select="following-sibling::tn[count(preceding-sibling::p[1] | current()) = 1]" mode="tn-relocate"/>
|
|
3077
|
+
</xsl:copy>
|
|
3078
|
+
</xsl:template>
|
|
3079
|
+
|
|
3080
|
+
<!-- A faithful copy, since the "repair" mode on the same -->
|
|
3081
|
+
<!-- element is its suppression at the original location. -->
|
|
3082
|
+
<xsl:template match="cell/tn" mode="tn-relocate">
|
|
3083
|
+
<xsl:copy>
|
|
3084
|
+
<xsl:apply-templates select="@*|node()" mode="repair"/>
|
|
3085
|
+
</xsl:copy>
|
|
3086
|
+
</xsl:template>
|
|
3087
|
+
|
|
2958
3088
|
<!-- 2026-07-30: an "event" is bibliographic content, so it -->
|
|
2959
3089
|
<!-- belongs in "bibinfo", already its home for slideshows. -->
|
|
2960
3090
|
<!-- Suppressed at its origin within "docinfo"... -->
|
|
@@ -3105,14 +3235,14 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3105
3235
|
<xsl:copy>
|
|
3106
3236
|
<!-- Include "personname" first -->
|
|
3107
3237
|
<xsl:apply-templates select="personname|@*" mode="repair"/>
|
|
3108
|
-
<!-- If there are bare
|
|
3109
|
-
<xsl:if test="department or institution or location">
|
|
3238
|
+
<!-- If there are bare position/department/institution/address, wrap them in affiliation -->
|
|
3239
|
+
<xsl:if test="position or department or institution or location">
|
|
3110
3240
|
<affiliation>
|
|
3111
|
-
<xsl:apply-templates select="department|institution|location" mode="repair"/>
|
|
3241
|
+
<xsl:apply-templates select="position|department|institution|location" mode="repair"/>
|
|
3112
3242
|
</affiliation>
|
|
3113
3243
|
</xsl:if>
|
|
3114
3244
|
<!-- Include all additional elements as they are -->
|
|
3115
|
-
<xsl:apply-templates select="*[not(self::personname or self::department or self::institution or self::location)]" mode="repair"/>
|
|
3245
|
+
<xsl:apply-templates select="*[not(self::personname or self::position or self::department or self::institution or self::location)]" mode="repair"/>
|
|
3116
3246
|
</xsl:copy>
|
|
3117
3247
|
</xsl:template>
|
|
3118
3248
|
|
|
@@ -3515,6 +3645,21 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3515
3645
|
<!-- never summary pages (the situation that demands the heading) -->
|
|
3516
3646
|
<xsl:template match="introduction[parent::article or parent::chapter or parent::appendix or parent::section or parent::subsection]/title|conclusion[parent::article or parent::chapter or parent::appendix or parent::section or parent::subsection]/title" mode="repair"/>
|
|
3517
3647
|
|
|
3648
|
+
<!-- 2026-08-06 a "references" preface is a "headnote" -->
|
|
3649
|
+
|
|
3650
|
+
<!-- The "introduction" becomes a "headnote", which never carries a -->
|
|
3651
|
+
<!-- "title", so any title is discarded; the deprecation warning -->
|
|
3652
|
+
<!-- says so plainly -->
|
|
3653
|
+
<xsl:template match="references/introduction" mode="repair">
|
|
3654
|
+
<headnote>
|
|
3655
|
+
<xsl:apply-templates select="node()[not(self::title)]|@*" mode="repair"/>
|
|
3656
|
+
</headnote>
|
|
3657
|
+
</xsl:template>
|
|
3658
|
+
|
|
3659
|
+
<!-- A "references" has no "conclusion": the element is dropped -->
|
|
3660
|
+
<!-- whole, and the deprecation warning says so plainly -->
|
|
3661
|
+
<xsl:template match="references/conclusion" mode="repair"/>
|
|
3662
|
+
|
|
3518
3663
|
<!-- ########## -->
|
|
3519
3664
|
<!-- Enrichment -->
|
|
3520
3665
|
<!-- ########## -->
|
|
@@ -4174,12 +4319,31 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4174
4319
|
<xsl:param name="project-nodes"/>
|
|
4175
4320
|
<xsl:param name="exercise-nodes"/>
|
|
4176
4321
|
<xsl:param name="openproblem-nodes"/>
|
|
4177
|
-
<!--
|
|
4178
|
-
<!--
|
|
4179
|
-
<!--
|
|
4180
|
-
<!--
|
|
4181
|
-
<!--
|
|
4182
|
-
|
|
4322
|
+
<!-- Terminal: this division's items pool into one flat scope -->
|
|
4323
|
+
<!-- here. For a traditional division the authority is the -->
|
|
4324
|
+
<!-- two-model test "is-structured-division": an unstructured -->
|
|
4325
|
+
<!-- division (content, plus at most one of each specialized -->
|
|
4326
|
+
<!-- division) is terminal, its specialized divisions pooling -->
|
|
4327
|
+
<!-- into its scope; a structured division (traditional -->
|
|
4328
|
+
<!-- subdivisions, or only worksheets) recurses, and each -->
|
|
4329
|
+
<!-- worksheet then opens a scope apiece. The test does not -->
|
|
4330
|
+
<!-- apply to "frontmatter", "backmatter", a "preface", or the -->
|
|
4331
|
+
<!-- specialized divisions themselves, which keep the plain -->
|
|
4332
|
+
<!-- child-division inspection. -->
|
|
4333
|
+
<xsl:variable name="terminal">
|
|
4334
|
+
<xsl:choose>
|
|
4335
|
+
<xsl:when test="self::book or self::article or self::part or self::chapter or self::appendix or self::section or self::subsection or self::subsubsection">
|
|
4336
|
+
<xsl:variable name="is-structured">
|
|
4337
|
+
<xsl:apply-templates select="." mode="is-structured-division"/>
|
|
4338
|
+
</xsl:variable>
|
|
4339
|
+
<xsl:value-of select="$is-structured = 'false'"/>
|
|
4340
|
+
</xsl:when>
|
|
4341
|
+
<xsl:otherwise>
|
|
4342
|
+
<xsl:value-of select="not(part|chapter|appendix|section|subsection|subsubsection|preface|exercises|worksheet|handout|reading-questions|references|glossary|solutions)"/>
|
|
4343
|
+
</xsl:otherwise>
|
|
4344
|
+
</xsl:choose>
|
|
4345
|
+
</xsl:variable>
|
|
4346
|
+
<xsl:variable name="b-terminal" select="$terminal = 'true'"/>
|
|
4183
4347
|
<xsl:variable name="b-open-eq" select="not($eq-nodes) and ($b-terminal or (@pi:level >= $numbering-equations))"/>
|
|
4184
4348
|
<xsl:variable name="b-open-fn" select="not($fn-nodes) and ($b-terminal or (@pi:level >= $numbering-footnotes))"/>
|
|
4185
4349
|
<xsl:variable name="b-open-blocks" select="not($blocks-nodes) and ($b-terminal or (@pi:level >= $numbering-blocks))"/>
|
|
@@ -4562,7 +4726,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4562
4726
|
<xsl:template match="book|article|part|chapter|appendix|section|subsection|subsubsection" mode="is-structured-division">
|
|
4563
4727
|
<xsl:variable name="has-traditional" select="boolean(&TRADITIONAL-DIVISION;)"/>
|
|
4564
4728
|
<xsl:variable name="all-children" select="*"/>
|
|
4565
|
-
<xsl:variable name="all-worksheet" select="title|shorttitle|plaintitle|idx|introduction|worksheet|handout|conclusion"/>
|
|
4729
|
+
<xsl:variable name="all-worksheet" select="title|subtitle|shorttitle|plaintitle|idx|frontmatter|introduction|worksheet|handout|conclusion"/>
|
|
4566
4730
|
<xsl:variable name="only-worksheets" select="count($all-children) = count($all-worksheet)"/>
|
|
4567
4731
|
|
|
4568
4732
|
<xsl:value-of select="$has-traditional or $only-worksheets"/>
|
|
@@ -49,10 +49,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
49
49
|
|
|
50
50
|
<xsl:output method="text" indent="no" encoding="UTF-8"/>
|
|
51
51
|
|
|
52
|
-
<!-- The Beamer theme, an author/publisher choice. A string parameter -->
|
|
53
|
-
<!-- until slideshow options mature in the publisher file. -->
|
|
54
|
-
<xsl:param name="beamer.theme" select="'Boadilla'"/>
|
|
55
|
-
|
|
56
52
|
<!-- Blocks on slides never carry a LaTeX \label, so cross-reference -->
|
|
57
53
|
<!-- numbers are hard-coded rather than realized through \ref -->
|
|
58
54
|
<xsl:variable name="b-latex-hardcode-numbers" select="true()"/>
|
|
@@ -90,7 +86,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
90
86
|
<xsl:apply-templates select="frontmatter"/>
|
|
91
87
|
<!-- an overview of the sections, when there are sections -->
|
|
92
88
|
<xsl:if test="section">
|
|
93
|
-
<xsl:text>\begin{frame}
|
|
89
|
+
<xsl:text>\begin{frame}[</xsl:text>
|
|
90
|
+
<xsl:call-template name="valign-letter">
|
|
91
|
+
<xsl:with-param name="valign" select="$slides-valign-default"/>
|
|
92
|
+
</xsl:call-template>
|
|
93
|
+
<xsl:text>]
</xsl:text>
|
|
94
94
|
<xsl:text>\frametitle{</xsl:text>
|
|
95
95
|
<xsl:apply-templates select="." mode="type-name">
|
|
96
96
|
<xsl:with-param name="string-id" select="'toc'"/>
|
|
@@ -152,14 +152,22 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
152
152
|
<xsl:apply-templates select="$bibinfo/date"/>
|
|
153
153
|
</xsl:if>
|
|
154
154
|
<xsl:text>}

</xsl:text>
|
|
155
|
-
<xsl:text>\begin{frame}[plain
|
|
155
|
+
<xsl:text>\begin{frame}[plain,</xsl:text>
|
|
156
|
+
<xsl:call-template name="valign-letter">
|
|
157
|
+
<xsl:with-param name="valign" select="$slides-valign-default"/>
|
|
158
|
+
</xsl:call-template>
|
|
159
|
+
<xsl:text>]
</xsl:text>
|
|
156
160
|
<xsl:text>\titlepage
</xsl:text>
|
|
157
161
|
<xsl:text>\end{frame}

</xsl:text>
|
|
158
162
|
<xsl:apply-templates select="abstract"/>
|
|
159
163
|
</xsl:template>
|
|
160
164
|
|
|
161
165
|
<xsl:template match="slideshow/frontmatter/abstract">
|
|
162
|
-
<xsl:text>\begin{frame}
|
|
166
|
+
<xsl:text>\begin{frame}[</xsl:text>
|
|
167
|
+
<xsl:call-template name="valign-letter">
|
|
168
|
+
<xsl:with-param name="valign" select="$slides-valign-default"/>
|
|
169
|
+
</xsl:call-template>
|
|
170
|
+
<xsl:text>]
</xsl:text>
|
|
163
171
|
<xsl:text>\frametitle{</xsl:text>
|
|
164
172
|
<xsl:apply-templates select="." mode="type-name"/>
|
|
165
173
|
<xsl:text>}
</xsl:text>
|
|
@@ -171,13 +179,35 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
171
179
|
<!-- Sections, Slides, Pauses -->
|
|
172
180
|
<!-- ######################## -->
|
|
173
181
|
|
|
182
|
+
<!-- Beamer places a frame's content by single-letter frame options -->
|
|
183
|
+
<!-- ("t", "c", "b"), so every frame gets the letter realizing its -->
|
|
184
|
+
<!-- effective vertical alignment. -->
|
|
185
|
+
<xsl:template name="valign-letter">
|
|
186
|
+
<xsl:param name="valign"/>
|
|
187
|
+
<xsl:choose>
|
|
188
|
+
<xsl:when test="$valign = 'top'">
|
|
189
|
+
<xsl:text>t</xsl:text>
|
|
190
|
+
</xsl:when>
|
|
191
|
+
<xsl:when test="$valign = 'bottom'">
|
|
192
|
+
<xsl:text>b</xsl:text>
|
|
193
|
+
</xsl:when>
|
|
194
|
+
<xsl:otherwise>
|
|
195
|
+
<xsl:text>c</xsl:text>
|
|
196
|
+
</xsl:otherwise>
|
|
197
|
+
</xsl:choose>
|
|
198
|
+
</xsl:template>
|
|
199
|
+
|
|
174
200
|
<!-- A "section" is a Beamer section (navigation, table of contents) -->
|
|
175
201
|
<!-- with a section-title frame, as in the reveal.js conversion. -->
|
|
176
202
|
<xsl:template match="slideshow/section">
|
|
177
203
|
<xsl:text>
\section{</xsl:text>
|
|
178
204
|
<xsl:apply-templates select="." mode="title-full"/>
|
|
179
205
|
<xsl:text>}
</xsl:text>
|
|
180
|
-
<xsl:text>\begin{frame}
|
|
206
|
+
<xsl:text>\begin{frame}[</xsl:text>
|
|
207
|
+
<xsl:call-template name="valign-letter">
|
|
208
|
+
<xsl:with-param name="valign" select="$slides-valign-default"/>
|
|
209
|
+
</xsl:call-template>
|
|
210
|
+
<xsl:text>]
</xsl:text>
|
|
181
211
|
<xsl:text>\sectionpage
</xsl:text>
|
|
182
212
|
<xsl:text>\end{frame}

</xsl:text>
|
|
183
213
|
<xsl:apply-templates select="slide"/>
|
|
@@ -187,11 +217,16 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
187
217
|
<!-- realized through the "listings" package (or other verbatim-like -->
|
|
188
218
|
<!-- material) must be marked "fragile". -->
|
|
189
219
|
<xsl:template match="slide">
|
|
190
|
-
<xsl:text>\begin{frame}</xsl:text>
|
|
220
|
+
<xsl:text>\begin{frame}[</xsl:text>
|
|
221
|
+
<xsl:call-template name="valign-letter">
|
|
222
|
+
<xsl:with-param name="valign">
|
|
223
|
+
<xsl:apply-templates select="." mode="valign"/>
|
|
224
|
+
</xsl:with-param>
|
|
225
|
+
</xsl:call-template>
|
|
191
226
|
<xsl:if test="descendant::program or descendant::console or descendant::sage or descendant::cd or descendant::pre">
|
|
192
|
-
<xsl:text
|
|
227
|
+
<xsl:text>,fragile</xsl:text>
|
|
193
228
|
</xsl:if>
|
|
194
|
-
<xsl:text
|
|
229
|
+
<xsl:text>]
</xsl:text>
|
|
195
230
|
<xsl:text>\frametitle{</xsl:text>
|
|
196
231
|
<xsl:apply-templates select="." mode="title-full"/>
|
|
197
232
|
<xsl:text>}
</xsl:text>
|
|
@@ -449,8 +484,18 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
449
484
|
<xsl:value-of select="$latex.preamble.early" />
|
|
450
485
|
<xsl:text>
</xsl:text>
|
|
451
486
|
</xsl:if>
|
|
487
|
+
<!-- A theme name unknown to the installation would surface as -->
|
|
488
|
+
<!-- a cryptic missing-file error, so test for the theme's file -->
|
|
489
|
+
<!-- first and die early with advice. "\usetheme{X}" loads -->
|
|
490
|
+
<!-- "beamerthemeX.sty", and "\IfFileExists" performs the same -->
|
|
491
|
+
<!-- search, so a theme local to the document is also honored. -->
|
|
492
|
+
<xsl:text>\IfFileExists{beamertheme</xsl:text>
|
|
493
|
+
<xsl:value-of select="$beamer-theme"/>
|
|
494
|
+
<xsl:text>.sty}{}{\errmessage{The Beamer theme "</xsl:text>
|
|
495
|
+
<xsl:value-of select="$beamer-theme"/>
|
|
496
|
+
<xsl:text>" is not part of this TeX installation. Theme names are case-sensitive, so check capitalization first. Install the theme, or remove the theme entry of the publication file to accept the default theme}}
</xsl:text>
|
|
452
497
|
<xsl:text>\usetheme{</xsl:text>
|
|
453
|
-
<xsl:value-of select="$beamer
|
|
498
|
+
<xsl:value-of select="$beamer-theme"/>
|
|
454
499
|
<xsl:text>}
</xsl:text>
|
|
455
500
|
<xsl:text>\usefonttheme[onlymath]{serif}
</xsl:text>
|
|
456
501
|
<xsl:text>%% quash navigation symbols
</xsl:text>
|