@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
|
@@ -81,6 +81,12 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
81
81
|
<!-- provisional cross-references show in red -->
|
|
82
82
|
<xsl:param name="author.tools" select="''" />
|
|
83
83
|
|
|
84
|
+
<!-- The Godot engine version used for GDScript. Read both by the -->
|
|
85
|
+
<!-- conversion to Runestone, for the Web Assembly shell, and by the -->
|
|
86
|
+
<!-- "pck" extraction, which runs as a separate command. A default -->
|
|
87
|
+
<!-- in each would let the two silently disagree. -->
|
|
88
|
+
<xsl:param name="godot.version" select="'4.6.3'"/>
|
|
89
|
+
|
|
84
90
|
<!-- ######### -->
|
|
85
91
|
<!-- Variables -->
|
|
86
92
|
<!-- ######### -->
|
|
@@ -2828,7 +2834,7 @@ Book (with parts), "section" at level 3
|
|
|
2828
2834
|
<xsl:value-of select="true()"/>
|
|
2829
2835
|
</xsl:template>
|
|
2830
2836
|
<!-- Introductions and Conclusions -->
|
|
2831
|
-
<xsl:template match="article/introduction|chapter/introduction|section/introduction|subsection/introduction|appendix/introduction|exercises/introduction|solutions/introduction|worksheet/introduction|handout/introduction|reading-questions/introduction|
|
|
2837
|
+
<xsl:template match="article/introduction|chapter/introduction|section/introduction|subsection/introduction|appendix/introduction|exercises/introduction|solutions/introduction|worksheet/introduction|handout/introduction|reading-questions/introduction|article/conclusion|chapter/conclusion|section/conclusion|subsection/conclusion|appendix/conclusion|exercises/conclusion|solutions/conclusion|worksheet/conclusion|handout/conclusion|reading-questions/conclusion" mode="title-wants-punctuation">
|
|
2832
2838
|
<xsl:value-of select="true()"/>
|
|
2833
2839
|
</xsl:template>
|
|
2834
2840
|
<xsl:template match="*" mode="title-wants-punctuation">
|
|
@@ -3201,7 +3207,7 @@ Book (with parts), "section" at level 3
|
|
|
3201
3207
|
<xsl:text>[</xsl:text>
|
|
3202
3208
|
<xsl:value-of select="$str-id" />
|
|
3203
3209
|
<xsl:text>]</xsl:text>
|
|
3204
|
-
<xsl:message>PTX:
|
|
3210
|
+
<xsl:message>PTX:WARNING: could not translate string with id "<xsl:value-of select="$str-id"/>" into language for code "<xsl:value-of select="$lang"/>"</xsl:message>
|
|
3205
3211
|
</xsl:otherwise>
|
|
3206
3212
|
</xsl:choose>
|
|
3207
3213
|
</xsl:template>
|
|
@@ -3217,6 +3223,19 @@ Book (with parts), "section" at level 3
|
|
|
3217
3223
|
</xsl:apply-templates>
|
|
3218
3224
|
</xsl:template>
|
|
3219
3225
|
|
|
3226
|
+
<!-- A bare appendix letter beside a title is ambiguous ("A Trip -->
|
|
3227
|
+
<!-- Abroad"), so wherever the letter and title compose on one line -->
|
|
3228
|
+
<!-- a period follows the letter: "A. Trip Abroad". A "solutions" -->
|
|
3229
|
+
<!-- division in the back matter shares the letter sequence (see -->
|
|
3230
|
+
<!-- "division-serial-number" in the assembly), so it is treated -->
|
|
3231
|
+
<!-- identically. Only the top-level letter: subdivision numbers -->
|
|
3232
|
+
<!-- ("A.2") are already unambiguous. Styling refinements are -->
|
|
3233
|
+
<!-- anticipated. -->
|
|
3234
|
+
<xsl:template match="*" mode="division-number-separator"/>
|
|
3235
|
+
<xsl:template match="appendix|backmatter/solutions" mode="division-number-separator">
|
|
3236
|
+
<xsl:text>.</xsl:text>
|
|
3237
|
+
</xsl:template>
|
|
3238
|
+
|
|
3220
3239
|
<!-- Most PreTeXt elements have names, and their localizations, indexed -->
|
|
3221
3240
|
<!-- by a "string-id" that is simply their local name. However, others -->
|
|
3222
3241
|
<!-- ("exercise" is archetypical) have names that vary according to their -->
|
|
@@ -3819,7 +3838,7 @@ Book (with parts), "section" at level 3
|
|
|
3819
3838
|
<xsl:text>has been encountered without a @label attribute. For reasons of backward-compatibility 
</xsl:text>
|
|
3820
3839
|
<xsl:text>we have used the value of an @xml:id. This may not be what you want, and as of 2024-02-15 
</xsl:text>
|
|
3821
3840
|
<xsl:text>is no longer best practice. You can copy the @xml:id value exactly into a new @label 
</xsl:text>
|
|
3822
|
-
<xsl:text>attribute and this
|
|
3841
|
+
<xsl:text>attribute and this message will stop AND your project's entries in any Runestone database 
</xsl:text>
|
|
3823
3842
|
<xsl:text>will be preserved and function exactly as before.
</xsl:text>
|
|
3824
3843
|
<xsl:text>[You may get more than one message about this instance.]
</xsl:text>
|
|
3825
3844
|
</xsl:message>
|
|
@@ -6484,7 +6503,7 @@ Book (with parts), "section" at level 3
|
|
|
6484
6503
|
<xsl:if test="@primary='no' or @secondary='yes'">
|
|
6485
6504
|
<xsl:text>Secondary </xsl:text>
|
|
6486
6505
|
</xsl:if>
|
|
6487
|
-
<xsl:value-of select="."/>
|
|
6506
|
+
<xsl:value-of select="normalize-space(.)"/>
|
|
6488
6507
|
<xsl:choose>
|
|
6489
6508
|
<xsl:when test="following-sibling::keyword[1][@primary='no' or @secondary='yes']">
|
|
6490
6509
|
<xsl:text>; </xsl:text>
|
|
@@ -7387,6 +7406,8 @@ Book (with parts), "section" at level 3
|
|
|
7387
7406
|
<language name="basic" active="" listings="Basic" prism="basic"/>
|
|
7388
7407
|
<language name="c" active="c" listings="C" prism="c"/>
|
|
7389
7408
|
<language name="cpp" active="cpp" listings="C++" prism="cpp"/>
|
|
7409
|
+
<!-- using Python as a closest match for now in listings. -->
|
|
7410
|
+
<language name="gdscript" active="gdscript" listings="Python" prism="gdscript"/>
|
|
7390
7411
|
<language name="go" active="" listings="C" prism="go"/>
|
|
7391
7412
|
<language name="java" active="java" listings="Java" prism="java"/>
|
|
7392
7413
|
<language name="javascript" active="javascript" listings="" prism="javascript"/>
|
|
@@ -7461,6 +7482,35 @@ Book (with parts), "section" at level 3
|
|
|
7461
7482
|
</xsl:if>
|
|
7462
7483
|
</xsl:variable>
|
|
7463
7484
|
|
|
7485
|
+
<!-- The content of a "slide" of a "slideshow" may be placed at -->
|
|
7486
|
+
<!-- the top, middle, or bottom of the slide. A document-wide -->
|
|
7487
|
+
<!-- default comes from "docinfo/defaults/slides/@valign"; absent -->
|
|
7488
|
+
<!-- an expressed preference, content is placed at the top. -->
|
|
7489
|
+
<xsl:variable name="slides-valign-default">
|
|
7490
|
+
<xsl:choose>
|
|
7491
|
+
<xsl:when test="$docinfo/defaults/slides/@valign">
|
|
7492
|
+
<xsl:value-of select="$docinfo/defaults/slides/@valign"/>
|
|
7493
|
+
</xsl:when>
|
|
7494
|
+
<xsl:otherwise>
|
|
7495
|
+
<xsl:text>top</xsl:text>
|
|
7496
|
+
</xsl:otherwise>
|
|
7497
|
+
</xsl:choose>
|
|
7498
|
+
</xsl:variable>
|
|
7499
|
+
|
|
7500
|
+
<!-- A "slide" may override the document-wide default with its -->
|
|
7501
|
+
<!-- own "@valign"; the conversions consult this modal template -->
|
|
7502
|
+
<!-- for the effective vertical alignment of a slide's content. -->
|
|
7503
|
+
<xsl:template match="slide" mode="valign">
|
|
7504
|
+
<xsl:choose>
|
|
7505
|
+
<xsl:when test="@valign">
|
|
7506
|
+
<xsl:value-of select="@valign"/>
|
|
7507
|
+
</xsl:when>
|
|
7508
|
+
<xsl:otherwise>
|
|
7509
|
+
<xsl:value-of select="$slides-valign-default"/>
|
|
7510
|
+
</xsl:otherwise>
|
|
7511
|
+
</xsl:choose>
|
|
7512
|
+
</xsl:template>
|
|
7513
|
+
|
|
7464
7514
|
<!-- Determine programming language to use. First choice is @language -->
|
|
7465
7515
|
<!-- on current element. If that is not available, check docinfo default. -->
|
|
7466
7516
|
<!-- "exercise" might be a Runestone interactive (programming) exercise. -->
|
|
@@ -9018,18 +9068,32 @@ Book (with parts), "section" at level 3
|
|
|
9018
9068
|
<!-- content override of type-prefix -->
|
|
9019
9069
|
<xsl:when test="$b-has-content">
|
|
9020
9070
|
<xsl:copy-of select="$custom-text" />
|
|
9021
|
-
<xsl:
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9071
|
+
<xsl:variable name="the-number">
|
|
9072
|
+
<xsl:apply-templates select="$target" mode="xref-number">
|
|
9073
|
+
<xsl:with-param name="xref" select="." />
|
|
9074
|
+
</xsl:apply-templates>
|
|
9075
|
+
</xsl:variable>
|
|
9076
|
+
<!-- an unnumbered target ("paragraphs", squelched -->
|
|
9077
|
+
<!-- numbering) contributes no separator, either -->
|
|
9078
|
+
<xsl:if test="not($the-number = '')">
|
|
9079
|
+
<xsl:apply-templates select="." mode="xref-text-separator"/>
|
|
9080
|
+
</xsl:if>
|
|
9081
|
+
<xsl:copy-of select="$the-number"/>
|
|
9025
9082
|
</xsl:when>
|
|
9026
9083
|
<!-- usual, default case -->
|
|
9027
9084
|
<xsl:otherwise>
|
|
9028
9085
|
<xsl:apply-templates select="$target" mode="type-name" />
|
|
9029
|
-
<xsl:
|
|
9030
|
-
|
|
9031
|
-
|
|
9032
|
-
|
|
9086
|
+
<xsl:variable name="the-number">
|
|
9087
|
+
<xsl:apply-templates select="$target" mode="xref-number">
|
|
9088
|
+
<xsl:with-param name="xref" select="." />
|
|
9089
|
+
</xsl:apply-templates>
|
|
9090
|
+
</xsl:variable>
|
|
9091
|
+
<!-- an unnumbered target ("paragraphs", squelched -->
|
|
9092
|
+
<!-- numbering) contributes no separator, either -->
|
|
9093
|
+
<xsl:if test="not($the-number = '')">
|
|
9094
|
+
<xsl:apply-templates select="." mode="xref-text-separator"/>
|
|
9095
|
+
</xsl:if>
|
|
9096
|
+
<xsl:copy-of select="$the-number"/>
|
|
9033
9097
|
</xsl:otherwise>
|
|
9034
9098
|
</xsl:choose>
|
|
9035
9099
|
</xsl:when>
|
|
@@ -9038,14 +9102,50 @@ Book (with parts), "section" at level 3
|
|
|
9038
9102
|
<!-- content override of type-prefix -->
|
|
9039
9103
|
<xsl:when test="$b-has-content">
|
|
9040
9104
|
<xsl:copy-of select="$custom-text" />
|
|
9041
|
-
<xsl:
|
|
9042
|
-
|
|
9105
|
+
<xsl:variable name="the-number">
|
|
9106
|
+
<xsl:apply-templates select="$target" mode="serial-number" />
|
|
9107
|
+
</xsl:variable>
|
|
9108
|
+
<!-- an unnumbered target ("paragraphs", squelched -->
|
|
9109
|
+
<!-- numbering) contributes no separator, either -->
|
|
9110
|
+
<xsl:if test="not($the-number = '')">
|
|
9111
|
+
<xsl:apply-templates select="." mode="xref-text-separator"/>
|
|
9112
|
+
</xsl:if>
|
|
9113
|
+
<!-- a task's local serial reads as its rendered -->
|
|
9114
|
+
<!-- label: "Task (a)", not "Task a" -->
|
|
9115
|
+
<xsl:choose>
|
|
9116
|
+
<xsl:when test="$target/self::task">
|
|
9117
|
+
<xsl:text>(</xsl:text>
|
|
9118
|
+
<xsl:copy-of select="$the-number"/>
|
|
9119
|
+
<xsl:text>)</xsl:text>
|
|
9120
|
+
</xsl:when>
|
|
9121
|
+
<xsl:otherwise>
|
|
9122
|
+
<xsl:copy-of select="$the-number"/>
|
|
9123
|
+
</xsl:otherwise>
|
|
9124
|
+
</xsl:choose>
|
|
9043
9125
|
</xsl:when>
|
|
9044
9126
|
<!-- usual, default case -->
|
|
9045
9127
|
<xsl:otherwise>
|
|
9046
9128
|
<xsl:apply-templates select="$target" mode="type-name" />
|
|
9047
|
-
<xsl:
|
|
9048
|
-
|
|
9129
|
+
<xsl:variable name="the-number">
|
|
9130
|
+
<xsl:apply-templates select="$target" mode="serial-number" />
|
|
9131
|
+
</xsl:variable>
|
|
9132
|
+
<!-- an unnumbered target ("paragraphs", squelched -->
|
|
9133
|
+
<!-- numbering) contributes no separator, either -->
|
|
9134
|
+
<xsl:if test="not($the-number = '')">
|
|
9135
|
+
<xsl:apply-templates select="." mode="xref-text-separator"/>
|
|
9136
|
+
</xsl:if>
|
|
9137
|
+
<!-- a task's local serial reads as its rendered -->
|
|
9138
|
+
<!-- label: "Task (a)", not "Task a" -->
|
|
9139
|
+
<xsl:choose>
|
|
9140
|
+
<xsl:when test="$target/self::task">
|
|
9141
|
+
<xsl:text>(</xsl:text>
|
|
9142
|
+
<xsl:copy-of select="$the-number"/>
|
|
9143
|
+
<xsl:text>)</xsl:text>
|
|
9144
|
+
</xsl:when>
|
|
9145
|
+
<xsl:otherwise>
|
|
9146
|
+
<xsl:copy-of select="$the-number"/>
|
|
9147
|
+
</xsl:otherwise>
|
|
9148
|
+
</xsl:choose>
|
|
9049
9149
|
</xsl:otherwise>
|
|
9050
9150
|
</xsl:choose>
|
|
9051
9151
|
</xsl:when>
|
|
@@ -9060,19 +9160,26 @@ Book (with parts), "section" at level 3
|
|
|
9060
9160
|
<xsl:apply-templates select="$target" mode="type-name" />
|
|
9061
9161
|
</xsl:otherwise>
|
|
9062
9162
|
</xsl:choose>
|
|
9063
|
-
<xsl:apply-templates select="." mode="xref-text-separator"/>
|
|
9064
9163
|
<!-- only difference in behavior is global/local number -->
|
|
9065
|
-
<xsl:
|
|
9066
|
-
<xsl:
|
|
9067
|
-
<xsl:
|
|
9068
|
-
<xsl:
|
|
9069
|
-
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
<xsl:
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
|
|
9164
|
+
<xsl:variable name="the-number">
|
|
9165
|
+
<xsl:choose>
|
|
9166
|
+
<xsl:when test="$text-style = 'type-global-title'">
|
|
9167
|
+
<xsl:apply-templates select="$target" mode="xref-number">
|
|
9168
|
+
<xsl:with-param name="xref" select="." />
|
|
9169
|
+
</xsl:apply-templates>
|
|
9170
|
+
</xsl:when>
|
|
9171
|
+
<xsl:when test="$text-style = 'type-local-title'">
|
|
9172
|
+
<xsl:apply-templates select="$target" mode="serial-number"/>
|
|
9173
|
+
</xsl:when>
|
|
9174
|
+
<xsl:otherwise/>
|
|
9175
|
+
</xsl:choose>
|
|
9176
|
+
</xsl:variable>
|
|
9177
|
+
<!-- an unnumbered target ("paragraphs", squelched -->
|
|
9178
|
+
<!-- numbering) contributes no separator, either -->
|
|
9179
|
+
<xsl:if test="not($the-number = '')">
|
|
9180
|
+
<xsl:apply-templates select="." mode="xref-text-separator"/>
|
|
9181
|
+
</xsl:if>
|
|
9182
|
+
<xsl:copy-of select="$the-number"/>
|
|
9076
9183
|
<xsl:variable name="the-title">
|
|
9077
9184
|
<xsl:apply-templates select="$target" mode="title-xref"/>
|
|
9078
9185
|
</xsl:variable>
|
|
@@ -11902,6 +12009,27 @@ http://andrewmccarthy.ie/2014/11/06/swung-dash-in-latex/
|
|
|
11902
12009
|
<xsl:with-param name="message" select="'the document-wide style of cross-reference text is now a "text" attribute on an "xrefs" element within "docinfo/defaults", replacing the "cross-references" element. We will honor your intent, but please convert to the new form.'"/>
|
|
11903
12010
|
</xsl:call-template>
|
|
11904
12011
|
<!-- -->
|
|
12012
|
+
<!-- 2026-07-31 a footnote within a "tabular" cell becomes a "tn" table note -->
|
|
12013
|
+
<xsl:call-template name="deprecation-message">
|
|
12014
|
+
<xsl:with-param name="occurrences" select=""$document-root//tabular//fn"" />
|
|
12015
|
+
<xsl:with-param name="date-string" select="'2026-07-31'" />
|
|
12016
|
+
<xsl:with-param name="message" select="'a footnote ("fn") within a "tabular" cell is now a table note, the "tn" element, lettered and placed at the bottom of the table. We will honor your intent, but please convert to "tn". Note that a table note is not part of the numbering of true footnotes, and is not a target for a cross-reference.'"/>
|
|
12017
|
+
</xsl:call-template>
|
|
12018
|
+
<!-- -->
|
|
12019
|
+
<!-- 2026-08-06 references "introduction" is now a "headnote" -->
|
|
12020
|
+
<xsl:call-template name="deprecation-message">
|
|
12021
|
+
<xsl:with-param name="occurrences" select=""$document-root//references/introduction"" />
|
|
12022
|
+
<xsl:with-param name="date-string" select="'2026-08-06'" />
|
|
12023
|
+
<xsl:with-param name="message" select="'a "references" "introduction" is now a "headnote". We will attempt to fix your source, but a "title" on such an "introduction" is discarded entirely: its text will not appear in any output. Please convert to a "headnote" yourself'"/>
|
|
12024
|
+
</xsl:call-template>
|
|
12025
|
+
<!-- -->
|
|
12026
|
+
<!-- 2026-08-06 references "conclusion" is obsolete -->
|
|
12027
|
+
<xsl:call-template name="deprecation-message">
|
|
12028
|
+
<xsl:with-param name="occurrences" select=""$document-root//references/conclusion"" />
|
|
12029
|
+
<xsl:with-param name="date-string" select="'2026-08-06'" />
|
|
12030
|
+
<xsl:with-param name="message" select="'a "references" division no longer has a "conclusion". The element is discarded entirely: its content will not appear in any output. Please relocate the content, perhaps following the "references"'"/>
|
|
12031
|
+
</xsl:call-template>
|
|
12032
|
+
<!-- -->
|
|
11905
12033
|
</xsl:template>
|
|
11906
12034
|
|
|
11907
12035
|
<!-- Miscellaneous -->
|
|
@@ -1403,11 +1403,6 @@
|
|
|
1403
1403
|
</xsl:template>
|
|
1404
1404
|
|
|
1405
1405
|
<!-- Footnotes -->
|
|
1406
|
-
<!-- First disable the "footnote" popping routine used to -->
|
|
1407
|
-
<!-- move the content out of HTML structures where it is -->
|
|
1408
|
-
<!-- not welcome (e.g a "p" inside a "p"). -->
|
|
1409
|
-
<xsl:template match="*" mode="pop-footnote-text"/>
|
|
1410
|
-
|
|
1411
1406
|
<!-- Drop a marker as a superscript -->
|
|
1412
1407
|
<xsl:template match="fn">
|
|
1413
1408
|
<xsl:variable name="hid">
|
|
@@ -430,6 +430,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
430
430
|
</xsl:variable>
|
|
431
431
|
<xsl:if test="not($the-number = '')">
|
|
432
432
|
<xsl:value-of select="$the-number"/>
|
|
433
|
+
<xsl:apply-templates select="." mode="division-number-separator"/>
|
|
433
434
|
<xsl:text> </xsl:text>
|
|
434
435
|
</xsl:if>
|
|
435
436
|
<xsl:variable name="the-title">
|
|
@@ -498,11 +499,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
498
499
|
</xsl:template>
|
|
499
500
|
|
|
500
501
|
<xsl:template match="affiliation">
|
|
501
|
-
<xsl:apply-templates select="department|institution|location"/>
|
|
502
|
+
<xsl:apply-templates select="position|department|institution|location"/>
|
|
502
503
|
</xsl:template>
|
|
503
504
|
|
|
504
505
|
<!-- each is a line, or authored "line"s, of the address block -->
|
|
505
|
-
<xsl:template match="department|institution|location">
|
|
506
|
+
<xsl:template match="position|department|institution|location">
|
|
506
507
|
<xsl:choose>
|
|
507
508
|
<xsl:when test="line">
|
|
508
509
|
<xsl:apply-templates select="line"/>
|
|
@@ -731,6 +732,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
731
732
|
<xsl:apply-templates select="." mode="link-id-attribute"/>
|
|
732
733
|
<xsl:if test="not($the-number = '')">
|
|
733
734
|
<xsl:value-of select="$the-number"/>
|
|
735
|
+
<xsl:apply-templates select="." mode="division-number-separator"/>
|
|
734
736
|
<xsl:text> </xsl:text>
|
|
735
737
|
</xsl:if>
|
|
736
738
|
<xsl:apply-templates select="." mode="title-full"/>
|
|
@@ -1431,24 +1433,32 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1431
1433
|
<xsl:apply-templates select="." mode="exercise-heading"/>
|
|
1432
1434
|
<xsl:text> </xsl:text>
|
|
1433
1435
|
</xsl:variable>
|
|
1436
|
+
<!-- The component switches must pass as genuine booleans: a -->
|
|
1437
|
+
<!-- with-param carrying *content* is a result tree fragment, -->
|
|
1438
|
+
<!-- and any fragment, even one whose text is "false", is true -->
|
|
1439
|
+
<!-- in the boolean tests downstream. So: compute the strings, -->
|
|
1440
|
+
<!-- pass comparisons. -->
|
|
1441
|
+
<xsl:variable name="has-hint">
|
|
1442
|
+
<xsl:apply-templates select="." mode="b-main-text-component">
|
|
1443
|
+
<xsl:with-param name="component" select="'hint'"/>
|
|
1444
|
+
</xsl:apply-templates>
|
|
1445
|
+
</xsl:variable>
|
|
1446
|
+
<xsl:variable name="has-answer">
|
|
1447
|
+
<xsl:apply-templates select="." mode="b-main-text-component">
|
|
1448
|
+
<xsl:with-param name="component" select="'answer'"/>
|
|
1449
|
+
</xsl:apply-templates>
|
|
1450
|
+
</xsl:variable>
|
|
1451
|
+
<xsl:variable name="has-solution">
|
|
1452
|
+
<xsl:apply-templates select="." mode="b-main-text-component">
|
|
1453
|
+
<xsl:with-param name="component" select="'solution'"/>
|
|
1454
|
+
</xsl:apply-templates>
|
|
1455
|
+
</xsl:variable>
|
|
1434
1456
|
<xsl:apply-templates select="." mode="exercise-components">
|
|
1435
1457
|
<xsl:with-param name="b-original" select="true()"/>
|
|
1436
1458
|
<xsl:with-param name="b-has-statement" select="true()"/>
|
|
1437
|
-
<xsl:with-param name="b-has-hint"
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
</xsl:apply-templates>
|
|
1441
|
-
</xsl:with-param>
|
|
1442
|
-
<xsl:with-param name="b-has-answer">
|
|
1443
|
-
<xsl:apply-templates select="." mode="b-main-text-component">
|
|
1444
|
-
<xsl:with-param name="component" select="'answer'"/>
|
|
1445
|
-
</xsl:apply-templates>
|
|
1446
|
-
</xsl:with-param>
|
|
1447
|
-
<xsl:with-param name="b-has-solution">
|
|
1448
|
-
<xsl:apply-templates select="." mode="b-main-text-component">
|
|
1449
|
-
<xsl:with-param name="component" select="'solution'"/>
|
|
1450
|
-
</xsl:apply-templates>
|
|
1451
|
-
</xsl:with-param>
|
|
1459
|
+
<xsl:with-param name="b-has-hint" select="$has-hint = 'true'"/>
|
|
1460
|
+
<xsl:with-param name="b-has-answer" select="$has-answer = 'true'"/>
|
|
1461
|
+
<xsl:with-param name="b-has-solution" select="$has-solution = 'true'"/>
|
|
1452
1462
|
<xsl:with-param name="run-in-heading" select="$heading"/>
|
|
1453
1463
|
</xsl:apply-templates>
|
|
1454
1464
|
<!-- writing space below, in a printout, when requested -->
|
|
@@ -2346,6 +2356,19 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2346
2356
|
<xsl:apply-templates select="row[not(@header = 'yes') and not(@header = 'vertical')]"/>
|
|
2347
2357
|
</fo:table-body>
|
|
2348
2358
|
</fo:table>
|
|
2359
|
+
<!-- Table notes ("tn") collect just below the table, lettered in -->
|
|
2360
|
+
<!-- reading order, which is document order of the marks (Notes -->
|
|
2361
|
+
<!-- to tables: CMoS 18th ed., 3.77-3.81; specific notes at -->
|
|
2362
|
+
<!-- 3.80). Disjoint from true footnote numbering. -->
|
|
2363
|
+
<xsl:for-each select=".//tn">
|
|
2364
|
+
<fo:block font-size="80%" text-align="{$text-alignment}" text-align-last="start" space-before="0.25em">
|
|
2365
|
+
<fo:inline baseline-shift="35%" font-size="70%" font-style="italic">
|
|
2366
|
+
<xsl:apply-templates select="." mode="number"/>
|
|
2367
|
+
</fo:inline>
|
|
2368
|
+
<xsl:text> </xsl:text>
|
|
2369
|
+
<xsl:apply-templates/>
|
|
2370
|
+
</fo:block>
|
|
2371
|
+
</xsl:for-each>
|
|
2349
2372
|
</xsl:template>
|
|
2350
2373
|
|
|
2351
2374
|
<!-- An estimated width, in points, for each of a tabular's columns, -->
|
|
@@ -2455,6 +2478,13 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2455
2478
|
|
|
2456
2479
|
<xsl:template match="fn" mode="width-text"/>
|
|
2457
2480
|
|
|
2481
|
+
<!-- A table note's text sets below the table, so a cell is only -->
|
|
2482
|
+
<!-- as wide as its mark: one superscript letter, roughly one -->
|
|
2483
|
+
<!-- character. -->
|
|
2484
|
+
<xsl:template match="tn" mode="width-text">
|
|
2485
|
+
<xsl:text>a</xsl:text>
|
|
2486
|
+
</xsl:template>
|
|
2487
|
+
|
|
2458
2488
|
<!-- A cross-reference's displayed text is generated, never in -->
|
|
2459
2489
|
<!-- the source, so render it via the shared "xref-text" (driven -->
|
|
2460
2490
|
<!-- by the resolved text style) rather than measure an empty -->
|
|
@@ -3179,42 +3209,65 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3179
3209
|
<!-- Figures and Caption -->
|
|
3180
3210
|
<!-- ################### -->
|
|
3181
3211
|
|
|
3182
|
-
<!-- The FIGURE-LIKE blocks
|
|
3183
|
-
<!--
|
|
3184
|
-
<!--
|
|
3185
|
-
<!--
|
|
3186
|
-
<!--
|
|
3187
|
-
<!--
|
|
3188
|
-
<!--
|
|
3189
|
-
<!--
|
|
3212
|
+
<!-- The FIGURE-LIKE blocks: a "figure" wraps its contents and -->
|
|
3213
|
+
<!-- finishes with its caption below, while the titled blocks -->
|
|
3214
|
+
<!-- ("table", "listing", "list") lead with their title above, -->
|
|
3215
|
+
<!-- as the other conversions do. Either way the heading is a -->
|
|
3216
|
+
<!-- body-aligned paragraph led by a bold run-in (the type name -->
|
|
3217
|
+
<!-- and number), so a long caption or title sets as ordinary -->
|
|
3218
|
+
<!-- prose, not centered ragged lines. All share one counter. -->
|
|
3219
|
+
<!-- The "caption" element is consumed here, so it is killed in -->
|
|
3220
|
+
<!-- the default mode, with the rest of the metadata. -->
|
|
3190
3221
|
<xsl:template match="&FIGURE-LIKE;">
|
|
3191
3222
|
<xsl:apply-templates select="." mode="forced-pagebreak"/>
|
|
3192
3223
|
<fo:block space-before="1em" space-after="1em">
|
|
3193
3224
|
<xsl:apply-templates select="." mode="link-id-attribute"/>
|
|
3225
|
+
<xsl:if test="not(self::figure)">
|
|
3226
|
+
<xsl:apply-templates select="." mode="figure-like-heading"/>
|
|
3227
|
+
</xsl:if>
|
|
3194
3228
|
<xsl:apply-templates select="*"/>
|
|
3195
|
-
<
|
|
3196
|
-
<
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
<xsl:
|
|
3208
|
-
|
|
3209
|
-
<xsl:
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
<xsl:
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3229
|
+
<xsl:if test="self::figure">
|
|
3230
|
+
<xsl:apply-templates select="." mode="figure-like-heading"/>
|
|
3231
|
+
</xsl:if>
|
|
3232
|
+
</fo:block>
|
|
3233
|
+
</xsl:template>
|
|
3234
|
+
|
|
3235
|
+
<!-- The caption of a "figure" (set below, held to its content), or -->
|
|
3236
|
+
<!-- the title of a "table"/"listing"/"list" (set above, held to -->
|
|
3237
|
+
<!-- its content). -->
|
|
3238
|
+
<xsl:template match="&FIGURE-LIKE;" mode="figure-like-heading">
|
|
3239
|
+
<fo:block text-align="{$text-alignment}">
|
|
3240
|
+
<xsl:choose>
|
|
3241
|
+
<xsl:when test="self::figure">
|
|
3242
|
+
<xsl:attribute name="space-before">0.5em</xsl:attribute>
|
|
3243
|
+
<xsl:attribute name="keep-with-previous.within-page">always</xsl:attribute>
|
|
3244
|
+
</xsl:when>
|
|
3245
|
+
<xsl:otherwise>
|
|
3246
|
+
<xsl:attribute name="space-after">0.5em</xsl:attribute>
|
|
3247
|
+
<xsl:attribute name="keep-with-next.within-page">always</xsl:attribute>
|
|
3248
|
+
</xsl:otherwise>
|
|
3249
|
+
</xsl:choose>
|
|
3250
|
+
<fo:inline font-weight="bold">
|
|
3251
|
+
<xsl:apply-templates select="." mode="type-name"/>
|
|
3252
|
+
<xsl:variable name="the-number">
|
|
3253
|
+
<xsl:apply-templates select="." mode="number"/>
|
|
3254
|
+
</xsl:variable>
|
|
3255
|
+
<xsl:if test="not($the-number = '')">
|
|
3256
|
+
<xsl:text> </xsl:text>
|
|
3257
|
+
<xsl:value-of select="$the-number"/>
|
|
3258
|
+
</xsl:if>
|
|
3259
|
+
<xsl:text>.</xsl:text>
|
|
3260
|
+
</fo:inline>
|
|
3261
|
+
<xsl:text> </xsl:text>
|
|
3262
|
+
<xsl:choose>
|
|
3263
|
+
<xsl:when test="self::figure">
|
|
3264
|
+
<xsl:apply-templates select="caption/node()"/>
|
|
3265
|
+
</xsl:when>
|
|
3266
|
+
<!-- "table", "listing", "list" are titled -->
|
|
3267
|
+
<xsl:otherwise>
|
|
3268
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
3269
|
+
</xsl:otherwise>
|
|
3270
|
+
</xsl:choose>
|
|
3218
3271
|
</fo:block>
|
|
3219
3272
|
</xsl:template>
|
|
3220
3273
|
|
|
@@ -3624,6 +3677,15 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3624
3677
|
<!-- text, and the body, marked again, collected at the bottom of -->
|
|
3625
3678
|
<!-- the page above the separator rule defined in the entry -->
|
|
3626
3679
|
<!-- template. The footnote number is the serial machinery's. -->
|
|
3680
|
+
<!-- A table note ("tn") drops only its superscript letter mark at -->
|
|
3681
|
+
<!-- the cell location; the note text collects below the table, in -->
|
|
3682
|
+
<!-- the "tabular" template. No footnote machinery is involved. -->
|
|
3683
|
+
<xsl:template match="tabular//tn">
|
|
3684
|
+
<fo:inline baseline-shift="35%" font-size="70%" font-style="italic">
|
|
3685
|
+
<xsl:apply-templates select="." mode="number"/>
|
|
3686
|
+
</fo:inline>
|
|
3687
|
+
</xsl:template>
|
|
3688
|
+
|
|
3627
3689
|
<xsl:template match="fn">
|
|
3628
3690
|
<xsl:variable name="the-mark">
|
|
3629
3691
|
<xsl:apply-templates select="." mode="serial-number"/>
|