@pretextbook/pretext-html 0.1.0 → 0.1.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.
Files changed (111) hide show
  1. package/README.md +42 -3
  2. package/assets/preview-html.xsl +230 -230
  3. package/assets/upstream.json +7 -7
  4. package/assets/xsl/README.md +0 -0
  5. package/assets/xsl/entities.ent +154 -154
  6. package/assets/xsl/extract-asymptote.xsl +68 -68
  7. package/assets/xsl/extract-biblio-csl.xsl +327 -327
  8. package/assets/xsl/extract-datafile.xsl +71 -71
  9. package/assets/xsl/extract-dynamic.xsl +139 -139
  10. package/assets/xsl/extract-identity.xsl +136 -136
  11. package/assets/xsl/extract-interactive.xsl +81 -81
  12. package/assets/xsl/extract-latex-image.xsl +118 -118
  13. package/assets/xsl/extract-mermaid.xsl +58 -58
  14. package/assets/xsl/extract-mom.xsl +63 -63
  15. package/assets/xsl/extract-pg.xsl +2897 -2897
  16. package/assets/xsl/extract-prefigure.xsl +157 -157
  17. package/assets/xsl/extract-qrcode.xsl +100 -100
  18. package/assets/xsl/extract-runestone-page-template.xsl +139 -139
  19. package/assets/xsl/extract-sageplot.xsl +166 -166
  20. package/assets/xsl/extract-stack.xsl +56 -56
  21. package/assets/xsl/extract-trace.xsl +134 -134
  22. package/assets/xsl/extract-youtube.xsl +63 -63
  23. package/assets/xsl/html-symbols.xsl +3344 -3344
  24. package/assets/xsl/latex/pretext-latex-AIM.xsl +56 -56
  25. package/assets/xsl/latex/pretext-latex-CLP.xsl +148 -148
  26. package/assets/xsl/latex/pretext-latex-chaos.xsl +317 -317
  27. package/assets/xsl/latex/pretext-latex-dyslexic-font.xsl +76 -76
  28. package/assets/xsl/latex/pretext-latex-guide.xsl +104 -104
  29. package/assets/xsl/latex/pretext-latex-texstyle.xsl +862 -862
  30. package/assets/xsl/localizations/README.md +0 -0
  31. package/assets/xsl/localizations/af-ZA.xml +276 -276
  32. package/assets/xsl/localizations/bg-BG.xml +276 -276
  33. package/assets/xsl/localizations/ca-ES.xml +285 -285
  34. package/assets/xsl/localizations/cs-CZ.xml +280 -280
  35. package/assets/xsl/localizations/de-DE.xml +281 -281
  36. package/assets/xsl/localizations/en-US.xml +427 -427
  37. package/assets/xsl/localizations/es-ES.xml +287 -287
  38. package/assets/xsl/localizations/fi-FI.xml +275 -275
  39. package/assets/xsl/localizations/fr-CA.xml +276 -276
  40. package/assets/xsl/localizations/fr-FR.xml +280 -280
  41. package/assets/xsl/localizations/hu-HU.xml +280 -280
  42. package/assets/xsl/localizations/it-IT.xml +276 -276
  43. package/assets/xsl/localizations/ku-CKB.xml +275 -275
  44. package/assets/xsl/localizations/localizations.xml +48 -48
  45. package/assets/xsl/localizations/nl-NL.xml +275 -275
  46. package/assets/xsl/localizations/pt-BR.xml +288 -288
  47. package/assets/xsl/localizations/pt-PT.xml +292 -292
  48. package/assets/xsl/localizations/zh-HANS.xml +269 -269
  49. package/assets/xsl/pretext-assembly.xsl +4795 -4795
  50. package/assets/xsl/pretext-basic-html.xsl +86 -86
  51. package/assets/xsl/pretext-beamer.xsl +662 -662
  52. package/assets/xsl/pretext-braille-preprint.xsl +2249 -2249
  53. package/assets/xsl/pretext-common.xsl +12018 -12018
  54. package/assets/xsl/pretext-dynamic.xsl +65 -65
  55. package/assets/xsl/pretext-epub.xsl +1483 -1483
  56. package/assets/xsl/pretext-fo.xsl +4593 -4593
  57. package/assets/xsl/pretext-html.xsl +14791 -14791
  58. package/assets/xsl/pretext-json-manifest.xsl +150 -150
  59. package/assets/xsl/pretext-jupyter.xsl +868 -868
  60. package/assets/xsl/pretext-latex-classic.xsl +952 -952
  61. package/assets/xsl/pretext-latex-common.xsl +11563 -11563
  62. package/assets/xsl/pretext-latex.xsl +47 -47
  63. package/assets/xsl/pretext-litprog.xsl +105 -105
  64. package/assets/xsl/pretext-merge.xsl +41 -41
  65. package/assets/xsl/pretext-numbers.xsl +875 -875
  66. package/assets/xsl/pretext-revealjs.xsl +522 -522
  67. package/assets/xsl/pretext-runestone-fitb.xsl +1233 -1233
  68. package/assets/xsl/pretext-runestone-static.xsl +1438 -1438
  69. package/assets/xsl/pretext-runestone.xsl +3083 -3083
  70. package/assets/xsl/pretext-sage-doctest.xsl +289 -289
  71. package/assets/xsl/pretext-smc.xsl +492 -492
  72. package/assets/xsl/pretext-solution-manual-latex.xsl +323 -323
  73. package/assets/xsl/pretext-text-utilities.xsl +1217 -1217
  74. package/assets/xsl/pretext-text.xsl +392 -392
  75. package/assets/xsl/pretext-units.xsl +195 -195
  76. package/assets/xsl/pretext-view-source.xsl +157 -157
  77. package/assets/xsl/pretext-ww-problem-sets.xsl +391 -391
  78. package/assets/xsl/publisher-variables.xsl +4756 -4756
  79. package/assets/xsl/support/README.md +0 -0
  80. package/assets/xsl/support/extract-math.xsl +256 -256
  81. package/assets/xsl/support/package-math.xsl +141 -141
  82. package/assets/xsl/support/play-button/README.md +0 -0
  83. package/assets/xsl/support/play-button/play-button.png +0 -0
  84. package/assets/xsl/support/play-button/play-button.svg +3 -3
  85. package/assets/xsl/support/pretext-pg-macros.xsl +110 -110
  86. package/assets/xsl/support/webpack_static_imports.xml +14 -14
  87. package/assets/xsl/tests/README.md +0 -0
  88. package/assets/xsl/tests/null.xml +3 -3
  89. package/assets/xsl/tests/pretext-text-utilities-test.xsl +333 -333
  90. package/assets/xsl/utilities/README.md +0 -0
  91. package/assets/xsl/utilities/author-report.xsl +107 -107
  92. package/assets/xsl/utilities/deprecate-autoname.sed +18 -18
  93. package/assets/xsl/utilities/deprecate-index.sed +33 -33
  94. package/assets/xsl/utilities/fix-deprecations.xsl +663 -663
  95. package/assets/xsl/utilities/pretext-enhanced-source.xsl +112 -112
  96. package/assets/xsl/utilities/report-publisher-variables.xsl +162 -162
  97. package/assets/xsl/xml-to-json.xsl +326 -326
  98. package/assets/xsl/xml-to-string.xsl +328 -328
  99. package/dist/{cli-C6tfAVvi.js → cli-BQizBK0N.js} +74 -72
  100. package/dist/cli.d.ts +0 -0
  101. package/dist/cli.js +1 -1
  102. package/dist/index.d.ts +2 -0
  103. package/dist/index.js +12 -6
  104. package/dist/mounts.d.ts +0 -0
  105. package/dist/publication.d.ts +0 -0
  106. package/dist/renderer.d.ts +10 -0
  107. package/dist/sourcemap.d.ts +0 -0
  108. package/dist/theme.d.ts +68 -0
  109. package/dist/theme.js +93 -0
  110. package/dist/xinclude.d.ts +0 -0
  111. package/package.json +14 -2
