@pretextbook/pretext-html 0.3.0 → 0.5.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 (58) hide show
  1. package/README.md +106 -10
  2. package/assets/preview-html.xsl +8 -4
  3. package/assets/preview-revealjs.xsl +85 -0
  4. package/assets/upstream.json +1 -1
  5. package/assets/xsl/LICENSE-pretext +16 -0
  6. package/assets/xsl/README.md +25 -24
  7. package/assets/xsl/entities.ent +27 -0
  8. package/assets/xsl/extract-biblio-csl.xsl +6 -4
  9. package/assets/xsl/extract-dynamic.xsl +14 -12
  10. package/assets/xsl/extract-interactive.xsl +2 -2
  11. package/assets/xsl/extract-pg.xsl +123 -306
  12. package/assets/xsl/extract-qrcode.xsl +12 -2
  13. package/assets/xsl/extract-sageplot.xsl +1 -1
  14. package/assets/xsl/extract-trace.xsl +3 -3
  15. package/assets/xsl/extract-youtube.xsl +1 -1
  16. package/assets/xsl/latex/pretext-latex-texstyle.xsl +4 -5
  17. package/assets/xsl/localizations/README.md +24 -24
  18. package/assets/xsl/pretext-assembly.xsl +463 -368
  19. package/assets/xsl/pretext-beamer.xsl +43 -146
  20. package/assets/xsl/pretext-braille-preprint.xsl +458 -202
  21. package/assets/xsl/pretext-common.xsl +486 -510
  22. package/assets/xsl/pretext-epub.xsl +318 -78
  23. package/assets/xsl/pretext-fo.xsl +80 -96
  24. package/assets/xsl/pretext-html.xsl +413 -318
  25. package/assets/xsl/pretext-jupyter.xsl +534 -322
  26. package/assets/xsl/pretext-latex-classic.xsl +14 -15
  27. package/assets/xsl/pretext-latex-common.xsl +393 -2397
  28. package/assets/xsl/pretext-latex.xsl +1995 -5
  29. package/assets/xsl/pretext-markdown.xsl +919 -0
  30. package/assets/xsl/pretext-numbers.xsl +57 -39
  31. package/assets/xsl/pretext-revealjs.xsl +241 -33
  32. package/assets/xsl/pretext-runestone-fitb.xsl +34 -35
  33. package/assets/xsl/pretext-runestone-static.xsl +17 -17
  34. package/assets/xsl/pretext-runestone.xsl +36 -34
  35. package/assets/xsl/pretext-sage-doctest.xsl +2 -2
  36. package/assets/xsl/pretext-text-utilities.xsl +69 -1
  37. package/assets/xsl/pretext-text.xsl +1077 -107
  38. package/assets/xsl/pretext-view-source.xsl +5 -3
  39. package/assets/xsl/pretext-ww-problem-sets.xsl +6 -1
  40. package/assets/xsl/publisher-variables.xsl +397 -477
  41. package/assets/xsl/support/play-button/README.md +1 -3
  42. package/assets/xsl/tests/README.md +1 -1
  43. package/assets/xsl/utilities/README.md +6 -8
  44. package/assets/xsl/utilities/report-publisher-variables.xsl +15 -0
  45. package/assets/xsl-bundle.json +1 -1
  46. package/dist/cli-DZsyZERX.js +694 -0
  47. package/dist/cli.js +1 -1
  48. package/dist/index.browser.d.ts +5 -0
  49. package/dist/index.browser.js +499 -344
  50. package/dist/index.d.ts +5 -0
  51. package/dist/index.js +23 -18
  52. package/dist/publication.d.ts +26 -12
  53. package/dist/renderer.d.ts +68 -0
  54. package/dist/reveal.d.ts +77 -0
  55. package/dist/reveal.js +110 -0
  56. package/dist/target.d.ts +34 -0
  57. package/package.json +12 -1
  58. package/dist/cli-CzoinNle.js +0 -639
@@ -54,7 +54,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
54
54
  <!-- applying specializations below -->
55
55
  <xsl:import href="./extract-identity.xsl" />
56
56
 
57
- <xsl:output method="text" encoding="UTF-8"/>
57
+ <xsl:output method="xml" encoding="UTF-8"/>
58
58
 
59
59
  <!-- Avoid Catch-22: default assembly/pre-processor provides output -->
60
60
  <!-- for a conversion to a static format, but that format will -->
@@ -74,13 +74,21 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
74
74
  <xsl:variable name="chunk-level" select="$html-chunk-level"/>
75
75
  <xsl:variable name="file-extension" select="'.html'"/>
76
76
 
