@pretextbook/pretext-html 0.18.0 → 0.18.1
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/upstream.json +2 -2
- package/assets/xsl/AGENTS.md +34 -0
- package/assets/xsl/entities.ent +5 -3
- package/assets/xsl/extract-biblio-csl.xsl +55 -48
- package/assets/xsl/pretext-common.xsl +228 -164
- package/assets/xsl/pretext-epub.xsl +10 -0
- package/assets/xsl/pretext-fo.xsl +183 -62
- package/assets/xsl/pretext-html.xsl +92 -20
- package/assets/xsl/pretext-jupyter.xsl +3 -0
- package/assets/xsl/pretext-latex-common.xsl +20 -1
- package/assets/xsl/pretext-numbers.xsl +31 -24
- package/assets/xsl/pretext-revealjs.xsl +3 -2
- package/assets/xsl/pretext-runestone.xsl +162 -9
- package/assets/xsl/publisher-variables.xsl +10 -1
- package/assets/xsl-bundle.json +1 -1
- package/dist/{cli-CKAOX3L6.js → cli-CddPgMt-.js} +4 -4
- package/dist/cli.js +1 -1
- package/dist/html-static.d.ts +2 -2
- package/dist/index.browser.js +5 -5
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -2300,7 +2300,8 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2300
2300
|
</xsl:template>
|
|
2301
2301
|
|
|
2302
2302
|
<!-- hN, type name, serial number, title (if exists) -->
|
|
2303
|
-
<!-- exercise (divisional, xref-content)
|
|
2303
|
+
<!-- exercise (divisional, xref-content) -->
|
|
2304
|
+
<!-- DISCUSSION-LIKE (when born) -->
|
|
2304
2305
|
<xsl:template match="*" mode="heading-divisional-exercise-typed">
|
|
2305
2306
|
<xsl:param name="heading-level"/>
|
|
2306
2307
|
<xsl:apply-templates select="." mode="heading-generic">
|
|
@@ -4634,10 +4635,13 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4634
4635
|
<xsl:text> discussion-like</xsl:text>
|
|
4635
4636
|
</xsl:template>
|
|
4636
4637
|
|
|
4637
|
-
<!-- When born use this heading -->
|
|
4638
|
+
<!-- When born use this heading: the position alone, among the -->
|
|
4639
|
+
<!-- appendages of the parent, as in the LaTeX conversion, and -->
|
|
4640
|
+
<!-- as a SOLUTION-LIKE is headed. A cross-reference, and the -->
|
|
4641
|
+
<!-- knowl it opens, carry the full number. -->
|
|
4638
4642
|
<xsl:template match="&DISCUSSION-LIKE;" mode="heading-birth">
|
|
4639
4643
|
<xsl:param name="heading-level"/>
|
|
4640
|
-
<xsl:apply-templates select="." mode="heading-
|
|
4644
|
+
<xsl:apply-templates select="." mode="heading-divisional-exercise-typed">
|
|
4641
4645
|
<xsl:with-param name="heading-level" select="$heading-level"/>
|
|
4642
4646
|
</xsl:apply-templates>
|
|
4643
4647
|
</xsl:template>
|
|
@@ -6412,6 +6416,10 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
6412
6416
|
<xsl:text>%;</xsl:text>
|
|
6413
6417
|
</xsl:attribute>
|
|
6414
6418
|
<xsl:apply-templates select="." mode="image-inclusion"/>
|
|
6419
|
+
<!-- possibly give a long description -->
|
|
6420
|
+
<xsl:apply-templates select="." mode="description">
|
|
6421
|
+
<xsl:with-param name="layout" select="$layout"/>
|
|
6422
|
+
</xsl:apply-templates>
|
|
6415
6423
|
</div>
|
|
6416
6424
|
</xsl:template>
|
|
6417
6425
|
|
|
@@ -6429,6 +6437,8 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
6429
6437
|
<xsl:template match="image[&SBS-LAYOUT-FILTER;]">
|
|
6430
6438
|
<div class="image-box">
|
|
6431
6439
|
<xsl:apply-templates select="." mode="image-inclusion" />
|
|
6440
|
+
<!-- possibly give a long description -->
|
|
6441
|
+
<xsl:apply-templates select="." mode="description"/>
|
|
6432
6442
|
</div>
|
|
6433
6443
|
</xsl:template>
|
|
6434
6444
|
|
|
@@ -6480,8 +6490,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
6480
6490
|
<xsl:apply-templates select="." mode="archive">
|
|
6481
6491
|
<xsl:with-param name="base-pathname" select="$location"/>
|
|
6482
6492
|
</xsl:apply-templates>
|
|
6483
|
-
<!-- possibly give a long description -->
|
|
6484
|
-
<xsl:apply-templates select="." mode="description"/>
|
|
6485
6493
|
</xsl:when>
|
|
6486
6494
|
<!-- with extension, just include it -->
|
|
6487
6495
|
<xsl:otherwise>
|
|
@@ -6530,8 +6538,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
6530
6538
|
</xsl:call-template>
|
|
6531
6539
|
</xsl:with-param>
|
|
6532
6540
|
</xsl:apply-templates>
|
|
6533
|
-
<!-- possibly give a long description -->
|
|
6534
|
-
<xsl:apply-templates select="." mode="description"/>
|
|
6535
6541
|
</xsl:otherwise>
|
|
6536
6542
|
</xsl:choose>
|
|
6537
6543
|
</xsl:template>
|
|
@@ -6599,8 +6605,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
6599
6605
|
<xsl:apply-templates select="." mode="archive">
|
|
6600
6606
|
<xsl:with-param name="base-pathname" select="$base-pathname" />
|
|
6601
6607
|
</xsl:apply-templates>
|
|
6602
|
-
<!-- possibly give a long description -->
|
|
6603
|
-
<xsl:apply-templates select="." mode="description"/>
|
|
6604
6608
|
</xsl:template>
|
|
6605
6609
|
|
|
6606
6610
|
<xsl:template match="image[sageplot]" mode="image-inclusion">
|
|
@@ -6634,8 +6638,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
6634
6638
|
<xsl:apply-templates select="." mode="archive">
|
|
6635
6639
|
<xsl:with-param name="base-pathname" select="$base-pathname" />
|
|
6636
6640
|
</xsl:apply-templates>
|
|
6637
|
-
<!-- possibly give a long description -->
|
|
6638
|
-
<xsl:apply-templates select="." mode="description"/>
|
|
6639
6641
|
</xsl:template>
|
|
6640
6642
|
|
|
6641
6643
|
<!-- Asymptote graphics language -->
|
|
@@ -6737,8 +6739,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
6737
6739
|
<a href="{$image-html-url}">Link to full-sized image</a>
|
|
6738
6740
|
</div>
|
|
6739
6741
|
</xsl:if>
|
|
6740
|
-
<!-- possibly give a long description -->
|
|
6741
|
-
<xsl:apply-templates select="." mode="description"/>
|
|
6742
6742
|
</xsl:template>
|
|
6743
6743
|
|
|
6744
6744
|
<!-- The infrastructure for an SVG or PNG image -->
|
|
@@ -6900,7 +6900,12 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
6900
6900
|
</xsl:template>
|
|
6901
6901
|
|
|
6902
6902
|
|
|
6903
|
+
<!-- The "layout" parameter is the node-set of layout parameters an -->
|
|
6904
|
+
<!-- "image" template has already computed, passed along so that it -->
|
|
6905
|
+
<!-- is computed only once. An "interactive" has no need of it. -->
|
|
6903
6906
|
<xsl:template match="image|interactive[@platform|@desmos|@calcplot3d|@circuitjs|@iframe]" mode="description">
|
|
6907
|
+
<xsl:param name="layout" select="/.."/>
|
|
6908
|
+
|
|
6904
6909
|
<xsl:if test="description">
|
|
6905
6910
|
<!-- @aria-live means screenreaders will make announcements -->
|
|
6906
6911
|
<details class="image-description" aria-live="polite">
|
|
@@ -6913,12 +6918,67 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
6913
6918
|
<xsl:attribute name="id">
|
|
6914
6919
|
<xsl:apply-templates select="." mode="describedby-id"/>
|
|
6915
6920
|
</xsl:attribute>
|
|
6921
|
+
<xsl:apply-templates select="." mode="description-style">
|
|
6922
|
+
<xsl:with-param name="layout" select="$layout"/>
|
|
6923
|
+
</xsl:apply-templates>
|
|
6916
6924
|
<xsl:apply-templates select="description"/>
|
|
6917
6925
|
</div>
|
|
6918
6926
|
</details>
|
|
6919
6927
|
</xsl:if>
|
|
6920
6928
|
</xsl:template>
|
|
6921
6929
|
|
|
6930
|
+
<!-- A revealed description spans 80% of the width available where -->
|
|
6931
|
+
<!-- its image sits, however narrow the image. An image's div is -->
|
|
6932
|
+
<!-- only as wide as the image, and percentages for the description -->
|
|
6933
|
+
<!-- are relative to that width, so we compute them here from the -->
|
|
6934
|
+
<!-- image's layout (all percentages of the available width), which -->
|
|
6935
|
+
<!-- arrives as the "layout" parameter. The description is centered -->
|
|
6936
|
+
<!-- on the image, but kept within the available width, so an image -->
|
|
6937
|
+
<!-- placed off-center by @margins does not push its description out -->
|
|
6938
|
+
<!-- of the text. -->
|
|
6939
|
+
<xsl:template match="image[not(&SBS-LAYOUT-FILTER;)]" mode="description-style">
|
|
6940
|
+
<xsl:param name="layout" select="/.."/>
|
|
6941
|
+
|
|
6942
|
+
<xsl:variable name="width" select="number($layout/width)"/>
|
|
6943
|
+
<xsl:variable name="left" select="number($layout/left-margin)"/>
|
|
6944
|
+
<!-- left edge of the description, centered on the image -->
|
|
6945
|
+
<xsl:variable name="centered" select="$left + $width div 2 - 40"/>
|
|
6946
|
+
<!-- clamped to the range 0..20, so it ends within the available width -->
|
|
6947
|
+
<xsl:variable name="start">
|
|
6948
|
+
<xsl:choose>
|
|
6949
|
+
<xsl:when test="$centered < 0">
|
|
6950
|
+
<xsl:value-of select="0"/>
|
|
6951
|
+
</xsl:when>
|
|
6952
|
+
<xsl:when test="$centered > 20">
|
|
6953
|
+
<xsl:value-of select="20"/>
|
|
6954
|
+
</xsl:when>
|
|
6955
|
+
<xsl:otherwise>
|
|
6956
|
+
<xsl:value-of select="$centered"/>
|
|
6957
|
+
</xsl:otherwise>
|
|
6958
|
+
</xsl:choose>
|
|
6959
|
+
</xsl:variable>
|
|
6960
|
+
<xsl:if test="$width > 0">
|
|
6961
|
+
<xsl:attribute name="style">
|
|
6962
|
+
<xsl:text>width: </xsl:text>
|
|
6963
|
+
<xsl:value-of select="format-number(8000 div $width, '0.##')"/>
|
|
6964
|
+
<xsl:text>%; margin-left: </xsl:text>
|
|
6965
|
+
<xsl:value-of select="format-number(($start - $left) * 100 div $width, '0.##')"/>
|
|
6966
|
+
<xsl:text>%;</xsl:text>
|
|
6967
|
+
</xsl:attribute>
|
|
6968
|
+
</xsl:if>
|
|
6969
|
+
</xsl:template>
|
|
6970
|
+
|
|
6971
|
+
<!-- An interactive is centered in a container that spans the -->
|
|
6972
|
+
<!-- available width, so its description is simply centered -->
|
|
6973
|
+
<xsl:template match="interactive[not(&SBS-LAYOUT-FILTER;)]" mode="description-style">
|
|
6974
|
+
<xsl:attribute name="style">
|
|
6975
|
+
<xsl:text>width: 80%; margin-left: 10%;</xsl:text>
|
|
6976
|
+
</xsl:attribute>
|
|
6977
|
+
</xsl:template>
|
|
6978
|
+
|
|
6979
|
+
<!-- In a panel of a "sidebyside" a description fills the panel -->
|
|
6980
|
+
<xsl:template match="image|interactive" mode="description-style"/>
|
|
6981
|
+
|
|
6922
6982
|
<!-- Utility template so "aria-describedby" values are consistent -->
|
|
6923
6983
|
<xsl:template match="image|interactive[@platform|@desmos|@calcplot3d|@circuitjs|@iframe]" mode="describedby-id">
|
|
6924
6984
|
<xsl:apply-templates select="." mode="unique-id"/>
|
|
@@ -7388,9 +7448,12 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
7388
7448
|
<!-- we compute pixels in the parameter value, which become -->
|
|
7389
7449
|
<!-- YT-specific attributes, so we can't use general template -->
|
|
7390
7450
|
<!-- providing standard attributes -->
|
|
7451
|
+
<xsl:variable name="local-design-width">
|
|
7452
|
+
<xsl:apply-templates select="." mode="get-design-width"/>
|
|
7453
|
+
</xsl:variable>
|
|
7391
7454
|
<xsl:apply-templates select="." mode="runestone-youtube-embed">
|
|
7392
|
-
<xsl:with-param name="width" select="($layout/width * $design-width) div 100"/>
|
|
7393
|
-
<xsl:with-param name="height" select="($layout/height * $design-width) div 100"/>
|
|
7455
|
+
<xsl:with-param name="width" select="($layout/width * $local-design-width) div 100"/>
|
|
7456
|
+
<xsl:with-param name="height" select="($layout/height * $local-design-width) div 100"/>
|
|
7394
7457
|
</xsl:apply-templates>
|
|
7395
7458
|
</xsl:when>
|
|
7396
7459
|
<xsl:otherwise>
|
|
@@ -8466,6 +8529,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
8466
8529
|
</xsl:attribute>
|
|
8467
8530
|
</xsl:if>
|
|
8468
8531
|
<xsl:if test="p">
|
|
8532
|
+
<xsl:variable name="local-design-width">
|
|
8533
|
+
<xsl:apply-templates select="." mode="get-design-width"/>
|
|
8534
|
+
</xsl:variable>
|
|
8469
8535
|
<xsl:attribute name="style">
|
|
8470
8536
|
<xsl:text>max-width:</xsl:text>
|
|
8471
8537
|
<xsl:choose>
|
|
@@ -8475,14 +8541,14 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
8475
8541
|
<xsl:with-param name="percentage" select="$left-col/@width" />
|
|
8476
8542
|
</xsl:call-template>
|
|
8477
8543
|
</xsl:variable>
|
|
8478
|
-
<xsl:value-of select="$design-width * substring-before($width, '%') div 100 * substring-before($ambient-relative-width, '%') div 100" />
|
|
8544
|
+
<xsl:value-of select="$local-design-width * substring-before($width, '%') div 100 * substring-before($ambient-relative-width, '%') div 100" />
|
|
8479
8545
|
<xsl:text>px;</xsl:text>
|
|
8480
8546
|
</xsl:when>
|
|
8481
8547
|
<!-- If there is no $left-col/@width, silently use 20% as default -->
|
|
8482
8548
|
<!-- We get some ill-formed WW exercises here, so a less-precise -->
|
|
8483
8549
|
<!-- warning is given on the author's source. -->
|
|
8484
8550
|
<xsl:otherwise>
|
|
8485
|
-
<xsl:value-of select="$design-width * 0.2 * substring-before($ambient-relative-width, '%') div 100" />
|
|
8551
|
+
<xsl:value-of select="$local-design-width * 0.2 * substring-before($ambient-relative-width, '%') div 100" />
|
|
8486
8552
|
</xsl:otherwise>
|
|
8487
8553
|
</xsl:choose>
|
|
8488
8554
|
</xsl:attribute>
|
|
@@ -11241,8 +11307,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
11241
11307
|
</xsl:apply-templates>
|
|
11242
11308
|
</xsl:variable>
|
|
11243
11309
|
<!-- these are now standardized templates -->
|
|
11244
|
-
<xsl:variable name="
|
|
11245
|
-
|
|
11310
|
+
<xsl:variable name="local-design-width">
|
|
11311
|
+
<xsl:apply-templates select="." mode="get-design-width" />
|
|
11312
|
+
</xsl:variable>
|
|
11313
|
+
<xsl:variable name="width" select="$local-design-width * $width-fraction" />
|
|
11314
|
+
<xsl:variable name="height" select="$local-design-width * $width-fraction div $aspect-ratio" />
|
|
11246
11315
|
<!-- the div to hold the JSX output -->
|
|
11247
11316
|
<xsl:element name="div">
|
|
11248
11317
|
<xsl:attribute name="id">
|
|
@@ -11519,7 +11588,10 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
11519
11588
|
</xsl:variable>
|
|
11520
11589
|
<!-- build the iframe -->
|
|
11521
11590
|
<!-- mimicking Mike Gage's blog post -->
|
|
11522
|
-
<
|
|
11591
|
+
<xsl:variable name="local-design-width">
|
|
11592
|
+
<xsl:apply-templates select="." mode="get-design-width"/>
|
|
11593
|
+
</xsl:variable>
|
|
11594
|
+
<iframe name="{concat(@assembly-id, '-ww-inner')}" width="{$local-design-width}" src="{$the-url}" data-seed="{static/@seed}"/>
|
|
11523
11595
|
<script>
|
|
11524
11596
|
<xsl:text>iFrameResize({log:true,inPageLinks:true,resizeFrom:'child',checkOrigin:["</xsl:text>
|
|
11525
11597
|
<xsl:value-of select="$webwork-server" />
|
|
@@ -64,6 +64,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
64
64
|
<!-- Disable clipboardable -->
|
|
65
65
|
<xsl:template name="insert-clipboardable-class"/>
|
|
66
66
|
|
|
67
|
+
<!-- HTML sets based on theme. Jupyter should always use the same value -->
|
|
68
|
+
<xsl:variable name="design-width" select="'600'" />
|
|
69
|
+
|
|
67
70
|
<!-- ############## -->
|
|
68
71
|
<!-- Entry Template -->
|
|
69
72
|
<!-- ############## -->
|
|
@@ -8664,8 +8664,12 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
8664
8664
|
<!-- and a serial number from the enumitem package on the lists -->
|
|
8665
8665
|
<!-- We compose the two LaTeX \ref{} -->
|
|
8666
8666
|
<xsl:template match="task" mode="xref-number">
|
|
8667
|
+
<xsl:param name="xref" select="/.." />
|
|
8668
|
+
|
|
8667
8669
|
<!-- ancestors, strip tasks, get number of next enclosure -->
|
|
8668
|
-
<xsl:apply-templates select="ancestor::*[not(self::task)][1]" mode="xref-number"
|
|
8670
|
+
<xsl:apply-templates select="ancestor::*[not(self::task)][1]" mode="xref-number">
|
|
8671
|
+
<xsl:with-param name="xref" select="$xref" />
|
|
8672
|
+
</xsl:apply-templates>
|
|
8669
8673
|
<xsl:text>.</xsl:text>
|
|
8670
8674
|
<!-- task always gets a number, but we have to avoid recursion -->
|
|
8671
8675
|
<!-- that would result by just getting a \ref from xref-number -->
|
|
@@ -8825,6 +8829,21 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
8825
8829
|
</xsl:choose>
|
|
8826
8830
|
</xsl:template>
|
|
8827
8831
|
|
|
8832
|
+
<!-- A number the common routines compute as text (a serial number, or -->
|
|
8833
|
+
<!-- a full number shortened by a hybrid style) gets the same font as -->
|
|
8834
|
+
<!-- the numbers made just above, so a style that redefines \xreffont -->
|
|
8835
|
+
<!-- reaches every number in a cross-reference. An empty number stays -->
|
|
8836
|
+
<!-- empty, since callers test for one. -->
|
|
8837
|
+
<xsl:template name="xref-number-text">
|
|
8838
|
+
<xsl:param name="number"/>
|
|
8839
|
+
|
|
8840
|
+
<xsl:if test="not($number = '')">
|
|
8841
|
+
<xsl:text>{\xreffont </xsl:text>
|
|
8842
|
+
<xsl:value-of select="$number"/>
|
|
8843
|
+
<xsl:text>}</xsl:text>
|
|
8844
|
+
</xsl:if>
|
|
8845
|
+
</xsl:template>
|
|
8846
|
+
|
|
8828
8847
|
<!-- This template actually manufactures the link. When the link lives in -->
|
|
8829
8848
|
<!-- a title, the link text is just reproduced. If the number is hard- -->
|
|
8830
8849
|
<!-- coded, fine. If the number is obtained by a \ref, we use the starred -->
|
|
@@ -771,8 +771,10 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
771
771
|
</xsl:template>
|
|
772
772
|
|
|
773
773
|
<!-- Structure Numbers: Lists -->
|
|
774
|
-
<!-- Lists occur in paragraphs (anonymously)
|
|
775
|
-
<!-- blocks (numbered)
|
|
774
|
+
<!-- Lists occur in paragraphs (anonymously) and in "list" -->
|
|
775
|
+
<!-- blocks (numbered). A list anywhere else, inside an -->
|
|
776
|
+
<!-- exercise or a task, say, is anonymous: an item takes -->
|
|
777
|
+
<!-- its number from the nesting of its lists alone. -->
|
|
776
778
|
<!-- Typically we are interested in list items (only), -->
|
|
777
779
|
<!-- since that is where there is content. And then we -->
|
|
778
780
|
<!-- are only interested in the list items within an ordered -->
|
|
@@ -785,10 +787,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
785
787
|
<xsl:apply-templates select="ancestor::list" mode="number" />
|
|
786
788
|
</xsl:template>
|
|
787
789
|
|
|
788
|
-
<xsl:template match="exercise//li" mode="structure-number">
|
|
789
|
-
<xsl:apply-templates select="ancestor::exercise" mode="number" />
|
|
790
|
-
</xsl:template>
|
|
791
|
-
|
|
792
790
|
<!-- Structure Numbers: Tasks (in projects) -->
|
|
793
791
|
<!-- A task gets it structure number from the parent project-like -->
|
|
794
792
|
<xsl:template match="task" mode="structure-number">
|
|
@@ -840,9 +838,8 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
840
838
|
|
|
841
839
|
<!-- Now trivial, the container structure plus the serial. -->
|
|
842
840
|
<!-- We condition on empty serial number in order to create -->
|
|
843
|
-
<!-- empty full numbers.
|
|
844
|
-
<!--
|
|
845
|
-
<!-- list, we use a colon (a double period?). -->
|
|
841
|
+
<!-- empty full numbers. The separator between the two is -->
|
|
842
|
+
<!-- supplied by the next template. -->
|
|
846
843
|
<xsl:template match="*" mode="number">
|
|
847
844
|
<xsl:variable name="serial">
|
|
848
845
|
<xsl:apply-templates select="." mode="serial-number" />
|
|
@@ -855,27 +852,37 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
855
852
|
</xsl:variable>
|
|
856
853
|
<xsl:if test="not($structure='')">
|
|
857
854
|
<xsl:value-of select="$structure" />
|
|
858
|
-
<xsl:
|
|
859
|
-
<xsl:when test="self::li and ancestor::list">
|
|
860
|
-
<xsl:text>:</xsl:text>
|
|
861
|
-
</xsl:when>
|
|
862
|
-
<!-- A figure-like inside a sidebyside (or -->
|
|
863
|
-
<!-- sbsgroup) inside a figure, or a figure in -->
|
|
864
|
-
<!-- a stack inside a figure, is subnumbered -->
|
|
865
|
-
<!-- with a letter like "(a)", so the serial -->
|
|
866
|
-
<!-- number already carries its own delimiter -->
|
|
867
|
-
<!-- and no period separator is needed. -->
|
|
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])"/>
|
|
869
|
-
<xsl:otherwise>
|
|
870
|
-
<xsl:text>.</xsl:text>
|
|
871
|
-
</xsl:otherwise>
|
|
872
|
-
</xsl:choose>
|
|
855
|
+
<xsl:apply-templates select="." mode="structure-serial-separator" />
|
|
873
856
|
</xsl:if>
|
|
874
857
|
<xsl:value-of select="$serial" />
|
|
875
858
|
</xsl:otherwise>
|
|
876
859
|
</xsl:choose>
|
|
877
860
|
</xsl:template>
|
|
878
861
|
|
|
862
|
+
<!-- The separator between a structure number and a serial -->
|
|
863
|
+
<!-- number is normally a period, but for a list item within -->
|
|
864
|
+
<!-- a named list, we use a colon (a double period?). A -->
|
|
865
|
+
<!-- cross-reference that shortens a full number employs this -->
|
|
866
|
+
<!-- same separator, so the shorter number is always the -->
|
|
867
|
+
<!-- final portion of the full number. -->
|
|
868
|
+
<xsl:template match="*" mode="structure-serial-separator">
|
|
869
|
+
<xsl:choose>
|
|
870
|
+
<xsl:when test="self::li and ancestor::list">
|
|
871
|
+
<xsl:text>:</xsl:text>
|
|
872
|
+
</xsl:when>
|
|
873
|
+
<!-- A figure-like inside a sidebyside (or -->
|
|
874
|
+
<!-- sbsgroup) inside a figure, or a figure in -->
|
|
875
|
+
<!-- a stack inside a figure, is subnumbered -->
|
|
876
|
+
<!-- with a letter like "(a)", so the serial -->
|
|
877
|
+
<!-- number already carries its own delimiter -->
|
|
878
|
+
<!-- and no period separator is needed. -->
|
|
879
|
+
<xsl:when test="(&FIGURE-FILTER;) and (parent::sidebyside/parent::figure or parent::sidebyside/parent::sbsgroup/parent::figure or self::figure[parent::stack/parent::figure])"/>
|
|
880
|
+
<xsl:otherwise>
|
|
881
|
+
<xsl:text>.</xsl:text>
|
|
882
|
+
</xsl:otherwise>
|
|
883
|
+
</xsl:choose>
|
|
884
|
+
</xsl:template>
|
|
885
|
+
|
|
879
886
|
<!-- ##### Division serial numbers ##### -->
|
|
880
887
|
<!-- ############## -->
|
|
881
888
|
<!-- Serial Numbers -->
|
|
@@ -103,6 +103,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
103
103
|
<!-- HTML5 format -->
|
|
104
104
|
<xsl:output method="html" indent="yes" encoding="UTF-8" doctype-system="about:legacy-compat"/>
|
|
105
105
|
|
|
106
|
+
<!-- HTML sets based on theme. Reveal.js should always use the same value -->
|
|
107
|
+
<xsl:variable name="design-width" select="'600'" />
|
|
108
|
+
|
|
106
109
|
<!-- Publisher Switches -->
|
|
107
110
|
<!-- Various configuration options are set in the publisher file, -->
|
|
108
111
|
<!-- which is analyzed by its own stylesheet, which is imported in -->
|
|
@@ -853,8 +856,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
853
856
|
<xsl:apply-templates select="." mode="archive">
|
|
854
857
|
<xsl:with-param name="base-pathname" select="$base-pathname"/>
|
|
855
858
|
</xsl:apply-templates>
|
|
856
|
-
<!-- possibly give a long description -->
|
|
857
|
-
<xsl:apply-templates select="." mode="description"/>
|
|
858
859
|
</xsl:when>
|
|
859
860
|
<!-- online: the diagcess embedding, inherited -->
|
|
860
861
|
<xsl:otherwise>
|
|
@@ -165,6 +165,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
165
165
|
<!-- no .proxyuri_runs -->
|
|
166
166
|
<!-- no .proxyuri_files -->
|
|
167
167
|
<!-- no .enable_chatcodes -->
|
|
168
|
+
|
|
169
|
+
<!-- Inject a marker that RS will use to place eBookConfig values -->
|
|
170
|
+
<xsl:value-of select="$rso"/><xsl:text> ebook_config_override | safe </xsl:text><xsl:value-of select="$rsc"/><xsl:text>
</xsl:text>
|
|
168
171
|
</script>
|
|
169
172
|
<xsl:text>
</xsl:text>
|
|
170
173
|
|
|
@@ -324,6 +327,113 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
324
327
|
</xsl:if>
|
|
325
328
|
</xsl:template>
|
|
326
329
|
|
|
330
|
+
<!-- When hosted on Runestone, an interactive exercise is tracked in a -->
|
|
331
|
+
<!-- database across courses ("base course") and semesters ("time"). -->
|
|
332
|
+
<!-- And the HTML representation of an interactive exercise, when powered -->
|
|
333
|
+
<!-- by Runestone services, needs an HTML id. But the PreTeXt "exercise" -->
|
|
334
|
+
<!-- that wraps it has its own HTML id necessary for targets of -->
|
|
335
|
+
<!-- cross-reference (in-context) URLs. We will prefer @label for the -->
|
|
336
|
+
<!-- PreTeXt "exercise" HTML id. And we will require a *stable* @label -->
|
|
337
|
+
<!-- from an author, which we will dress up here. Notice that this can -->
|
|
338
|
+
<!-- change when an author declares a new edition. -->
|
|
339
|
+
<!-- The "runestone-division-id" template, nearby, is the companion of -->
|
|
340
|
+
<!-- this one, for a chapter or subchapter recorded in the manifest. An -->
|
|
341
|
+
<!-- author meets the two as a single requirement: a @label wherever a -->
|
|
342
|
+
<!-- Runestone server needs a lasting identifier. So the conditions -->
|
|
343
|
+
<!-- tested, and the severity and advice of each message, agree between -->
|
|
344
|
+
<!-- the two. Change one, then examine the other. -->
|
|
345
|
+
<xsl:template match="exercise|program|datafile|query|&PROJECT-LIKE;|task|video[@youtube]|exercises|worksheet|interactive[@platform = 'doenetml']|interactive[@iframe]" mode="runestone-id">
|
|
346
|
+
<!-- With no @xml:id and no @label we realize the author has not given -->
|
|
347
|
+
<!-- any thought to a (semi-)peersistent identifire for the Runestone -->
|
|
348
|
+
<!-- database. So we call that out as an error. And we do not even -->
|
|
349
|
+
<!-- attempt to fallback to an automatically generated string, which -->
|
|
350
|
+
<!-- would be malleable over time and editing. -->
|
|
351
|
+
<!-- As part of backwards-compatibility, we copy old @xml:id values into -->
|
|
352
|
+
<!-- fresh @label. But have an internal @pi:authored-label attribute whose -->
|
|
353
|
+
<!-- absence alerts us to the copying, which is now not best practice. -->
|
|
354
|
+
<!-- These messages were disabled 2024-02-20 as unreliable. The cause -->
|
|
355
|
+
<!-- was a pointer to another component resolving against the authored -->
|
|
356
|
+
<!-- source, where the @pi:authored-label stamp does not exist; that is -->
|
|
357
|
+
<!-- repaired, so the messages return. A plain static code listing is -->
|
|
358
|
+
<!-- the one element reaching here that legitimately has no database -->
|
|
359
|
+
<!-- identity and needs none, so it is exempt. -->
|
|
360
|
+
<xsl:choose>
|
|
361
|
+
<xsl:when test="self::program and not(@interactive = 'activecode' or @interactive = 'codelens')"/>
|
|
362
|
+
<xsl:when test="$b-host-runestone and not(@xml:id) and not(@pi:authored-label)">
|
|
363
|
+
<xsl:message>
|
|
364
|
+
<xsl:text>PTX:ERROR: While building for a Runestone server, a PreTeXt "</xsl:text>
|
|
365
|
+
<xsl:value-of select="local-name(.)"/>
|
|
366
|
+
<xsl:text>" element
</xsl:text>
|
|
367
|
+
<xsl:text>has been encountered without a @label attribute and without a @xml:id attribute.
</xsl:text>
|
|
368
|
+
<xsl:text>This will cause this Runestone component to fail to perform and there will be no
</xsl:text>
|
|
369
|
+
<xsl:text>identification of this component in the Runestone database. You must add a
</xsl:text>
|
|
370
|
+
<xsl:text>@label attribute with a unique value. (It is not necessary to add a @xml:id, 
</xsl:text>
|
|
371
|
+
<xsl:text>it is consulted as part of a backward-compatibility arrangement you do not need).
</xsl:text>
|
|
372
|
+
<xsl:text>[You may get more than one message about this instance.]
</xsl:text>
|
|
373
|
+
</xsl:message>
|
|
374
|
+
<xsl:apply-templates select="." mode="location-report"/>
|
|
375
|
+
</xsl:when>
|
|
376
|
+
<xsl:when test="$b-host-runestone and not(@pi:authored-label)">
|
|
377
|
+
<xsl:message>
|
|
378
|
+
<xsl:text>PTX:FALLBACK: While building for a Runestone server, a PreTeXt "</xsl:text>
|
|
379
|
+
<xsl:value-of select="local-name(.)"/>
|
|
380
|
+
<xsl:text>" element
</xsl:text>
|
|
381
|
+
<xsl:text>has been encountered without a @label attribute. For reasons of backward-compatibility 
</xsl:text>
|
|
382
|
+
<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>
|
|
383
|
+
<xsl:text>is no longer best practice. You can copy the @xml:id value exactly into a new @label 
</xsl:text>
|
|
384
|
+
<xsl:text>attribute and this message will stop AND your project's entries in any Runestone database 
</xsl:text>
|
|
385
|
+
<xsl:text>will be preserved and function exactly as before.
</xsl:text>
|
|
386
|
+
<xsl:text>[You may get more than one message about this instance.]
</xsl:text>
|
|
387
|
+
</xsl:message>
|
|
388
|
+
<xsl:apply-templates select="." mode="location-report"/>
|
|
389
|
+
</xsl:when>
|
|
390
|
+
</xsl:choose>
|
|
391
|
+
<!-- We require a @label attribute, but allow it to be -->
|
|
392
|
+
<!-- the result of an automatic copy from an @xml:id. -->
|
|
393
|
+
<xsl:variable name="label">
|
|
394
|
+
<xsl:value-of select="@label"/>
|
|
395
|
+
</xsl:variable>
|
|
396
|
+
<xsl:if test="$label != ''">
|
|
397
|
+
<xsl:call-template name="runestone-label-prefix"/>
|
|
398
|
+
<xsl:value-of select="$label"/>
|
|
399
|
+
</xsl:if>
|
|
400
|
+
</xsl:template>
|
|
401
|
+
|
|
402
|
+
<!-- Special handling for programs in exercise-like elements. -->
|
|
403
|
+
<!-- We want to associate those programs with the label on their container -->
|
|
404
|
+
<!-- and NOT with an auto-generated label on the program itself that might -->
|
|
405
|
+
<!-- come from an @xml:id. -->
|
|
406
|
+
<!-- This is an implicit use of &PROJECT-LIKE; and should be kept in sync -->
|
|
407
|
+
<xsl:template match="exercise/program|task/program|project/program|activity/program|exploration/program|investigation/program" mode="runestone-id">
|
|
408
|
+
<xsl:variable name="label">
|
|
409
|
+
<xsl:value-of select="../@label"/>
|
|
410
|
+
</xsl:variable>
|
|
411
|
+
<xsl:if test="$label != ''">
|
|
412
|
+
<xsl:call-template name="runestone-label-prefix"/>
|
|
413
|
+
<xsl:value-of select="$label"/>
|
|
414
|
+
</xsl:if>
|
|
415
|
+
</xsl:template>
|
|
416
|
+
|
|
417
|
+
<!-- Prefix just for RS-server builds, in order that the database -->
|
|
418
|
+
<!-- of exercises gets a globally unique identifier. -->
|
|
419
|
+
<!-- And for a non-RS-server build, we add a prefix in order to -->
|
|
420
|
+
<!-- differentiate from nearby (wrappers) uses of @label for -->
|
|
421
|
+
<!-- PreTeXt functions. -->
|
|
422
|
+
<xsl:template name="runestone-label-prefix">
|
|
423
|
+
<xsl:choose>
|
|
424
|
+
<xsl:when test="$b-host-runestone">
|
|
425
|
+
<!-- global variables defined in the -common stylesheet -->
|
|
426
|
+
<xsl:value-of select="$document-id"/>
|
|
427
|
+
<xsl:text>_</xsl:text>
|
|
428
|
+
<xsl:value-of select="$edition"/>
|
|
429
|
+
<xsl:text>_</xsl:text>
|
|
430
|
+
</xsl:when>
|
|
431
|
+
<xsl:otherwise>
|
|
432
|
+
<xsl:text>rs-</xsl:text>
|
|
433
|
+
</xsl:otherwise>
|
|
434
|
+
</xsl:choose>
|
|
435
|
+
</xsl:template>
|
|
436
|
+
|
|
327
437
|
<!-- A convenience for attaching a Runestone id -->
|
|
328
438
|
<!-- NB: we attempt to only use this template in this stylesheet. -->
|
|
329
439
|
<!-- To enforce this, we *could* make a no-op, plus warning, -->
|
|
@@ -340,6 +450,55 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
340
450
|
</xsl:if>
|
|
341
451
|
</xsl:template>
|
|
342
452
|
|
|
453
|
+
<!-- Runestone stores chapter and subchapter IDs for each edition. An ID -->
|
|
454
|
+
<!-- built from ancestor IDs and sibling positions can change with edits. -->
|
|
455
|
+
<!-- The "runestone-id" template, nearby, is the companion of this one, for -->
|
|
456
|
+
<!-- a component. An author meets the two as a single requirement: a -->
|
|
457
|
+
<!-- @label wherever a Runestone server needs a lasting identifier. So the -->
|
|
458
|
+
<!-- conditions tested, and the severity and advice of each message, agree -->
|
|
459
|
+
<!-- between the two: an error with neither a @label nor an @xml:id, and a -->
|
|
460
|
+
<!-- fallback when an @xml:id stands in for a @label. Change one, then -->
|
|
461
|
+
<!-- examine the other. The manifest is built only for a Runestone server, -->
|
|
462
|
+
<!-- so the host is not tested again here. -->
|
|
463
|
+
<xsl:template match="*" mode="runestone-division-id">
|
|
464
|
+
<xsl:variable name="manifest-id">
|
|
465
|
+
<xsl:apply-templates select="." mode="html-id"/>
|
|
466
|
+
</xsl:variable>
|
|
467
|
+
<xsl:choose>
|
|
468
|
+
<xsl:when test="not(@xml:id) and not(@pi:authored-label)">
|
|
469
|
+
<xsl:message>
|
|
470
|
+
<xsl:text>PTX:ERROR: While building for a Runestone server, a PreTeXt "</xsl:text>
|
|
471
|
+
<xsl:value-of select="local-name(.)"/>
|
|
472
|
+
<xsl:text>" element
</xsl:text>
|
|
473
|
+
<xsl:text>has been encountered without a @label attribute and without a @xml:id attribute.
</xsl:text>
|
|
474
|
+
<xsl:text>Runestone records this division as a chapter or subchapter, under an ID that must
</xsl:text>
|
|
475
|
+
<xsl:text>not change during the life of an edition. The ID in use now, "</xsl:text>
|
|
476
|
+
<xsl:value-of select="$manifest-id"/>
|
|
477
|
+
<xsl:text>", was generated
</xsl:text>
|
|
478
|
+
<xsl:text>from the document structure and may change when the document is edited. For an
</xsl:text>
|
|
479
|
+
<xsl:text>established book, add a @label attribute with this value to keep the present ID.
</xsl:text>
|
|
480
|
+
<xsl:text>For a new book, or a new edition, add a meaningful @label attribute.
</xsl:text>
|
|
481
|
+
</xsl:message>
|
|
482
|
+
<xsl:apply-templates select="." mode="location-report"/>
|
|
483
|
+
</xsl:when>
|
|
484
|
+
<xsl:when test="not(@pi:authored-label)">
|
|
485
|
+
<xsl:message>
|
|
486
|
+
<xsl:text>PTX:FALLBACK: While building for a Runestone server, a PreTeXt "</xsl:text>
|
|
487
|
+
<xsl:value-of select="local-name(.)"/>
|
|
488
|
+
<xsl:text>" element
</xsl:text>
|
|
489
|
+
<xsl:text>has been encountered without a @label attribute. Runestone records this division
</xsl:text>
|
|
490
|
+
<xsl:text>as a chapter or subchapter, and we have used the value of an @xml:id as its ID.
</xsl:text>
|
|
491
|
+
<xsl:text>You can copy the @xml:id value exactly into a new @label attribute and this message
</xsl:text>
|
|
492
|
+
<xsl:text>will stop, with the ID unchanged.
</xsl:text>
|
|
493
|
+
</xsl:message>
|
|
494
|
+
<xsl:apply-templates select="." mode="location-report"/>
|
|
495
|
+
</xsl:when>
|
|
496
|
+
</xsl:choose>
|
|
497
|
+
<id>
|
|
498
|
+
<xsl:value-of select="$manifest-id"/>
|
|
499
|
+
</id>
|
|
500
|
+
</xsl:template>
|
|
501
|
+
|
|
343
502
|
<!-- ############### -->
|
|
344
503
|
<!-- Runestone Hooks -->
|
|
345
504
|
<!-- ############### -->
|
|
@@ -553,9 +712,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
553
712
|
<!-- Now recurse into sections, appendix -->
|
|
554
713
|
<!-- with a faux chapter, using "article" -->
|
|
555
714
|
<chapter>
|
|
556
|
-
<id
|
|
557
|
-
<xsl:apply-templates select="." mode="html-id"/>
|
|
558
|
-
</id>
|
|
715
|
+
<xsl:apply-templates select="." mode="runestone-division-id"/>
|
|
559
716
|
<title>
|
|
560
717
|
<xsl:apply-templates select="." mode="title-full"/>
|
|
561
718
|
</title>
|
|
@@ -575,9 +732,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
575
732
|
|
|
576
733
|
<xsl:template match="chapter" mode="runestone-manifest">
|
|
577
734
|
<chapter>
|
|
578
|
-
<id
|
|
579
|
-
<xsl:apply-templates select="." mode="html-id"/>
|
|
580
|
-
</id>
|
|
735
|
+
<xsl:apply-templates select="." mode="runestone-division-id"/>
|
|
581
736
|
<title>
|
|
582
737
|
<xsl:apply-templates select="." mode="title-full"/>
|
|
583
738
|
</title>
|
|
@@ -641,9 +796,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
641
796
|
|
|
642
797
|
<!-- Properties to report for each division -->
|
|
643
798
|
<xsl:template match="*" mode="runestone-division-properties">
|
|
644
|
-
<id
|
|
645
|
-
<xsl:apply-templates select="." mode="html-id"/>
|
|
646
|
-
</id>
|
|
799
|
+
<xsl:apply-templates select="." mode="runestone-division-id"/>
|
|
647
800
|
<title>
|
|
648
801
|
<xsl:apply-templates select="." mode="title-full"/>
|
|
649
802
|
</title>
|
|
@@ -1820,7 +1820,16 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1820
1820
|
<xsl:apply-templates select="$publisher-attribute-options/html/pi:pub-attribute[@name='design-width']" mode="set-pubfile-variable"/>
|
|
1821
1821
|
</xsl:when>
|
|
1822
1822
|
<xsl:otherwise>
|
|
1823
|
-
<xsl:
|
|
1823
|
+
<xsl:choose>
|
|
1824
|
+
<!-- Select the default design width based on the theme -->
|
|
1825
|
+
<!-- Should match the content-width of the corresponding theme -->
|
|
1826
|
+
<xsl:when test="$html-theme-name = 'salem'">
|
|
1827
|
+
<xsl:text>725</xsl:text>
|
|
1828
|
+
</xsl:when>
|
|
1829
|
+
<xsl:otherwise>
|
|
1830
|
+
<xsl:text>600</xsl:text>
|
|
1831
|
+
</xsl:otherwise>
|
|
1832
|
+
</xsl:choose>
|
|
1824
1833
|
</xsl:otherwise>
|
|
1825
1834
|
</xsl:choose>
|
|
1826
1835
|
</xsl:variable>
|