@@ -1,157 +1,157 @@
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 <prefigure> elements and copies them for processing -->
23
-
24
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
25
- xmlns:xml="http://www.w3.org/XML/1998/namespace"
26
- xmlns:exsl="http://exslt.org/common"
27
- xmlns:pf="https://prefigure.org"
28
- extension-element-prefixes="exsl"
29
- >
30
-
31
- <!-- Get internal ID's for filenames, etc -->
32
- <!-- Standard conversion groundwork -->
33
- <xsl:import href="./publisher-variables.xsl"/>
34
- <xsl:import href="./pretext-assembly.xsl"/>
35
- <xsl:import href="./pretext-common.xsl"/>
36
-
37
- <!-- Get a "subtree" xml:id value -->
38
- <!-- Then walk the XML source tree -->
39
- <!-- applying specializations below -->
40
- <xsl:import href="./extract-identity.xsl" />
41
-
42
- <!-- Output PreFigure XML -->
43
- <xsl:output method="xml" encoding="UTF-8"/>
44
-
45
- <!-- PreFigure graphics to standalone file -->
46
- <!-- NB: don't match the empty element that is a text -->
47
- <!-- generator. Once PreFigure has a namespace, then -->
48
- <!-- it should be used here instead. -->
49
- <xsl:template match="pf:prefigure[node()]" mode="extraction">
50
- <xsl:variable name="filebase">
51
- <xsl:apply-templates select="." mode="image-source-basename"/>
52
- </xsl:variable>
53
- <!-- Do not use directories here, as Windows paths will get mangled -->
54
- <!-- Instead, set working directory before applying stylesheet -->
55
- <exsl:document href="{$filebase}.xml" method="xml">
56
- <!-- xerox the "prefigure" element, but with modifications -->
57
- <xsl:apply-templates select="." mode="prefigure-edit"/>
58
- </exsl:document>
59
- </xsl:template>
60
-
61
- <!-- Identity template, with a mode, so we can edit a diagram -->
62
- <!-- NB: it does not seem the "pf:" is necessary here -->
63
- <xsl:template match="node()|@*" mode="prefigure-edit">
64
- <xsl:copy>
65
- <xsl:apply-templates select="node()|@*" mode="prefigure-edit"/>
66
- </xsl:copy>
67
- </xsl:template>
68
-
69
- <!-- Raison d'etre for "prefigure-edit": insert a PF "caption" with -->
70
- <!-- a type-name/number pair and a document-wide serial number -->
71
- <xsl:template match="pf:diagram" mode="prefigure-edit">
72
- <xsl:copy>
73
- <xsl:apply-templates select="@*" mode="prefigure-edit"/>
74
- <!-- insert a PF "caption", hopefully with helpful content -->
75
- <!-- duplicate indentation of first child of "diagram" to -->
76
- <!-- make insertion of the first new children look good -->
77
- <xsl:value-of select="text()[1]"/>
78
- <xsl:comment> Reference to containing ancestor comes from PreTeXt context </xsl:comment>
79
- <xsl:value-of select="text()[1]"/>
80
- <xsl:comment> Serial number is from document-wide count of PreFigure diagrams </xsl:comment>
81
- <xsl:value-of select="text()[1]"/>
82
- <xsl:element name="caption" namespace="https://prefigure.org">
83
- <!-- pf:diagram, pf:prefigure, and "image" all lack meaningful -->
84
- <!-- numbers, so start searching for a [location with a number] -->
85
- <!-- from the parent of the "image" -->
86
- <xsl:apply-templates select="parent::pf:prefigure/parent::image/parent::*" mode="prefigure-container"/>
87
- <!-- previous template supplies a space, if it provides a type/number pair -->
88
- <!-- Serial number, just document-wide for pf:prefigure -->
89
- <!-- NB: implement this as part of the overall numbering -->
90
- <!-- scheme, so it comes through as an attribute. -->
91
- <xsl:text>(</xsl:text>
92
- <!-- pf:diagram is current context, no danger that an empty "pretext" -->
93
- <!-- generator will be mistakenly used for the @from pattern -->
94
- <xsl:number count="pf:prefigure" from="pretext" level="any"/>
95
- <xsl:text>)</xsl:text>
96
- </xsl:element>
97
- <!-- xerox remaining elements -->
98
- <xsl:apply-templates select="node()" mode="prefigure-edit"/>
99
- </xsl:copy>
100
- </xsl:template>
101
-
102
- <!-- Recurse up the tree, looking for the first element with a -->
103
- <!-- non-empty number. Produce type-name and a serial number. -->
104
- <xsl:template match="*" mode="prefigure-container">
105
- <!-- Will test on non-empty number strings. This can be -->
106
- <!-- fooled by elements with un-implemented numbers such -->
107
- <!-- as a pure container like a "sidebyside". -->
108
- <xsl:variable name="the-number">
109
- <xsl:apply-templates select="." mode="number"/>
110
- </xsl:variable>
111
-
112
- <xsl:choose>
113
- <!-- this is the safety-valve halting condition -->
114
- <xsl:when test="self::pretext"/>
115
- <!-- Test here for useless containers that have better parents. -->
116
- <!-- Examples might be a "case" in a "proof" or a "task" in an -->
117
- <!-- "exercise" or an "li" in an "ol". -->
118
- <!-- Then recurse with the parent, as below. -->
119
- <xsl:when test="not($the-number = '')">
120
- <xsl:apply-templates select="." mode="type-name" />
121
- <xsl:text> </xsl:text>
122
- <xsl:value-of select="$the-number"/>
123
- <!-- will always follow with a serial number, -->
124
- <!-- so add a space here, since conditional -->
125
- <xsl:text> </xsl:text>
126
- <!-- mission accomplished, no more recursion -->
127
- </xsl:when>
128
- <xsl:otherwise>
129
- <!-- step-up (recurse) to the parent -->
130
- <xsl:apply-templates select="parent::*" mode="prefigure-container"/>
131
- </xsl:otherwise>
132
- </xsl:choose>
133
- </xsl:template>
134
-
135
- <!-- PreFigure publication file -->
136
- <!-- We need a one-off generation of a PreFigure publication -->
137
- <!-- file, dumped in the same directory as the extracted source -->
138
- <!-- diagrams. So we match the *only* guaranteed node and let -->
139
- <!-- it do its thing, and then create the necessary file. -->
140
- <xsl:template match="/">
141
- <xsl:apply-imports/>
142
- <exsl:document href="pf_publication.xml" method="xml">
143
- <xsl:element name="prefigure" namespace="https://prefigure.org">
144
- <!-- No "prefigure-preamble" => nothing produced -->
145
- <xsl:copy-of select="$docinfo/pf:prefigure-preamble/*"/>
146
- <!-- $latex-macros is never empty (<, >, &) so always a "macros" -->
147
- <xsl:element name="macros" namespace="https://prefigure.org">
148
- <!-- move to a new line for minimal readability -->
149
- <xsl:text>&#xa;</xsl:text>
150
- <!-- global variable in -common, includes \lt, \gt, \amp -->
151
- <xsl:value-of select="$latex-macros"/>
152
- </xsl:element>
153
- </xsl:element>
154
- </exsl:document>
155
- </xsl:template>
156
-
157
- </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 <prefigure> elements and copies them for processing -->
23
+
24
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
25
+ xmlns:xml="http://www.w3.org/XML/1998/namespace"
26
+ xmlns:exsl="http://exslt.org/common"
27
+ xmlns:pf="https://prefigure.org"
28
+ extension-element-prefixes="exsl"
29
+ >
30
+
31
+ <!-- Get internal ID's for filenames, etc -->
32
+ <!-- Standard conversion groundwork -->
33
+ <xsl:import href="./publisher-variables.xsl"/>
34
+ <xsl:import href="./pretext-assembly.xsl"/>
35
+ <xsl:import href="./pretext-common.xsl"/>
36
+
37
+ <!-- Get a "subtree" xml:id value -->
38
+ <!-- Then walk the XML source tree -->
39
+ <!-- applying specializations below -->
40
+ <xsl:import href="./extract-identity.xsl" />
41
+
42
+ <!-- Output PreFigure XML -->
43
+ <xsl:output method="xml" encoding="UTF-8"/>
44
+
45
+ <!-- PreFigure graphics to standalone file -->
46
+ <!-- NB: don't match the empty element that is a text -->
47
+ <!-- generator. Once PreFigure has a namespace, then -->
48
+ <!-- it should be used here instead. -->
49
+ <xsl:template match="pf:prefigure[node()]" mode="extraction">
50
+ <xsl:variable name="filebase">
51
+ <xsl:apply-templates select="." mode="image-source-basename"/>
52
+ </xsl:variable>
53
+ <!-- Do not use directories here, as Windows paths will get mangled -->
54
+ <!-- Instead, set working directory before applying stylesheet -->
55
+ <exsl:document href="{$filebase}.xml" method="xml">
56
+ <!-- xerox the "prefigure" element, but with modifications -->
57
+ <xsl:apply-templates select="." mode="prefigure-edit"/>
58
+ </exsl:document>
59
+ </xsl:template>
60
+
61
+ <!-- Identity template, with a mode, so we can edit a diagram -->
62
+ <!-- NB: it does not seem the "pf:" is necessary here -->
63
+ <xsl:template match="node()|@*" mode="prefigure-edit">
64
+ <xsl:copy>
65
+ <xsl:apply-templates select="node()|@*" mode="prefigure-edit"/>
66
+ </xsl:copy>
67
+ </xsl:template>
68
+
69
+ <!-- Raison d'etre for "prefigure-edit": insert a PF "caption" with -->
70
+ <!-- a type-name/number pair and a document-wide serial number -->
71
+ <xsl:template match="pf:diagram" mode="prefigure-edit">
72
+ <xsl:copy>
73
+ <xsl:apply-templates select="@*" mode="prefigure-edit"/>
74
+ <!-- insert a PF "caption", hopefully with helpful content -->
75
+ <!-- duplicate indentation of first child of "diagram" to -->
76
+ <!-- make insertion of the first new children look good -->
77
+ <xsl:value-of select="text()[1]"/>
78
+ <xsl:comment> Reference to containing ancestor comes from PreTeXt context </xsl:comment>
79
+ <xsl:value-of select="text()[1]"/>
80
+ <xsl:comment> Serial number is from document-wide count of PreFigure diagrams </xsl:comment>
81
+ <xsl:value-of select="text()[1]"/>
82
+ <xsl:element name="caption" namespace="https://prefigure.org">
83
+ <!-- pf:diagram, pf:prefigure, and "image" all lack meaningful -->
84
+ <!-- numbers, so start searching for a [location with a number] -->
85
+ <!-- from the parent of the "image" -->
86
+ <xsl:apply-templates select="parent::pf:prefigure/parent::image/parent::*" mode="prefigure-container"/>
87
+ <!-- previous template supplies a space, if it provides a type/number pair -->
88
+ <!-- Serial number, just document-wide for pf:prefigure -->
89
+ <!-- NB: implement this as part of the overall numbering -->
90
+ <!-- scheme, so it comes through as an attribute. -->
91
+ <xsl:text>(</xsl:text>
92
+ <!-- pf:diagram is current context, no danger that an empty "pretext" -->
93
+ <!-- generator will be mistakenly used for the @from pattern -->
94
+ <xsl:number count="pf:prefigure" from="pretext" level="any"/>
95
+ <xsl:text>)</xsl:text>
96
+ </xsl:element>
97
+ <!-- xerox remaining elements -->
98
+ <xsl:apply-templates select="node()" mode="prefigure-edit"/>
99
+ </xsl:copy>
100
+ </xsl:template>
101
+
102
+ <!-- Recurse up the tree, looking for the first element with a -->
103
+ <!-- non-empty number. Produce type-name and a serial number. -->
104
+ <xsl:template match="*" mode="prefigure-container">
105
+ <!-- Will test on non-empty number strings. This can be -->
106
+ <!-- fooled by elements with un-implemented numbers such -->
107
+ <!-- as a pure container like a "sidebyside". -->
108
+ <xsl:variable name="the-number">
109
+ <xsl:apply-templates select="." mode="number"/>
110
+ </xsl:variable>
111
+
112
+ <xsl:choose>
113
+ <!-- this is the safety-valve halting condition -->
114
+ <xsl:when test="self::pretext"/>
115
+ <!-- Test here for useless containers that have better parents. -->
116
+ <!-- Examples might be a "case" in a "proof" or a "task" in an -->
117
+ <!-- "exercise" or an "li" in an "ol". -->
118
+ <!-- Then recurse with the parent, as below. -->
119
+ <xsl:when test="not($the-number = '')">
120
+ <xsl:apply-templates select="." mode="type-name" />
121
+ <xsl:text> </xsl:text>
122
+ <xsl:value-of select="$the-number"/>
123
+ <!-- will always follow with a serial number, -->
124
+ <!-- so add a space here, since conditional -->
125
+ <xsl:text> </xsl:text>
126
+ <!-- mission accomplished, no more recursion -->
127
+ </xsl:when>
128
+ <xsl:otherwise>
129
+ <!-- step-up (recurse) to the parent -->
130
+ <xsl:apply-templates select="parent::*" mode="prefigure-container"/>
131
+ </xsl:otherwise>
132
+ </xsl:choose>
133
+ </xsl:template>
134
+
135
+ <!-- PreFigure publication file -->
136
+ <!-- We need a one-off generation of a PreFigure publication -->
137
+ <!-- file, dumped in the same directory as the extracted source -->
138
+ <!-- diagrams. So we match the *only* guaranteed node and let -->
139
+ <!-- it do its thing, and then create the necessary file. -->
140
+ <xsl:template match="/">
141
+ <xsl:apply-imports/>
142
+ <exsl:document href="pf_publication.xml" method="xml">
143
+ <xsl:element name="prefigure" namespace="https://prefigure.org">
144
+ <!-- No "prefigure-preamble" => nothing produced -->
145
+ <xsl:copy-of select="$docinfo/pf:prefigure-preamble/*"/>
146
+ <!-- $latex-macros is never empty (<, >, &) so always a "macros" -->
147
+ <xsl:element name="macros" namespace="https://prefigure.org">
148
+ <!-- move to a new line for minimal readability -->
149
+ <xsl:text>&#xa;</xsl:text>
150
+ <!-- global variable in -common, includes \lt, \gt, \amp -->
151
+ <xsl:value-of select="$latex-macros"/>
152
+ </xsl:element>
153
+ </xsl:element>
154
+ </exsl:document>
155
+ </xsl:template>
156
+
157
+ </xsl:stylesheet>
@@ -1,100 +1,100 @@
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 extracts URL information for audio, video, -->
23
- <!-- and interactive elements. For each, it writes a sidecar -->
24
- <!-- XML file (via exsl:document) containing a standalone URL -->
25
- <!-- and an in-context URL, used later for QR code generation -->
26
- <!-- (Python) and for links in static representations -->
27
- <!-- (pretext-assembly.xsl). -->
28
- <!-- -->
29
- <!-- It is hard to get a link into chunked HTML while actually -->
30
- <!-- building generic PreTeXt for a static representation. The -->
31
- <!-- chunking level and file extension are format-specific, but -->
32
- <!-- assembly must remain format-neutral. So we set HTML- -->
33
- <!-- specific variables ($chunk-level, $file-extension) here in -->
34
- <!-- the extraction stylesheet, which has the highest import -->
35
- <!-- precedence. Assembly then reads the pre-computed URLs from -->
36
- <!-- the sidecar files rather than computing them itself. -->
37
-
38
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
39
- xmlns:xml="http://www.w3.org/XML/1998/namespace"
40
- xmlns:exsl="http://exslt.org/common"
41
- xmlns:str="http://exslt.org/strings"
42
- xmlns:pi="http://pretextbook.org/2020/pretext/internal"
43
- extension-element-prefixes="exsl"
44
- >
45
-
46
- <!-- Get internal ID's for filenames, etc -->
47
- <!-- Standard conversion groundwork -->
48
- <xsl:import href="./publisher-variables.xsl"/>
49
- <xsl:import href="./pretext-assembly.xsl"/>
50
- <xsl:import href="./pretext-common.xsl"/>
51
-
52
- <!-- Get a "subtree" xml:id value -->
53
- <!-- Then walk the XML source tree -->
54
- <!-- applying specializations below -->
55
- <xsl:import href="./extract-identity.xsl" />
56
-
57
- <xsl:output method="text" encoding="UTF-8"/>
58
-
59
- <!-- Avoid Catch-22: default assembly/pre-processor provides output -->
60
- <!-- for a conversion to a static format, but that format will -->
61
- <!-- *replace* "audio", "video", "interactive" by a static version -->
62
- <!-- (a "sidebyside") and it will not be available for extraction. -->
63
- <xsl:variable name="exercise-style" select="'dynamic'"/>
64
-
65
- <!-- In "normal" circumstances, this variable is -->
66
- <!-- set to "false()", but when employing this -->
67
- <!-- specialized stylesheet, we override to "true" -->
68
- <xsl:variable name="b-extracting-qrcode" select="true()"/>
69
-
70
- <!-- Set HTML-specific variables so that "containing-filename" -->
71
- <!-- (used by "context-url") produces correct HTML filenames. -->
72
- <!-- These override the abstract defaults in pretext-common.xsl -->
73
- <!-- by virtue of this stylesheet's higher import precedence. -->
74
- <xsl:variable name="chunk-level" select="$html-chunk-level"/>
75
- <xsl:variable name="file-extension" select="'.html'"/>
76
-
77
- <xsl:template match="audio[@source|@href]|video[@source|@href|@youtube|@youtubeplaylist|@vimeo]|interactive" mode="extraction">
78
- <!-- Sidecar XML file with pre-computed URLs for use -->
79
- <!-- by pretext-assembly.xsl when building static -->
80
- <!-- representations, and by the Python script when -->
81
- <!-- generating QR code images. -->
82
- <xsl:variable name="the-id">
83
- <xsl:apply-templates select="." mode="visible-id"/>
84
- </xsl:variable>
85
- <exsl:document href="{$the-id}-url.xml" method="xml">
86
- <pi:qrcode-urls>
87
- <pi:standalone-url>
88
- <xsl:apply-templates select="." mode="static-url"/>
89
- </pi:standalone-url>
90
- <pi:context-url>
91
- <xsl:apply-templates select="." mode="context-url"/>
92
- </pi:context-url>
93
- <pi:embed-iframe-url>
94
- <xsl:apply-templates select="." mode="embed-iframe-url"/>
95
- </pi:embed-iframe-url>
96
- </pi:qrcode-urls>
97
- </exsl:document>
98
- </xsl:template>
99
-
100
- </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 extracts URL information for audio, video, -->
23
+ <!-- and interactive elements. For each, it writes a sidecar -->
24
+ <!-- XML file (via exsl:document) containing a standalone URL -->
25
+ <!-- and an in-context URL, used later for QR code generation -->
26
+ <!-- (Python) and for links in static representations -->
27
+ <!-- (pretext-assembly.xsl). -->
28
+ <!-- -->
29
+ <!-- It is hard to get a link into chunked HTML while actually -->
30
+ <!-- building generic PreTeXt for a static representation. The -->
31
+ <!-- chunking level and file extension are format-specific, but -->
32
+ <!-- assembly must remain format-neutral. So we set HTML- -->
33
+ <!-- specific variables ($chunk-level, $file-extension) here in -->
34
+ <!-- the extraction stylesheet, which has the highest import -->
35
+ <!-- precedence. Assembly then reads the pre-computed URLs from -->
36
+ <!-- the sidecar files rather than computing them itself. -->
37
+
38
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
39
+ xmlns:xml="http://www.w3.org/XML/1998/namespace"
40
+ xmlns:exsl="http://exslt.org/common"
41
+ xmlns:str="http://exslt.org/strings"
42
+ xmlns:pi="http://pretextbook.org/2020/pretext/internal"
43
+ extension-element-prefixes="exsl"
44
+ >
45
+
46
+ <!-- Get internal ID's for filenames, etc -->
47
+ <!-- Standard conversion groundwork -->
48
+ <xsl:import href="./publisher-variables.xsl"/>
49
+ <xsl:import href="./pretext-assembly.xsl"/>
50
+ <xsl:import href="./pretext-common.xsl"/>
51
+
52
+ <!-- Get a "subtree" xml:id value -->
53
+ <!-- Then walk the XML source tree -->
54
+ <!-- applying specializations below -->
55
+ <xsl:import href="./extract-identity.xsl" />
56
+
57
+ <xsl:output method="text" encoding="UTF-8"/>
58
+
59
+ <!-- Avoid Catch-22: default assembly/pre-processor provides output -->
60
+ <!-- for a conversion to a static format, but that format will -->
61
+ <!-- *replace* "audio", "video", "interactive" by a static version -->
62
+ <!-- (a "sidebyside") and it will not be available for extraction. -->
63
+ <xsl:variable name="exercise-style" select="'dynamic'"/>
64
+
65
+ <!-- In "normal" circumstances, this variable is -->
66
+ <!-- set to "false()", but when employing this -->
67
+ <!-- specialized stylesheet, we override to "true" -->
68
+ <xsl:variable name="b-extracting-qrcode" select="true()"/>
69
+
70
+ <!-- Set HTML-specific variables so that "containing-filename" -->
71
+ <!-- (used by "context-url") produces correct HTML filenames. -->
72
+ <!-- These override the abstract defaults in pretext-common.xsl -->
73
+ <!-- by virtue of this stylesheet's higher import precedence. -->
74
+ <xsl:variable name="chunk-level" select="$html-chunk-level"/>
75
+ <xsl:variable name="file-extension" select="'.html'"/>
76
+
77
+ <xsl:template match="audio[@source|@href]|video[@source|@href|@youtube|@youtubeplaylist|@vimeo]|interactive" mode="extraction">
78
+ <!-- Sidecar XML file with pre-computed URLs for use -->
79
+ <!-- by pretext-assembly.xsl when building static -->
80
+ <!-- representations, and by the Python script when -->
81
+ <!-- generating QR code images. -->
82
+ <xsl:variable name="the-id">
83
+ <xsl:apply-templates select="." mode="visible-id"/>
84
+ </xsl:variable>
85
+ <exsl:document href="{$the-id}-url.xml" method="xml">
86
+ <pi:qrcode-urls>
87
+ <pi:standalone-url>
88
+ <xsl:apply-templates select="." mode="static-url"/>
89
+ </pi:standalone-url>
90
+ <pi:context-url>
91
+ <xsl:apply-templates select="." mode="context-url"/>
92
+ </pi:context-url>
93
+ <pi:embed-iframe-url>
94
+ <xsl:apply-templates select="." mode="embed-iframe-url"/>
95
+ </pi:embed-iframe-url>
96
+ </pi:qrcode-urls>
97
+ </exsl:document>
98
+ </xsl:template>
99
+
100
+ </xsl:stylesheet>