77
+ <!-- Wrap the ids below in a manifest of exactly the elements that -->
78
+ <!-- earn a QR code; the generator opens only these sidecar files. -->
79
+ <xsl:template match="*" mode="extraction-wrapper">
80
+ <pi:qrcodes>
81
+ <xsl:apply-imports/>
82
+ </pi:qrcodes>
83
+ </xsl:template>
84
+
77
85
  <xsl:template match="audio[@source|@href]|video[@source|@href|@youtube|@youtubeplaylist|@vimeo]|interactive" mode="extraction">
78
86
  <!-- Sidecar XML file with pre-computed URLs for use -->
79
87
  <!-- by pretext-assembly.xsl when building static -->
80
88
  <!-- representations, and by the Python script when -->
81
89
  <!-- generating QR code images. -->
82
90
  <xsl:variable name="the-id">
83
- <xsl:apply-templates select="." mode="visible-id"/>
91
+ <xsl:apply-templates select="." mode="unique-id"/>
84
92
  </xsl:variable>
85
93
  <exsl:document href="{$the-id}-url.xml" method="xml">
86
94
  <pi:qrcode-urls>
@@ -95,6 +103,8 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
95
103
  </pi:embed-iframe-url>
96
104
  </pi:qrcode-urls>
97
105
  </exsl:document>
106
+ <!-- record the id in the returned manifest (see the wrapper above) -->
107
+ <pi:qrcode id="{$the-id}"/>
98
108
  </xsl:template>
99
109
 
100
110
  </xsl:stylesheet>
@@ -88,7 +88,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
88
88
  <xsl:text>3d</xsl:text>
89
89
  </xsl:when>
90
90
  <xsl:otherwise>
91
- <xsl:message>PTX:ERROR: a "sageplot" has a @variant attribute ("<xsl:value-of select="@variant"/>") for "<xsl:value-of select="$filebase"/>" whose value is not "2d" nor "3d". The default ("2d") is being used, which could be incorrect</xsl:message>
91
+ <xsl:message>PTX:FALLBACK: a "sageplot" has a @variant attribute ("<xsl:value-of select="@variant"/>") for "<xsl:value-of select="$filebase"/>" whose value is not "2d" nor "3d". The default ("2d") is being used, which could be incorrect</xsl:message>
92
92
  <xsl:text>2d</xsl:text>
93
93
  </xsl:otherwise>
94
94
  </xsl:choose>
@@ -24,7 +24,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
24
24
  <!-- processed into a trace by the pretext/pretext script. -->
25
25
  <!-- It produces text output, with one line per program: -->
26
26
  <!-- -->
27
- <!-- visible-id, language, source -->
27
+ <!-- unique-id, language, source -->
28
28
 
29
29
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
30
30
  xmlns:xml="http://www.w3.org/XML/1998/namespace"
@@ -57,7 +57,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
57
57
 
58
58
  <!-- Constructs a block of text for trace output -->
59
59
  <!-- Each of the following as its own line: -->
60
- <!-- visible-id -->
60
+ <!-- unique-id -->
61
61
  <!-- runestone-id -->
62
62
  <!-- trace filename -->
63
63
  <!-- language -->
@@ -66,7 +66,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
66
66
  <!-- Followed by 1 line per checkpoint question -->
67
67
  <!-- Block ends with blank line (double newline) -->
68
68
  <xsl:template match="program[@interactive = 'codelens']" mode="extraction">
69
- <xsl:apply-templates select="." mode="visible-id"/>
69
+ <xsl:apply-templates select="." mode="unique-id"/>
70
70
  <xsl:text>&#xa;</xsl:text>
71
71
  <xsl:apply-templates select="." mode="runestone-id"/>
72
72
  <xsl:text>&#xa;</xsl:text>
@@ -56,7 +56,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
56
56
  <xsl:variable name="first-video-id" select="substring-before(concat(normalize-space(str:replace(@youtube, ',', ' ')), ' '), ' ')" />
57
57
  <xsl:value-of select="$first-video-id" />
58
58
  <xsl:text>,</xsl:text>
59
- <xsl:apply-templates select="." mode="visible-id" />
59
+ <xsl:apply-templates select="." mode="unique-id" />
60
60
  <xsl:text>&#xa;</xsl:text>
61
61
  </xsl:template>
62
62
 
@@ -210,7 +210,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
210
210
  <xsl:call-template name="math-packages"/>
211
211
  <xsl:call-template name="pdfpages-package"/>
212
212
  <xsl:call-template name="semantic-macros"/>
213
- <xsl:call-template name="exercises-and-solutions"/>
214
213
  <xsl:call-template name="chapter-start-number"/>
215
214
  <xsl:call-template name="equation-numbering"/>
216
215
  <xsl:call-template name="image-tcolorbox"/>
