@pretextbook/pretext-html 0.1.0 → 0.2.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/README.md +104 -4
- package/assets/preview-html.xsl +230 -230
- package/assets/upstream.json +7 -7
- package/assets/xsl/entities.ent +154 -154
- package/assets/xsl/extract-asymptote.xsl +68 -68
- package/assets/xsl/extract-biblio-csl.xsl +327 -327
- package/assets/xsl/extract-datafile.xsl +71 -71
- package/assets/xsl/extract-dynamic.xsl +139 -139
- package/assets/xsl/extract-identity.xsl +136 -136
- package/assets/xsl/extract-interactive.xsl +81 -81
- package/assets/xsl/extract-latex-image.xsl +118 -118
- package/assets/xsl/extract-mermaid.xsl +58 -58
- package/assets/xsl/extract-mom.xsl +63 -63
- package/assets/xsl/extract-pg.xsl +2897 -2897
- package/assets/xsl/extract-prefigure.xsl +157 -157
- package/assets/xsl/extract-qrcode.xsl +100 -100
- package/assets/xsl/extract-runestone-page-template.xsl +139 -139
- package/assets/xsl/extract-sageplot.xsl +166 -166
- package/assets/xsl/extract-stack.xsl +56 -56
- package/assets/xsl/extract-trace.xsl +134 -134
- package/assets/xsl/extract-youtube.xsl +63 -63
- package/assets/xsl/html-symbols.xsl +3344 -3344
- package/assets/xsl/latex/pretext-latex-AIM.xsl +56 -56
- package/assets/xsl/latex/pretext-latex-CLP.xsl +148 -148
- package/assets/xsl/latex/pretext-latex-chaos.xsl +317 -317
- package/assets/xsl/latex/pretext-latex-dyslexic-font.xsl +76 -76
- package/assets/xsl/latex/pretext-latex-guide.xsl +104 -104
- package/assets/xsl/latex/pretext-latex-texstyle.xsl +862 -862
- package/assets/xsl/localizations/af-ZA.xml +276 -276
- package/assets/xsl/localizations/bg-BG.xml +276 -276
- package/assets/xsl/localizations/ca-ES.xml +285 -285
- package/assets/xsl/localizations/cs-CZ.xml +280 -280
- package/assets/xsl/localizations/de-DE.xml +281 -281
- package/assets/xsl/localizations/en-US.xml +427 -427
- package/assets/xsl/localizations/es-ES.xml +287 -287
- package/assets/xsl/localizations/fi-FI.xml +275 -275
- package/assets/xsl/localizations/fr-CA.xml +276 -276
- package/assets/xsl/localizations/fr-FR.xml +280 -280
- package/assets/xsl/localizations/hu-HU.xml +280 -280
- package/assets/xsl/localizations/it-IT.xml +276 -276
- package/assets/xsl/localizations/ku-CKB.xml +275 -275
- package/assets/xsl/localizations/localizations.xml +48 -48
- package/assets/xsl/localizations/nl-NL.xml +275 -275
- package/assets/xsl/localizations/pt-BR.xml +288 -288
- package/assets/xsl/localizations/pt-PT.xml +292 -292
- package/assets/xsl/localizations/zh-HANS.xml +269 -269
- package/assets/xsl/pretext-assembly.xsl +4795 -4795
- package/assets/xsl/pretext-basic-html.xsl +86 -86
- package/assets/xsl/pretext-beamer.xsl +662 -662
- package/assets/xsl/pretext-braille-preprint.xsl +2249 -2249
- package/assets/xsl/pretext-common.xsl +12018 -12018
- package/assets/xsl/pretext-dynamic.xsl +65 -65
- package/assets/xsl/pretext-epub.xsl +1483 -1483
- package/assets/xsl/pretext-fo.xsl +4593 -4593
- package/assets/xsl/pretext-html.xsl +14791 -14791
- package/assets/xsl/pretext-json-manifest.xsl +150 -150
- package/assets/xsl/pretext-jupyter.xsl +868 -868
- package/assets/xsl/pretext-latex-classic.xsl +952 -952
- package/assets/xsl/pretext-latex-common.xsl +11563 -11563
- package/assets/xsl/pretext-latex.xsl +47 -47
- package/assets/xsl/pretext-litprog.xsl +105 -105
- package/assets/xsl/pretext-merge.xsl +41 -41
- package/assets/xsl/pretext-numbers.xsl +875 -875
- package/assets/xsl/pretext-revealjs.xsl +522 -522
- package/assets/xsl/pretext-runestone-fitb.xsl +1233 -1233
- package/assets/xsl/pretext-runestone-static.xsl +1438 -1438
- package/assets/xsl/pretext-runestone.xsl +3083 -3083
- package/assets/xsl/pretext-sage-doctest.xsl +289 -289
- package/assets/xsl/pretext-smc.xsl +492 -492
- package/assets/xsl/pretext-solution-manual-latex.xsl +323 -323
- package/assets/xsl/pretext-text-utilities.xsl +1217 -1217
- package/assets/xsl/pretext-text.xsl +392 -392
- package/assets/xsl/pretext-units.xsl +195 -195
- package/assets/xsl/pretext-view-source.xsl +157 -157
- package/assets/xsl/pretext-ww-problem-sets.xsl +391 -391
- package/assets/xsl/publisher-variables.xsl +4756 -4756
- package/assets/xsl/support/extract-math.xsl +256 -256
- package/assets/xsl/support/package-math.xsl +141 -141
- package/assets/xsl/support/play-button/play-button.svg +3 -3
- package/assets/xsl/support/pretext-pg-macros.xsl +110 -110
- package/assets/xsl/support/webpack_static_imports.xml +14 -14
- package/assets/xsl/tests/null.xml +3 -3
- package/assets/xsl/tests/pretext-text-utilities-test.xsl +333 -333
- package/assets/xsl/utilities/author-report.xsl +107 -107
- package/assets/xsl/utilities/deprecate-autoname.sed +18 -18
- package/assets/xsl/utilities/deprecate-index.sed +33 -33
- package/assets/xsl/utilities/fix-deprecations.xsl +663 -663
- package/assets/xsl/utilities/pretext-enhanced-source.xsl +112 -112
- package/assets/xsl/utilities/report-publisher-variables.xsl +162 -162
- package/assets/xsl/xml-to-json.xsl +326 -326
- package/assets/xsl/xml-to-string.xsl +328 -328
- package/assets/xsl-bundle.json +1 -0
- package/dist/{cli-C6tfAVvi.js → cli-B2LiKunq.js} +268 -233
- package/dist/cli.js +1 -1
- package/dist/host.browser.d.ts +29 -0
- package/dist/host.d.ts +41 -0
- package/dist/index.browser.d.ts +29 -0
- package/dist/index.browser.js +650 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +16 -8
- package/dist/internal/posix-path.d.ts +59 -0
- package/dist/mounts.d.ts +18 -0
- package/dist/renderer.d.ts +14 -1
- package/dist/theme.d.ts +68 -0
- package/dist/theme.js +93 -0
- package/package.json +22 -4
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
<?xml version='1.0'?>
|
|
2
|
-
|
|
3
|
-
<!--********************************************************************
|
|
4
|
-
Copyright 2014-2016 Robert A. Beezer
|
|
5
|
-
|
|
6
|
-
This file is part of PreTeXt.
|
|
7
|
-
|
|
8
|
-
PreTeXt is free software: you can redistribute it and/or modify
|
|
9
|
-
it under the terms of the GNU General Public License as published by
|
|
10
|
-
the Free Software Foundation, either version 2 or version 3 of the
|
|
11
|
-
License (at your option).
|
|
12
|
-
|
|
13
|
-
PreTeXt is distributed in the hope that it will be useful,
|
|
14
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
GNU General Public License for more details.
|
|
17
|
-
|
|
18
|
-
You should have received a copy of the GNU General Public License
|
|
19
|
-
along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
-
*********************************************************************-->
|
|
21
|
-
|
|
22
|
-
<!-- This stylesheet locates all exercise/stack elements and -->
|
|
23
|
-
<!-- writes out a single file listing the @source attribute value -->
|
|
24
|
-
<!-- for eaCh one (the files with these names will be sent to a -->
|
|
25
|
-
<!-- server for conversion to static forms) -->
|
|
26
|
-
|
|
27
|
-
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
|
28
|
-
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
|
29
|
-
xmlns:exsl="http://exslt.org/common"
|
|
30
|
-
extension-element-prefixes="exsl"
|
|
31
|
-
>
|
|
32
|
-
|
|
33
|
-
<!-- Get internal ID's for filenames, etc -->
|
|
34
|
-
<!-- Standard conversion groundwork -->
|
|
35
|
-
<xsl:import href="./publisher-variables.xsl"/>
|
|
36
|
-
<xsl:import href="./pretext-assembly.xsl"/>
|
|
37
|
-
<xsl:import href="./pretext-common.xsl"/>
|
|
38
|
-
|
|
39
|
-
<!-- Get a "subtree" xml:id value -->
|
|
40
|
-
<!-- Then walk the XML source tree -->
|
|
41
|
-
<!-- applying specializations below -->
|
|
42
|
-
<xsl:import href="./extract-identity.xsl" />
|
|
43
|
-
|
|
44
|
-
<xsl:output method="text" encoding="UTF-8"/>
|
|
45
|
-
|
|
46
|
-
<!-- Flag an extraction pass, so pretext-assembly does not get confused -->
|
|
47
|
-
<xsl:variable name="b-extracting-stack" select="true()"/>
|
|
48
|
-
|
|
49
|
-
<xsl:template match="exercise/stack" mode="extraction">
|
|
50
|
-
<xsl:value-of select="@source"/>
|
|
51
|
-
<xsl:text> </xsl:text>
|
|
52
|
-
<xsl:apply-templates select="." mode="assembly-id"/>
|
|
53
|
-
<xsl:text>
</xsl:text>
|
|
54
|
-
</xsl:template>
|
|
55
|
-
|
|
56
|
-
</xsl:stylesheet>
|
|
1
|
+
<?xml version='1.0'?>
|
|
2
|
+
|
|
3
|
+
<!--********************************************************************
|
|
4
|
+
Copyright 2014-2016 Robert A. Beezer
|
|
5
|
+
|
|
6
|
+
This file is part of PreTeXt.
|
|
7
|
+
|
|
8
|
+
PreTeXt is free software: you can redistribute it and/or modify
|
|
9
|
+
it under the terms of the GNU General Public License as published by
|
|
10
|
+
the Free Software Foundation, either version 2 or version 3 of the
|
|
11
|
+
License (at your option).
|
|
12
|
+
|
|
13
|
+
PreTeXt is distributed in the hope that it will be useful,
|
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
GNU General Public License for more details.
|
|
17
|
+
|
|
18
|
+
You should have received a copy of the GNU General Public License
|
|
19
|
+
along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*********************************************************************-->
|
|
21
|
+
|
|
22
|
+
<!-- This stylesheet locates all exercise/stack elements and -->
|
|
23
|
+
<!-- writes out a single file listing the @source attribute value -->
|
|
24
|
+
<!-- for eaCh one (the files with these names will be sent to a -->
|
|
25
|
+
<!-- server for conversion to static forms) -->
|
|
26
|
+
|
|
27
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
|
28
|
+
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
|
29
|
+
xmlns:exsl="http://exslt.org/common"
|
|
30
|
+
extension-element-prefixes="exsl"
|
|
31
|
+
>
|
|
32
|
+
|
|
33
|
+
<!-- Get internal ID's for filenames, etc -->
|
|
34
|
+
<!-- Standard conversion groundwork -->
|
|
35
|
+
<xsl:import href="./publisher-variables.xsl"/>
|
|
36
|
+
<xsl:import href="./pretext-assembly.xsl"/>
|
|
37
|
+
<xsl:import href="./pretext-common.xsl"/>
|
|
38
|
+
|
|
39
|
+
<!-- Get a "subtree" xml:id value -->
|
|
40
|
+
<!-- Then walk the XML source tree -->
|
|
41
|
+
<!-- applying specializations below -->
|
|
42
|
+
<xsl:import href="./extract-identity.xsl" />
|
|
43
|
+
|
|
44
|
+
<xsl:output method="text" encoding="UTF-8"/>
|
|
45
|
+
|
|
46
|
+
<!-- Flag an extraction pass, so pretext-assembly does not get confused -->
|
|
47
|
+
<xsl:variable name="b-extracting-stack" select="true()"/>
|
|
48
|
+
|
|
49
|
+
<xsl:template match="exercise/stack" mode="extraction">
|
|
50
|
+
<xsl:value-of select="@source"/>
|
|
51
|
+
<xsl:text> </xsl:text>
|
|
52
|
+
<xsl:apply-templates select="." mode="assembly-id"/>
|
|
53
|
+
<xsl:text>
</xsl:text>
|
|
54
|
+
</xsl:template>
|
|
55
|
+
|
|
56
|
+
</xsl:stylesheet>
|
|
@@ -1,134 +1,134 @@
|
|
|
1
|
-
<?xml version='1.0'?>
|
|
2
|
-
|
|
3
|
-
<!--********************************************************************
|
|
4
|
-
Copyright 2022 Robert A. Beezer
|
|
5
|
-
|
|
6
|
-
This file is part of PreTeXt.
|
|
7
|
-
|
|
8
|
-
PreTeXt is free software: you can redistribute it and/or modify
|
|
9
|
-
it under the terms of the GNU General Public License as published by
|
|
10
|
-
the Free Software Foundation, either version 2 or version 3 of the
|
|
11
|
-
License (at your option).
|
|
12
|
-
|
|
13
|
-
PreTeXt is distributed in the hope that it will be useful,
|
|
14
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
GNU General Public License for more details.
|
|
17
|
-
|
|
18
|
-
You should have received a copy of the GNU General Public License
|
|
19
|
-
along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
-
*********************************************************************-->
|
|
21
|
-
|
|
22
|
-
<!-- This stylesheet locates "program" elements to render as -->
|
|
23
|
-
<!-- CodeLens for interactive execution. The code itself is -->
|
|
24
|
-
<!-- processed into a trace by the pretext/pretext script. -->
|
|
25
|
-
<!-- It produces text output, with one line per program: -->
|
|
26
|
-
<!-- -->
|
|
27
|
-
<!-- visible-id, language, source -->
|
|
28
|
-
|
|
29
|
-
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
|
30
|
-
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
|
31
|
-
xmlns:str="http://exslt.org/strings"
|
|
32
|
-
xmlns:exsl="http://exslt.org/common"
|
|
33
|
-
extension-element-prefixes="str"
|
|
34
|
-
>
|
|
35
|
-
|
|
36
|
-
<!-- Get internal ID's for filenames, etc -->
|
|
37
|
-
<!-- Standard conversion groundwork -->
|
|
38
|
-
<xsl:import href="./publisher-variables.xsl"/>
|
|
39
|
-
<xsl:import href="./pretext-assembly.xsl"/>
|
|
40
|
-
<xsl:import href="./pretext-common.xsl"/>
|
|
41
|
-
|
|
42
|
-
<!-- Needed for processing content embedded in statements/feedback -->
|
|
43
|
-
<!-- for checkpoint questions -->
|
|
44
|
-
<xsl:import href="./pretext-html.xsl"/>
|
|
45
|
-
|
|
46
|
-
<!-- Get a "subtree" xml:id value -->
|
|
47
|
-
<!-- Then walk the XML source tree -->
|
|
48
|
-
<!-- applying specializations below -->
|
|
49
|
-
<xsl:import href="./extract-identity.xsl" />
|
|
50
|
-
|
|
51
|
-
<xsl:output method="text" encoding="UTF-8"/>
|
|
52
|
-
|
|
53
|
-
<!-- The default "exercise-style" is "static". For traces, -->
|
|
54
|
-
<!-- we will form a different representation, and pass through -->
|
|
55
|
-
<!-- the authored version for a dynamic representation. -->
|
|
56
|
-
<xsl:variable name="exercise-style" select="'dynamic'"/>
|
|
57
|
-
|
|
58
|
-
<!-- Constructs a block of text for trace output -->
|
|
59
|
-
<!-- Each of the following as its own line: -->
|
|
60
|
-
<!-- visible-id -->
|
|
61
|
-
<!-- runestone-id -->
|
|
62
|
-
<!-- trace filename -->
|
|
63
|
-
<!-- language -->
|
|
64
|
-
<!-- code with newlines escaped -->
|
|
65
|
-
<!-- starting step -->
|
|
66
|
-
<!-- Followed by 1 line per checkpoint question -->
|
|
67
|
-
<!-- Block ends with blank line (double newline) -->
|
|
68
|
-
<xsl:template match="program[@interactive = 'codelens']" mode="extraction">
|
|
69
|
-
<xsl:apply-templates select="." mode="visible-id"/>
|
|
70
|
-
<xsl:text>
</xsl:text>
|
|
71
|
-
<xsl:apply-templates select="." mode="runestone-id"/>
|
|
72
|
-
<xsl:text>
</xsl:text>
|
|
73
|
-
<xsl:apply-templates select="." mode="runestone-codelens-trace-filename"/>
|
|
74
|
-
<xsl:text>
</xsl:text>
|
|
75
|
-
<xsl:apply-templates select="." mode="active-language"/>
|
|
76
|
-
<xsl:text>
</xsl:text>
|
|
77
|
-
<xsl:variable name="code-with-newlines">
|
|
78
|
-
<xsl:call-template name="sanitize-text">
|
|
79
|
-
<xsl:with-param name="text" select="code" />
|
|
80
|
-
</xsl:call-template>
|
|
81
|
-
</xsl:variable>
|
|
82
|
-
<!-- Windows text files do not get normalized when xi:included -->
|
|
83
|
-
<!-- with @parse="text" so a CR-LF line-ending might persist. -->
|
|
84
|
-
<!-- We do that normalization first, then convert LF to an -->
|
|
85
|
-
<!-- escape sequence that is necessary for conversion. -->
|
|
86
|
-
<xsl:variable name="removed-carriage-returns">
|
|
87
|
-
<xsl:value-of select="str:replace($code-with-newlines, '
', '
')" />
|
|
88
|
-
</xsl:variable>
|
|
89
|
-
<xsl:value-of select="str:replace($removed-carriage-returns, '
', '\n')"/>
|
|
90
|
-
<xsl:text>
</xsl:text>
|
|
91
|
-
<xsl:choose>
|
|
92
|
-
<xsl:when test="@starting-step != ''">
|
|
93
|
-
<!-- Codelens needs to execute n-1 instructions. It has bounds checking -->
|
|
94
|
-
<xsl:value-of select="number(@starting-step) - 1"/>
|
|
95
|
-
</xsl:when>
|
|
96
|
-
<xsl:otherwise>
|
|
97
|
-
<xsl:text>0</xsl:text>
|
|
98
|
-
</xsl:otherwise>
|
|
99
|
-
</xsl:choose>
|
|
100
|
-
<xsl:text>
</xsl:text>
|
|
101
|
-
<xsl:for-each select="checkpoint">
|
|
102
|
-
<xsl:value-of select="@line"/>
|
|
103
|
-
<xsl:text>:||:</xsl:text>
|
|
104
|
-
<xsl:choose>
|
|
105
|
-
<xsl:when test="@answer != ''">
|
|
106
|
-
<xsl:text>literal-</xsl:text><xsl:value-of select="@answer"/>
|
|
107
|
-
</xsl:when>
|
|
108
|
-
<xsl:when test="@answer-variable != ''">
|
|
109
|
-
<xsl:text>variable-</xsl:text><xsl:value-of select="@answer-variable"/>
|
|
110
|
-
</xsl:when>
|
|
111
|
-
</xsl:choose>
|
|
112
|
-
<xsl:text>:||:</xsl:text>
|
|
113
|
-
<xsl:variable name="feedback-contents">
|
|
114
|
-
<xsl:apply-templates select="feedback"/>
|
|
115
|
-
</xsl:variable>
|
|
116
|
-
<xsl:variable name="feedback-string">
|
|
117
|
-
<xsl:apply-templates select="exsl:node-set($feedback-contents)" mode="xml-to-string"/>
|
|
118
|
-
</xsl:variable>
|
|
119
|
-
<xsl:value-of select="$feedback-string"/>
|
|
120
|
-
<xsl:text>:||:</xsl:text>
|
|
121
|
-
<xsl:variable name="prompt-contents">
|
|
122
|
-
<xsl:apply-templates select="prompt"/>
|
|
123
|
-
</xsl:variable>
|
|
124
|
-
<xsl:variable name="prompt-string">
|
|
125
|
-
<xsl:apply-templates select="exsl:node-set($prompt-contents)" mode="xml-to-string"/>
|
|
126
|
-
</xsl:variable>
|
|
127
|
-
<xsl:value-of select="$prompt-string"/>
|
|
128
|
-
<xsl:text>
</xsl:text>
|
|
129
|
-
</xsl:for-each>
|
|
130
|
-
<!-- special pattern ends trace group -->
|
|
131
|
-
<xsl:text>!end_codelens_trace_group!</xsl:text>
|
|
132
|
-
</xsl:template>
|
|
133
|
-
|
|
134
|
-
</xsl:stylesheet>
|
|
1
|
+
<?xml version='1.0'?>
|
|
2
|
+
|
|
3
|
+
<!--********************************************************************
|
|
4
|
+
Copyright 2022 Robert A. Beezer
|
|
5
|
+
|
|
6
|
+
This file is part of PreTeXt.
|
|
7
|
+
|
|
8
|
+
PreTeXt is free software: you can redistribute it and/or modify
|
|
9
|
+
it under the terms of the GNU General Public License as published by
|
|
10
|
+
the Free Software Foundation, either version 2 or version 3 of the
|
|
11
|
+
License (at your option).
|
|
12
|
+
|
|
13
|
+
PreTeXt is distributed in the hope that it will be useful,
|
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
GNU General Public License for more details.
|
|
17
|
+
|
|
18
|
+
You should have received a copy of the GNU General Public License
|
|
19
|
+
along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*********************************************************************-->
|
|
21
|
+
|
|
22
|
+
<!-- This stylesheet locates "program" elements to render as -->
|
|
23
|
+
<!-- CodeLens for interactive execution. The code itself is -->
|
|
24
|
+
<!-- processed into a trace by the pretext/pretext script. -->
|
|
25
|
+
<!-- It produces text output, with one line per program: -->
|
|
26
|
+
<!-- -->
|
|
27
|
+
<!-- visible-id, language, source -->
|
|
28
|
+
|
|
29
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
|
30
|
+
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
|
31
|
+
xmlns:str="http://exslt.org/strings"
|
|
32
|
+
xmlns:exsl="http://exslt.org/common"
|
|
33
|
+
extension-element-prefixes="str"
|
|
34
|
+
>
|
|
35
|
+
|
|
36
|
+
<!-- Get internal ID's for filenames, etc -->
|
|
37
|
+
<!-- Standard conversion groundwork -->
|
|
38
|
+
<xsl:import href="./publisher-variables.xsl"/>
|
|
39
|
+
<xsl:import href="./pretext-assembly.xsl"/>
|
|
40
|
+
<xsl:import href="./pretext-common.xsl"/>
|
|
41
|
+
|
|
42
|
+
<!-- Needed for processing content embedded in statements/feedback -->
|
|
43
|
+
<!-- for checkpoint questions -->
|
|
44
|
+
<xsl:import href="./pretext-html.xsl"/>
|
|
45
|
+
|
|
46
|
+
<!-- Get a "subtree" xml:id value -->
|
|
47
|
+
<!-- Then walk the XML source tree -->
|
|
48
|
+
<!-- applying specializations below -->
|
|
49
|
+
<xsl:import href="./extract-identity.xsl" />
|
|
50
|
+
|
|
51
|
+
<xsl:output method="text" encoding="UTF-8"/>
|
|
52
|
+
|
|
53
|
+
<!-- The default "exercise-style" is "static". For traces, -->
|
|
54
|
+
<!-- we will form a different representation, and pass through -->
|
|
55
|
+
<!-- the authored version for a dynamic representation. -->
|
|
56
|
+
<xsl:variable name="exercise-style" select="'dynamic'"/>
|
|
57
|
+
|
|
58
|
+
<!-- Constructs a block of text for trace output -->
|
|
59
|
+
<!-- Each of the following as its own line: -->
|
|
60
|
+
<!-- visible-id -->
|
|
61
|
+
<!-- runestone-id -->
|
|
62
|
+
<!-- trace filename -->
|
|
63
|
+
<!-- language -->
|
|
64
|
+
<!-- code with newlines escaped -->
|
|
65
|
+
<!-- starting step -->
|
|
66
|
+
<!-- Followed by 1 line per checkpoint question -->
|
|
67
|
+
<!-- Block ends with blank line (double newline) -->
|
|
68
|
+
<xsl:template match="program[@interactive = 'codelens']" mode="extraction">
|
|
69
|
+
<xsl:apply-templates select="." mode="visible-id"/>
|
|
70
|
+
<xsl:text>
</xsl:text>
|
|
71
|
+
<xsl:apply-templates select="." mode="runestone-id"/>
|
|
72
|
+
<xsl:text>
</xsl:text>
|
|
73
|
+
<xsl:apply-templates select="." mode="runestone-codelens-trace-filename"/>
|
|
74
|
+
<xsl:text>
</xsl:text>
|
|
75
|
+
<xsl:apply-templates select="." mode="active-language"/>
|
|
76
|
+
<xsl:text>
</xsl:text>
|
|
77
|
+
<xsl:variable name="code-with-newlines">
|
|
78
|
+
<xsl:call-template name="sanitize-text">
|
|
79
|
+
<xsl:with-param name="text" select="code" />
|
|
80
|
+
</xsl:call-template>
|
|
81
|
+
</xsl:variable>
|
|
82
|
+
<!-- Windows text files do not get normalized when xi:included -->
|
|
83
|
+
<!-- with @parse="text" so a CR-LF line-ending might persist. -->
|
|
84
|
+
<!-- We do that normalization first, then convert LF to an -->
|
|
85
|
+
<!-- escape sequence that is necessary for conversion. -->
|
|
86
|
+
<xsl:variable name="removed-carriage-returns">
|
|
87
|
+
<xsl:value-of select="str:replace($code-with-newlines, '
', '
')" />
|
|
88
|
+
</xsl:variable>
|
|
89
|
+
<xsl:value-of select="str:replace($removed-carriage-returns, '
', '\n')"/>
|
|
90
|
+
<xsl:text>
</xsl:text>
|
|
91
|
+
<xsl:choose>
|
|
92
|
+
<xsl:when test="@starting-step != ''">
|
|
93
|
+
<!-- Codelens needs to execute n-1 instructions. It has bounds checking -->
|
|
94
|
+
<xsl:value-of select="number(@starting-step) - 1"/>
|
|
95
|
+
</xsl:when>
|
|
96
|
+
<xsl:otherwise>
|
|
97
|
+
<xsl:text>0</xsl:text>
|
|
98
|
+
</xsl:otherwise>
|
|
99
|
+
</xsl:choose>
|
|
100
|
+
<xsl:text>
</xsl:text>
|
|
101
|
+
<xsl:for-each select="checkpoint">
|
|
102
|
+
<xsl:value-of select="@line"/>
|
|
103
|
+
<xsl:text>:||:</xsl:text>
|
|
104
|
+
<xsl:choose>
|
|
105
|
+
<xsl:when test="@answer != ''">
|
|
106
|
+
<xsl:text>literal-</xsl:text><xsl:value-of select="@answer"/>
|
|
107
|
+
</xsl:when>
|
|
108
|
+
<xsl:when test="@answer-variable != ''">
|
|
109
|
+
<xsl:text>variable-</xsl:text><xsl:value-of select="@answer-variable"/>
|
|
110
|
+
</xsl:when>
|
|
111
|
+
</xsl:choose>
|
|
112
|
+
<xsl:text>:||:</xsl:text>
|
|
113
|
+
<xsl:variable name="feedback-contents">
|
|
114
|
+
<xsl:apply-templates select="feedback"/>
|
|
115
|
+
</xsl:variable>
|
|
116
|
+
<xsl:variable name="feedback-string">
|
|
117
|
+
<xsl:apply-templates select="exsl:node-set($feedback-contents)" mode="xml-to-string"/>
|
|
118
|
+
</xsl:variable>
|
|
119
|
+
<xsl:value-of select="$feedback-string"/>
|
|
120
|
+
<xsl:text>:||:</xsl:text>
|
|
121
|
+
<xsl:variable name="prompt-contents">
|
|
122
|
+
<xsl:apply-templates select="prompt"/>
|
|
123
|
+
</xsl:variable>
|
|
124
|
+
<xsl:variable name="prompt-string">
|
|
125
|
+
<xsl:apply-templates select="exsl:node-set($prompt-contents)" mode="xml-to-string"/>
|
|
126
|
+
</xsl:variable>
|
|
127
|
+
<xsl:value-of select="$prompt-string"/>
|
|
128
|
+
<xsl:text>
</xsl:text>
|
|
129
|
+
</xsl:for-each>
|
|
130
|
+
<!-- special pattern ends trace group -->
|
|
131
|
+
<xsl:text>!end_codelens_trace_group!</xsl:text>
|
|
132
|
+
</xsl:template>
|
|
133
|
+
|
|
134
|
+
</xsl:stylesheet>
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
<?xml version='1.0'?>
|
|
2
|
-
|
|
3
|
-
<!--********************************************************************
|
|
4
|
-
Copyright 2014-2016 Robert A. Beezer
|
|
5
|
-
|
|
6
|
-
This file is part of MathBook XML.
|
|
7
|
-
|
|
8
|
-
MathBook XML is free software: you can redistribute it and/or modify
|
|
9
|
-
it under the terms of the GNU General Public License as published by
|
|
10
|
-
the Free Software Foundation, either version 2 or version 3 of the
|
|
11
|
-
License (at your option).
|
|
12
|
-
|
|
13
|
-
MathBook XML is distributed in the hope that it will be useful,
|
|
14
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
GNU General Public License for more details.
|
|
17
|
-
|
|
18
|
-
You should have received a copy of the GNU General Public License
|
|
19
|
-
along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
-
*********************************************************************-->
|
|
21
|
-
|
|
22
|
-
<!-- This stylesheet locates video/@youtube elements and -->
|
|
23
|
-
<!-- prepares a Python dictionary necessary to extract a -->
|
|
24
|
-
<!-- thumbnail for each video from the YouTube servers -->
|
|
25
|
-
|
|
26
|
-
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
|
27
|
-
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
|
28
|
-
xmlns:exsl="http://exslt.org/common"
|
|
29
|
-
xmlns:str="http://exslt.org/strings"
|
|
30
|
-
extension-element-prefixes="exsl"
|
|
31
|
-
>
|
|
32
|
-
|
|
33
|
-
<!-- Get internal ID's for filenames, etc -->
|
|
34
|
-
<!-- Standard conversion groundwork -->
|
|
35
|
-
<xsl:import href="./publisher-variables.xsl"/>
|
|
36
|
-
<xsl:import href="./pretext-assembly.xsl"/>
|
|
37
|
-
<xsl:import href="./pretext-common.xsl"/>
|
|
38
|
-
|
|
39
|
-
<!-- Get a "subtree" xml:id value -->
|
|
40
|
-
<!-- Then walk the XML source tree -->
|
|
41
|
-
<!-- applying specializations below -->
|
|
42
|
-
<xsl:import href="./extract-identity.xsl" />
|
|
43
|
-
|
|
44
|
-
<xsl:output method="text" encoding="UTF-8"/>
|
|
45
|
-
|
|
46
|
-
<!-- Avoid Catch-22: default assembly/pre-processor providews output -->
|
|
47
|
-
<!-- for a conversion to a static format, but that format will *replace* -->
|
|
48
|
-
<!-- "video" by a static version (a "sidebyside") and it will not be -->
|
|
49
|
-
<!-- available for extraction. -->
|
|
50
|
-
<xsl:variable name="exercise-style" select="'dynamic'"/>
|
|
51
|
-
|
|
52
|
-
<!-- YouTube ID, and internal id as a comma-separated pair per line -->
|
|
53
|
-
<xsl:template match="video[@youtube and not(@preview)]" mode="extraction">
|
|
54
|
-
<!-- replace commas with spaces, then normalize space, -->
|
|
55
|
-
<!-- then tack on a space at the end, then grab content prior to first space -->
|
|
56
|
-
<xsl:variable name="first-video-id" select="substring-before(concat(normalize-space(str:replace(@youtube, ',', ' ')), ' '), ' ')" />
|
|
57
|
-
<xsl:value-of select="$first-video-id" />
|
|
58
|
-
<xsl:text>,</xsl:text>
|
|
59
|
-
<xsl:apply-templates select="." mode="visible-id" />
|
|
60
|
-
<xsl:text>
</xsl:text>
|
|
61
|
-
</xsl:template>
|
|
62
|
-
|
|
63
|
-
</xsl:stylesheet>
|
|
1
|
+
<?xml version='1.0'?>
|
|
2
|
+
|
|
3
|
+
<!--********************************************************************
|
|
4
|
+
Copyright 2014-2016 Robert A. Beezer
|
|
5
|
+
|
|
6
|
+
This file is part of MathBook XML.
|
|
7
|
+
|
|
8
|
+
MathBook XML is free software: you can redistribute it and/or modify
|
|
9
|
+
it under the terms of the GNU General Public License as published by
|
|
10
|
+
the Free Software Foundation, either version 2 or version 3 of the
|
|
11
|
+
License (at your option).
|
|
12
|
+
|
|
13
|
+
MathBook XML is distributed in the hope that it will be useful,
|
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
GNU General Public License for more details.
|
|
17
|
+
|
|
18
|
+
You should have received a copy of the GNU General Public License
|
|
19
|
+
along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*********************************************************************-->
|
|
21
|
+
|
|
22
|
+
<!-- This stylesheet locates video/@youtube elements and -->
|
|
23
|
+
<!-- prepares a Python dictionary necessary to extract a -->
|
|
24
|
+
<!-- thumbnail for each video from the YouTube servers -->
|
|
25
|
+
|
|
26
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
|
27
|
+
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
|
28
|
+
xmlns:exsl="http://exslt.org/common"
|
|
29
|
+
xmlns:str="http://exslt.org/strings"
|
|
30
|
+
extension-element-prefixes="exsl"
|
|
31
|
+
>
|
|
32
|
+
|
|
33
|
+
<!-- Get internal ID's for filenames, etc -->
|
|
34
|
+
<!-- Standard conversion groundwork -->
|
|
35
|
+
<xsl:import href="./publisher-variables.xsl"/>
|
|
36
|
+
<xsl:import href="./pretext-assembly.xsl"/>
|
|
37
|
+
<xsl:import href="./pretext-common.xsl"/>
|
|
38
|
+
|
|
39
|
+
<!-- Get a "subtree" xml:id value -->
|
|
40
|
+
<!-- Then walk the XML source tree -->
|
|
41
|
+
<!-- applying specializations below -->
|
|
42
|
+
<xsl:import href="./extract-identity.xsl" />
|
|
43
|
+
|
|
44
|
+
<xsl:output method="text" encoding="UTF-8"/>
|
|
45
|
+
|
|
46
|
+
<!-- Avoid Catch-22: default assembly/pre-processor providews output -->
|
|
47
|
+
<!-- for a conversion to a static format, but that format will *replace* -->
|
|
48
|
+
<!-- "video" by a static version (a "sidebyside") and it will not be -->
|
|
49
|
+
<!-- available for extraction. -->
|
|
50
|
+
<xsl:variable name="exercise-style" select="'dynamic'"/>
|
|
51
|
+
|
|
52
|
+
<!-- YouTube ID, and internal id as a comma-separated pair per line -->
|
|
53
|
+
<xsl:template match="video[@youtube and not(@preview)]" mode="extraction">
|
|
54
|
+
<!-- replace commas with spaces, then normalize space, -->
|
|
55
|
+
<!-- then tack on a space at the end, then grab content prior to first space -->
|
|
56
|
+
<xsl:variable name="first-video-id" select="substring-before(concat(normalize-space(str:replace(@youtube, ',', ' ')), ' '), ' ')" />
|
|
57
|
+
<xsl:value-of select="$first-video-id" />
|
|
58
|
+
<xsl:text>,</xsl:text>
|
|
59
|
+
<xsl:apply-templates select="." mode="visible-id" />
|
|
60
|
+
<xsl:text>
</xsl:text>
|
|
61
|
+
</xsl:template>
|
|
62
|
+
|
|
63
|
+
</xsl:stylesheet>
|