@pretextbook/pretext-html 0.1.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.
Files changed (110) hide show
  1. package/README.md +160 -0
  2. package/assets/preview-html.xsl +230 -0
  3. package/assets/upstream.json +7 -0
  4. package/assets/xsl/README.md +31 -0
  5. package/assets/xsl/entities.ent +154 -0
  6. package/assets/xsl/extract-asymptote.xsl +68 -0
  7. package/assets/xsl/extract-biblio-csl.xsl +327 -0
  8. package/assets/xsl/extract-datafile.xsl +71 -0
  9. package/assets/xsl/extract-dynamic.xsl +139 -0
  10. package/assets/xsl/extract-identity.xsl +136 -0
  11. package/assets/xsl/extract-interactive.xsl +81 -0
  12. package/assets/xsl/extract-latex-image.xsl +118 -0
  13. package/assets/xsl/extract-mermaid.xsl +58 -0
  14. package/assets/xsl/extract-mom.xsl +63 -0
  15. package/assets/xsl/extract-pg.xsl +2897 -0
  16. package/assets/xsl/extract-prefigure.xsl +157 -0
  17. package/assets/xsl/extract-qrcode.xsl +100 -0
  18. package/assets/xsl/extract-runestone-page-template.xsl +139 -0
  19. package/assets/xsl/extract-sageplot.xsl +166 -0
  20. package/assets/xsl/extract-stack.xsl +56 -0
  21. package/assets/xsl/extract-trace.xsl +134 -0
  22. package/assets/xsl/extract-youtube.xsl +63 -0
  23. package/assets/xsl/html-symbols.xsl +3344 -0
  24. package/assets/xsl/latex/pretext-latex-AIM.xsl +56 -0
  25. package/assets/xsl/latex/pretext-latex-CLP.xsl +148 -0
  26. package/assets/xsl/latex/pretext-latex-chaos.xsl +317 -0
  27. package/assets/xsl/latex/pretext-latex-dyslexic-font.xsl +76 -0
  28. package/assets/xsl/latex/pretext-latex-guide.xsl +104 -0
  29. package/assets/xsl/latex/pretext-latex-texstyle.xsl +862 -0
  30. package/assets/xsl/localizations/README.md +56 -0
  31. package/assets/xsl/localizations/af-ZA.xml +276 -0
  32. package/assets/xsl/localizations/bg-BG.xml +276 -0
  33. package/assets/xsl/localizations/ca-ES.xml +285 -0
  34. package/assets/xsl/localizations/cs-CZ.xml +280 -0
  35. package/assets/xsl/localizations/de-DE.xml +281 -0
  36. package/assets/xsl/localizations/en-US.xml +427 -0
  37. package/assets/xsl/localizations/es-ES.xml +287 -0
  38. package/assets/xsl/localizations/fi-FI.xml +275 -0
  39. package/assets/xsl/localizations/fr-CA.xml +276 -0
  40. package/assets/xsl/localizations/fr-FR.xml +280 -0
  41. package/assets/xsl/localizations/hu-HU.xml +280 -0
  42. package/assets/xsl/localizations/it-IT.xml +276 -0
  43. package/assets/xsl/localizations/ku-CKB.xml +275 -0
  44. package/assets/xsl/localizations/localizations.xml +48 -0
  45. package/assets/xsl/localizations/nl-NL.xml +275 -0
  46. package/assets/xsl/localizations/pt-BR.xml +288 -0
  47. package/assets/xsl/localizations/pt-PT.xml +292 -0
  48. package/assets/xsl/localizations/zh-HANS.xml +269 -0
  49. package/assets/xsl/pretext-assembly.xsl +4795 -0
  50. package/assets/xsl/pretext-basic-html.xsl +86 -0
  51. package/assets/xsl/pretext-beamer.xsl +662 -0
  52. package/assets/xsl/pretext-braille-preprint.xsl +2249 -0
  53. package/assets/xsl/pretext-common.xsl +12018 -0
  54. package/assets/xsl/pretext-dynamic.xsl +65 -0
  55. package/assets/xsl/pretext-epub.xsl +1483 -0
  56. package/assets/xsl/pretext-fo.xsl +4593 -0
  57. package/assets/xsl/pretext-html.xsl +14791 -0
  58. package/assets/xsl/pretext-json-manifest.xsl +150 -0
  59. package/assets/xsl/pretext-jupyter.xsl +868 -0
  60. package/assets/xsl/pretext-latex-classic.xsl +952 -0
  61. package/assets/xsl/pretext-latex-common.xsl +11563 -0
  62. package/assets/xsl/pretext-latex.xsl +47 -0
  63. package/assets/xsl/pretext-litprog.xsl +105 -0
  64. package/assets/xsl/pretext-merge.xsl +41 -0
  65. package/assets/xsl/pretext-numbers.xsl +875 -0
  66. package/assets/xsl/pretext-revealjs.xsl +522 -0
  67. package/assets/xsl/pretext-runestone-fitb.xsl +1233 -0
  68. package/assets/xsl/pretext-runestone-static.xsl +1438 -0
  69. package/assets/xsl/pretext-runestone.xsl +3083 -0
  70. package/assets/xsl/pretext-sage-doctest.xsl +289 -0
  71. package/assets/xsl/pretext-smc.xsl +492 -0
  72. package/assets/xsl/pretext-solution-manual-latex.xsl +323 -0
  73. package/assets/xsl/pretext-text-utilities.xsl +1217 -0
  74. package/assets/xsl/pretext-text.xsl +392 -0
  75. package/assets/xsl/pretext-units.xsl +195 -0
  76. package/assets/xsl/pretext-view-source.xsl +157 -0
  77. package/assets/xsl/pretext-ww-problem-sets.xsl +391 -0
  78. package/assets/xsl/publisher-variables.xsl +4756 -0
  79. package/assets/xsl/support/README.md +22 -0
  80. package/assets/xsl/support/extract-math.xsl +256 -0
  81. package/assets/xsl/support/package-math.xsl +141 -0
  82. package/assets/xsl/support/play-button/README.md +46 -0
  83. package/assets/xsl/support/play-button/play-button.png +0 -0
  84. package/assets/xsl/support/play-button/play-button.svg +3 -0
  85. package/assets/xsl/support/pretext-pg-macros.xsl +110 -0
  86. package/assets/xsl/support/webpack_static_imports.xml +14 -0
  87. package/assets/xsl/tests/README.md +24 -0
  88. package/assets/xsl/tests/null.xml +4 -0
  89. package/assets/xsl/tests/pretext-text-utilities-test.xsl +334 -0
  90. package/assets/xsl/utilities/README.md +31 -0
  91. package/assets/xsl/utilities/author-report.xsl +107 -0
  92. package/assets/xsl/utilities/deprecate-autoname.sed +18 -0
  93. package/assets/xsl/utilities/deprecate-index.sed +33 -0
  94. package/assets/xsl/utilities/fix-deprecations.xsl +663 -0
  95. package/assets/xsl/utilities/pretext-enhanced-source.xsl +112 -0
  96. package/assets/xsl/utilities/report-publisher-variables.xsl +162 -0
  97. package/assets/xsl/xml-to-json.xsl +326 -0
  98. package/assets/xsl/xml-to-string.xsl +328 -0
  99. package/cli.mjs +29 -0
  100. package/dist/cli-C6tfAVvi.js +553 -0
  101. package/dist/cli.d.ts +10 -0
  102. package/dist/cli.js +7 -0
  103. package/dist/index.d.ts +6 -0
  104. package/dist/index.js +10 -0
  105. package/dist/mounts.d.ts +23 -0
  106. package/dist/publication.d.ts +16 -0
  107. package/dist/renderer.d.ts +84 -0
  108. package/dist/sourcemap.d.ts +41 -0
  109. package/dist/xinclude.d.ts +45 -0
  110. package/package.json +52 -0