@@ -494,7 +493,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
494
493
  <xsl:text>{</xsl:text>
495
494
  <xsl:choose>
496
495
  <xsl:when test="@arg = 'unique-id'">
497
- <xsl:value-of select="$ptx-node/@unique-id"/>
496
+ <xsl:value-of select="$ptx-node/@pi:unique-id"/>
498
497
  </xsl:when>
499
498
  <xsl:when test="@arg = 'ordinal'">
500
499
  <xsl:apply-templates select="$ptx-node" mode="texstyle-number"/>
@@ -512,7 +511,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
512
511
  <xsl:text>[</xsl:text>
513
512
  <xsl:choose>
514
513
  <xsl:when test="@opt = 'unique-id'">
515
- <xsl:value-of select="$ptx-node/@unique-id"/>
514
+ <xsl:value-of select="$ptx-node/@pi:unique-id"/>
516
515
  </xsl:when>
517
516
  <xsl:when test="@arg = 'ordinal'">
518
517
  <xsl:apply-templates select="$ptx-node" mode="texstyle-number"/>
@@ -524,7 +523,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
524
523
  <xsl:text>{</xsl:text>
525
524
  <xsl:choose>
526
525
  <xsl:when test="@arg = 'unique-id'">
527
- <xsl:value-of select="$ptx-node/@unique-id"/>
526
+ <xsl:value-of select="$ptx-node/@pi:unique-id"/>
528
527
  </xsl:when>
529
528
  <xsl:when test="@arg = 'ordinal'">
530
529
  <xsl:apply-templates select="$ptx-node" mode="texstyle-number"/>
@@ -624,7 +623,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
624
623
  </xsl:apply-templates>
625
624
  </xsl:when>
626
625
  <xsl:otherwise>
627
- <xsl:message>PTX:WARNING: The @authority attribute on a keyword element (in a texstyle file) is required and must be "author" or "msc". Found "@authority="<xsl:value-of select="@authority"/>". </xsl:message>
626
+ <xsl:message>PTX:ERROR: The @authority attribute on a keyword element (in a texstyle file) is required and must be "author" or "msc". Found "@authority="<xsl:value-of select="@authority"/>". </xsl:message>
628
627
  </xsl:otherwise>
629
628
  </xsl:choose>
630
629
  </xsl:template>
@@ -17,9 +17,10 @@ You should have received a copy of the GNU General Public License
17
17
  along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
18
18
  *********************************************************************-->
19
19
 
20
- # PreTeXt Localizations
20
+ PreTeXt Localizations
21
+ =====================
21
22
 
22
- Each file in this directory provides translations of various strings used in titles and headings (and other places) to a specific language. Filenames reflect the code for language (lowercase) and then the code for the region (uppercase). This is a requirement.
23
+ Each file in this directory provides translations of various strings used in titles and headings (and other places) to a specific language. Filenames reflect the code for language (lowercase) and then the code for the region (uppercase). This is a requirement.
23
24
 
24
25
  For each file of translations, the "language" attribute of the "locale" element used to reference the language code and the "string-id" of each "localization" element is the lookup key. Element content is the language-specific string. The English version ("en-US") is carefully documented, so additions of new languages do not necessarily require new documentation, though it could help other implementers. See `xsl/pretext-common.xsl` for the two routines which make use of this information, one is a named template and the other (largely) uses the name of an element as the string-id.
25
26
 
@@ -27,30 +28,29 @@ Some items peculiar to LaTeX are explained [here](http://www.tex.ac.uk/cgi-bin/t
27
28
 
28
29
  There is a [general overview of language tags](http://www.w3.org/International/articles/language-tags/) and the [Subtag Registry](http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry).
29
30
 
30
- Contibutions of new languages are always welcome and especially encouraged! Search on "Translation needed" to see where you can help. Use the en-US file as a template for a new language file, since it is always most complete. It is understood that certain English words and phrases have subtleties that can be very hard to capture in another language. Do your best to concoct a close approximation -- something should be better than nothing. And it might improve with additions from others later. We try to address some of this in the en-US file, so do be certain to look there for explanations of how these strings are employed. Comments about your own decisions, within the relevant language file, can be very helpful later.
31
+ Contibutions of new languages are always welcome and especially encouraged! Search on "Translation needed" to see where you can help. Use the en-US file as a template for a new language file, since it is always most complete. It is understood that certain English words and phrases have subtleties that can be very hard to capture in another language. Do your best to concoct a close approximation -- something should be better than nothing. And it might improve with additions from others later. We try to address some of this in the en-US file, so do be certain to look there for explanations of how these strings are employed. Comments about your own decisions, within the relevant language file, can be very helpful later.
31
32
 
32
- NEW LANGUAGES: for a new file to be effective, a single line needs to be added to the `xsl/localizations/localizations.xml` file. It should be obvious what to do by looking at the other lines of that file. If you create a new file, please include a "commented-out" line for any words you do not translate, and please use the **exact** style of commenting as elsewhere (one line per comment, indented). Including these, and using teh same style, greatly aids in maintenance and reliability.
33
+ NEW LANGUAGES: for a new file to be effective, a single line needs to be added to the `xsl/localizations/localizations.xml` file. It should be obvious what to do by looking at the other lines of that file. If you create a new file, please include a "commented-out" line for any words you do not translate, and please use the **exact** style of commenting as elsewhere (one line per comment, indented). Including these, and using teh same style, greatly aids in maintenance and reliability.
33
34
 
34
- Additions to incomplete files, or new files for additional languages, are very welcome and are a huge help in making PreTeXt useable for more authors. A GitHub pull request is preferable. If you do not know GitHub well, then emailing the entire language file (as an attachment) is very welcome and just as easy to deal with on our end. Please respect the order in the en-US file, it saves us time when we add new terms to each and every file. Thanks.
35
+ Additions to incomplete files, or new files for additional languages, are very welcome and are a huge help in making PreTeXt useable for more authors. A GitHub pull request is preferable. If you do not know GitHub well, then emailing the entire language file (as an attachment) is very welcome and just as easy to deal with on our end. Please respect the order in the en-US file, it saves us time when we add new terms to each and every file. Thanks.
35
36
 
36
- To test, or use: place `xml:lang="es-ES"`, or similar, as an attribute on your `<pretext>` element. `en-US` is the default if no `@xml:lang` attribute is given on the `pretext` element.
37
+ To test, or use: place `xml:lang="es-ES"`, or similar, as an attribute on your `<pretext>` element. `en-US` is the default if no `@xml:lang` attribute is given on the `pretext` element.
37
38
 
38
39
  Current (partially) implemented language codes and contributors
39
-
40
- - af-ZA, Afrikaans (South Africa), Dirk Basson
41
- - bg-BG, Bulgarian (Bulgaria), Boyko Bantchev
42
- - ca-ES, Catalan (Spain), Jordi Saludes
43
- - cs-CZ, Czech (Czechia), Jiří Lebl
44
- - de-DE, German (Germany), Karl-Dieter Crisman
45
- - es-ES, Spanish (Spain), Juan José Torrens
46
- - en-US, English (United States), Robert A. Beezer
47
- - fi-FI, Finnish (Finland), Lasse M. Manninen
48
- - fr-CA, French (Canada), Jean-Sébastien Turcotte
49
- - fr-FR, French (France), Thomas W. Judson, Julien Giol, Jean-Sébastien Turcotte
50
- - hu-HU, Hungarian (Hungary), Sándor Czirbusz
51
- - it-IT, Italian (Italy), Valerio Monti
52
- - ku-CKB, Rebin Muhammad, Kurdish (Central Kurdish)
53
- - nl-NL, Dutch (Netherlands), Gosia Wrzesinska
54
- - pt-BR, Portugese (Brazil), Igor Morgado, Vinicius Monego, Leon Silva
55
- - pt-PT, Portugese (Portugal), António Pereira
56
- - zh-HANS, Chinese Simplified (China), Hongqi Wang
40
+ * af-ZA, Afrikaans (South Africa), Dirk Basson
41
+ * bg-BG, Bulgarian (Bulgaria), Boyko Bantchev
42
+ * ca-ES, Catalan (Spain), Jordi Saludes
43
+ * cs-CZ, Czech (Czechia), Jiří Lebl
44
+ * de-DE, German (Germany), Karl-Dieter Crisman
45
+ * es-ES, Spanish (Spain), Juan José Torrens
46
+ * en-US, English (United States), Robert A. Beezer
47
+ * fi-FI, Finnish (Finland), Lasse M. Manninen
48
+ * fr-CA, French (Canada), Jean-Sébastien Turcotte
49
+ * fr-FR, French (France), Thomas W. Judson, Julien Giol, Jean-Sébastien Turcotte
50
+ * hu-HU, Hungarian (Hungary), Sándor Czirbusz
51
+ * it-IT, Italian (Italy), Valerio Monti
52
+ * ku-CKB, Rebin Muhammad, Kurdish (Central Kurdish)
53
+ * nl-NL, Dutch (Netherlands), Gosia Wrzesinska
54
+ * pt-BR, Portugese (Brazil), Igor Morgado, Vinicius Monego, Leon Silva
55
+ * pt-PT, Portugese (Portugal), António Pereira
56
+ * zh-HANS, Chinese Simplified (China), Hongqi Wang