@@ -0,0 +1,136 @@
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 does nothing but traverse the tree -->
23
+ <!-- Possibly restricting to a subtree based on xml:id -->
24
+ <!-- An importing stylesheet can concentrate on a specific task -->
25
+
26
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
27
+
28
+ <xsl:import href="./publisher-variables.xsl" />
29
+ <xsl:import href="./pretext-assembly.xsl" />
30
+
31
+ <!-- We do not specify an output method since nothing gets output from here -->
32
+
33
+ <!-- This template provides several related templates. -->
34
+ <!-- See further notes prior to each one. -->
35
+ <!-- -->
36
+ <!-- 1. It provides an entry template. -->
37
+ <!-- -->
38
+ <!-- At the document root (after assembly) or at the root of some subtree -->
39
+ <!-- passed in and indicated by an xml:id for that root. So a stylesheet -->
40
+ <!-- that uses this stylesheet must import this utility stylesheet *last* -->
41
+ <!-- so that any entry template of some conversion is overridden. -->
42
+ <!-- -->
43
+ <!-- -->
44
+ <!-- 2. It establishes a tree walker with mode "extraction". -->
45
+ <!-- -->
46
+ <!-- The modal template here walks the tree and does *nothing* at each -->
47
+ <!-- node, but descend into children and attributes. So a consuming -->
48
+ <!-- stylesheet can provide its own "extraction" templates to interrupt -->
49
+ <!-- this giant no-op and do something interesting. Note that this modal -->
50
+ <!-- template allows plain/generic templates from established conversions -->
51
+ <!-- to be employed, and conceivably overridden, without disturbing the -->
52
+ <!-- tree walk. -->
53
+ <!-- -->
54
+ <!-- -->
55
+ <!-- 3. A template provides for one-time lead-in/lead-out material -->
56
+ <!-- General an "extraction" will make a list of similar items. But -->
57
+ <!-- there may need to be header/footer material, or some sort of -->
58
+ <!-- overall enclosure of the list. This template can be implemented -->
59
+ <!-- to accomplish that. -->
60
+
61
+ <!-- 2020-05-19: This general-purpose template formerly obtained a -->
62
+ <!-- "scratch directory" where intermediate results might be processed. -->
63
+ <!-- But if a pathname, in Windows syntax, was passed in, then the -->
64
+ <!-- slashes all got butchered. Better to set a working directory -->
65
+ <!-- and have "extracttion" worksheets write files, sans paths, into -->
66
+ <!-- that directory. We leave a warning behind if there is an attempt -->
67
+ <!-- to set this, which will likely be something overlooked in a -->
68
+ <!-- calling script. -->
69
+ <xsl:param name="scratch" select="''"/>
70
+
71
+ <!-- The xml:id of an element to use as the root -->
72
+ <!-- no "subtree" stringparam denotes starting at document root -->
73
+ <xsl:param name="subtree" select="''" />
74
+
75
+ <!-- Entry template, allows restriction to a subtree rooted at an element -->
76
+ <!-- identified by an author-supplied xml:id. This template is not meant -->
77
+ <!-- to be overridden by an importing stylesheet, though it can be with a -->
78
+ <!-- use of "xsl:apply-imports". Instead it is meant to be the entry -->
79
+ <!-- template for an importing stylesheet, which will usually mean it -->
80
+ <!-- should be imported last. It provides for careful handling of the -->
81
+ <!-- alternate subtree root. -->
82
+ <xsl:template match="/">
83
+ <!-- Fail if a scratch directory is set -->
84
+ <xsl:if test="not($scratch = '')">
85
+ <xsl:message terminate="yes">PTX:FATAL: scratch directory provided ("<xsl:value-of select="$scratch" />") which is not supported. Please report the circumstances revealing this mistake. Quitting...</xsl:message>
86
+ </xsl:if>
87
+ <xsl:choose>
88
+ <xsl:when test="$subtree=''">
89
+ <xsl:apply-templates select="$root" mode="extraction-wrapper"/>
90
+ </xsl:when>
91
+ <xsl:otherwise>
92
+ <!-- Context is root of *original* source as we are in the entry template. -->
93
+ <!-- The "for-each" allows a switch to the duplicate (assembled) source, -->
94
+ <!-- so the id() function scans the enhanced tree. -->
95
+ <xsl:for-each select="$root">
96
+ <xsl:variable name="subtree-root" select="id($subtree)"/>
97
+ <xsl:if test="not($subtree-root)">
98
+ <xsl:message terminate="yes">PTX:FATAL: xml:id provided ("<xsl:value-of select="$subtree"/>") for restriction to a subtree does not exist. Quitting...</xsl:message>
99
+ </xsl:if>
100
+ <xsl:apply-templates select="$subtree-root" mode="extraction-wrapper"/>
101
+ </xsl:for-each>
102
+ </xsl:otherwise>
103
+ </xsl:choose>
104
+ </xsl:template>
105
+
106
+ <!-- This template will always be applied with the context being the -->
107
+ <!-- "real" root, or the optional "subtree" root. See applications in -->
108
+ <!-- the entry template. The implementation here does nothing, but to -->
109
+ <!-- initiate the "extraction" walker. This can be optionally overridden -->
110
+ <!-- where the model would be: -->
111
+ <!-- -->
112
+ <!-- <xsl:template match="*" mode="extraction-wrapper"> -->
113
+ <!-- [do some header, lead-in, and/or set-up, here] -->
114
+ <!-- <xsl:apply-imports/> -->
115
+ <!-- [do some footer, lead-out, and/or wrap-up, here] -->
116
+ <!-- </xsl:template> -->
117
+ <!-- -->
118
+ <!-- See the "extract-interactive.xsl" stylesheet for a simple example. -->
119
+ <!-- Note that if the extra material needs to come from some other -->
120
+ <!-- context, the global variables $root and $document-root should be -->
121
+ <!-- available to initiate a path to some location of interest. -->
122
+ <xsl:template match="*" mode="extraction-wrapper">
123
+ <xsl:apply-templates select="." mode="extraction"/>
124
+ </xsl:template>
125
+
126
+ <!-- This template traverses the tree, from the provided root, looking -->
127
+ <!-- for something to do. As defined here, it does nothing. An importing -->
128
+ <!-- stylesheet will define this template for items of interest, providing -->
129
+ <!-- the desired results. Note that any such definition should (a) continue -->
130
+ <!-- the recursion, or (b) knowingly dead-end and not recurse further. -->
131
+ <!-- http://stackoverflow.com/questions/3776333/stripping-all-elements-except-one-in-xml-using-xslt -->
132
+ <xsl:template match="@*|node()" mode="extraction">
133
+ <xsl:apply-templates select="@*|node()" mode="extraction"/>
134
+ </xsl:template>
135
+
136
+ </xsl:stylesheet>
@@ -0,0 +1,81 @@
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 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
+ <xsl:import href="./pretext-html.xsl"/>
39
+
40
+ <!-- Get a "subtree" xml:id value -->
41
+ <!-- Then walk the XML source tree -->
42
+ <!-- applying specializations below -->
43
+ <xsl:import href="./extract-identity.xsl" />
44
+
45
+ <xsl:output method="text" encoding="UTF-8"/>
46
+
47
+ <!-- Avoid Catch-22: default assembly/pre-processor providews output -->
48
+ <!-- for a conversion to a static format, but that format will *replace* -->
49
+ <!-- "video" by a static version (a "sidebyside") and it will not be -->
50
+ <!-- available for extraction. -->
51
+ <xsl:variable name="exercise-style" select="'dynamic'"/>
52
+
53
+ <!-- @preview indicates custom image is present -->
54
+ <!-- Stylesheet output is text, with "visible-id" -->
55
+ <!-- of each interactive, one per line, to be -->
56
+ <!-- captured in a text file to guide snapshotting -->
57
+ <!-- Make the iframe and standalone page for each -->
58
+ <!-- interactive, these are two of the three steps -->
59
+ <!-- in the non-modal template for "interactive" -->
60
+ <!-- in pretext-html.xsl. Results are HTML files -->
61
+ <!-- (despite this stylesheet having text output). -->
62
+ <xsl:template match="interactive[not(@preview)]" mode="extraction">
63
+ <xsl:apply-templates select="." mode="visible-id" />
64
+ <xsl:text>&#xa;</xsl:text>
65
+ <!-- (2) Identical content, but now isolated on a reader-friendly page -->
66
+ <!-- The standalone page has its own masthead h1, so headings inside -->
67
+ <!-- start fresh at h2. Mirrors the standalone-page invocation in -->
68
+ <!-- the "interactive" template of pretext-html.xsl. -->
69
+ <xsl:apply-templates select="." mode="standalone-page" >
70
+ <xsl:with-param name="content">
71
+ <xsl:apply-templates select="." mode="interactive-core">
72
+ <xsl:with-param name="is-standalone" select="true()"/>
73
+ <xsl:with-param name="heading-level" select="2"/>
74
+ </xsl:apply-templates>
75
+ </xsl:with-param>
76
+ </xsl:apply-templates>
77
+ <!-- (3) A simple page that can be used in an iframe construction -->
78
+ <xsl:apply-templates select="." mode="create-iframe-page" />
79
+ </xsl:template>
80
+
81
+ </xsl:stylesheet>
@@ -0,0 +1,118 @@
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 <latex-image> elements -->
23
+ <!-- and wraps them for LaTeX processing -->
24
+ <!-- This includes the LaTeX macros present in docinfo -->
25
+ <!-- and the $latex-image-preamble from common. -->
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:pi="http://pretextbook.org/2020/pretext/internal"
30
+ xmlns:exsl="http://exslt.org/common"
31
+ extension-element-prefixes="pi exsl"
32
+ >
33
+
34
+ <!-- Get internal ID's for filenames, etc -->
35
+ <!-- Standard conversion groundwork -->
36
+ <xsl:import href="./publisher-variables.xsl"/>
37
+ <xsl:import href="./pretext-assembly.xsl"/>
38
+ <xsl:import href="./pretext-common.xsl"/>
39
+
40
+ <!-- We use some common code to make the actual LaTeX code used -->
41
+ <!-- for the image. The extract-identity stylesheet will override -->
42
+ <!-- the entry template, so we just access some templates as needed. -->
43
+ <xsl:import href="./pretext-latex.xsl"/>
44
+
45
+ <!-- Get a "subtree" xml:id value -->
46
+ <!-- Then walk the XML source tree -->
47
+ <!-- applying specializations below -->
48
+ <xsl:import href="./extract-identity.xsl" />
49
+
50
+ <!-- Output LaTeX as text -->
51
+ <xsl:output method="text" encoding="UTF-8"/>
52
+
53
+ <!-- LaTeX graphics to a standalone file for subsequent processing. -->
54
+ <!-- Intercept "extraction" process in extract-identity.xsl stylesheet. -->
55
+ <xsl:template match="image[latex-image]" mode="extraction">
56
+ <xsl:variable name="filebase">
57
+ <xsl:apply-templates select="latex-image" mode="image-source-basename"/>
58
+ </xsl:variable>
59
+ <!-- Do not use directories here, as Windows paths will get mangled -->
60
+ <!-- Instead, set working directory before applying stylesheet -->
61
+ <exsl:document href="{$filebase}.tex" method="text">
62
+ <xsl:text>\documentclass[</xsl:text>
63
+ <xsl:value-of select="$font-size" />
64
+ <xsl:text>]{</xsl:text>
65
+ <xsl:value-of select="$document-class-prefix" />
66
+ <xsl:text>article}&#xa;</xsl:text>
67
+ <xsl:text>\usepackage{geometry}&#xa;</xsl:text>
68
+ <!-- Determine height of text block, assumes US letterpaper (11in height) -->
69
+ <!-- Could react to document type, paper, margin specs -->
70
+ <xsl:variable name="text-height">
71
+ <xsl:text>9.0in</xsl:text>
72
+ </xsl:variable>
73
+ <!-- Bringhurst: 30x => 66 chars, so 34x => 75 chars -->
74
+ <xsl:variable name="text-width">
75
+ <xsl:value-of select="34 * substring-before($font-size, 'pt')" />
76
+ <xsl:text>pt</xsl:text>
77
+ </xsl:variable>
78
+ <!-- (These are actual TeX comments in the main document's LaTeX output) -->
79
+ <!-- Text height identically 9 inches, text width varies on point size -->
80
+ <!-- See Bringhurst 2.1.1 on measure for recommendations -->
81
+ <!-- 75 characters per line (count spaces, punctuation) is target -->
82
+ <!-- which is the upper limit of Bringhurst's recommendations -->
83
+ <xsl:text>\geometry{letterpaper,total={</xsl:text>
84
+ <xsl:value-of select="$text-width" />
85
+ <xsl:text>,</xsl:text>
86
+ <xsl:value-of select="$text-height" />
87
+ <xsl:text>}}&#xa;</xsl:text>
88
+ <xsl:text>%% Custom Page Layout Adjustments (use publisher page-geometry)&#xa;</xsl:text>
89
+ <xsl:if test="$latex-page-geometry != ''">
90
+ <xsl:text>\geometry{</xsl:text>
91
+ <xsl:value-of select="$latex-page-geometry" />
92
+ <xsl:text>}&#xa;</xsl:text>
93
+ </xsl:if>
94
+ <xsl:text>\usepackage{amsmath,amssymb}&#xa;</xsl:text>
95
+ <xsl:value-of select="$latex-image-preamble"/>
96
+ <xsl:text>\ifdefined\tikzset&#xa;</xsl:text>
97
+ <xsl:text>\tikzset{ampersand replacement = \amp}&#xa;</xsl:text>
98
+ <xsl:text>\fi&#xa;</xsl:text>
99
+ <xsl:value-of select="$latex-macros" />
100
+ <xsl:text>\begin{document}&#xa;</xsl:text>
101
+ <xsl:text>\pagestyle{empty}&#xa;</xsl:text>
102
+ <!-- The "latex-image" template is in pretext-latex.xsl -->
103
+ <xsl:variable name="the-latex-image">
104
+ <xsl:apply-templates select="latex-image"/>
105
+ </xsl:variable>
106
+ <!-- NB: this spurious box is designed to make -->
107
+ <!-- processing here match more closely what happens in -->
108
+ <!-- a PDF build, where an image is scrunched into a -->
109
+ <!-- functional resizing box of given width and -->
110
+ <!-- preserved aspect-ratio. -->
111
+ <xsl:text>\resizebox{\width}{\height}{&#xa;</xsl:text>
112
+ <xsl:value-of select="$the-latex-image"/>
113
+ <xsl:text>}&#xa;</xsl:text>
114
+ <xsl:text>\end{document}&#xa;</xsl:text>
115
+ </exsl:document>
116
+ </xsl:template>
117
+
118
+ </xsl:stylesheet>
@@ -0,0 +1,58 @@
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 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
+ <xsl:template match="mermaid" mode="extraction">
47
+ <xsl:variable name="filebase">
48
+ <xsl:apply-templates select="." mode="image-source-basename"/>
49
+ </xsl:variable>
50
+
51
+ <exsl:document href="{$filebase}.mmd" method="text">
52
+ <xsl:call-template name="sanitize-text">
53
+ <xsl:with-param name="text" select="." />
54
+ </xsl:call-template>
55
+ </exsl:document>
56
+ </xsl:template>
57
+
58
+ </xsl:stylesheet>
@@ -0,0 +1,63 @@
1
+ <?xml version='1.0'?>
2
+
3
+ <!--********************************************************************
4
+ Copyright 2018 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
+ extension-element-prefixes="exsl"
30
+ >
31
+
32
+ <!-- Get internal ID's for filenames, etc -->
33
+ <!-- Standard conversion groundwork -->
34
+ <xsl:import href="./publisher-variables.xsl"/>
35
+ <xsl:import href="./pretext-assembly.xsl"/>
36
+ <xsl:import href="./pretext-common.xsl"/>
37
+
38
+ <!-- Get a "subtree" xml:id value -->
39
+ <!-- Then walk the XML source tree -->
40
+ <!-- applying specializations below -->
41
+ <xsl:import href="./extract-identity.xsl" />
42
+
43
+ <xsl:output method="text" encoding="UTF-8"/>
44
+
45
+ <!-- We need to alert the pretext-assembly.xsl stylesheet -->
46
+ <!-- that it is being used in the very specific instance -->
47
+ <!-- of extracting these objects for processing externally, -->
48
+ <!-- with results collected in additional files, for -->
49
+ <!-- consultation/collection in a more general use of this -->
50
+ <!-- stylesheet for the purpose of actually building a useful -->
51
+ <!-- output format. This variable declaration here overrides -->
52
+ <!-- the default setting of "false" in pretext-assembly.xsl. -->
53
+ <!-- Look there for a more comprehensive discussion of the -->
54
+ <!-- necessity of this scheme. -->
55
+ <xsl:variable name="b-extracting-mom" select="true()"/>
56
+
57
+ <!-- One problem id per line -->
58
+ <xsl:template match="myopenmath[@problem]" mode="extraction">
59
+ <xsl:value-of select="@problem" />
60
+ <xsl:text>&#xa;</xsl:text>
61
+ </xsl:template>
62
+
63
+ </xsl:stylesheet>