@pretextbook/pretext-html 0.3.0 → 0.4.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 (43) hide show
  1. package/README.md +20 -9
  2. package/assets/preview-html.xsl +8 -4
  3. package/assets/upstream.json +1 -1
  4. package/assets/xsl/README.md +25 -24
  5. package/assets/xsl/entities.ent +20 -0
  6. package/assets/xsl/extract-biblio-csl.xsl +1 -1
  7. package/assets/xsl/extract-pg.xsl +111 -297
  8. package/assets/xsl/extract-qrcode.xsl +11 -1
  9. package/assets/xsl/extract-sageplot.xsl +1 -1
  10. package/assets/xsl/latex/pretext-latex-texstyle.xsl +1 -2
  11. package/assets/xsl/localizations/README.md +24 -24
  12. package/assets/xsl/pretext-assembly.xsl +101 -11
  13. package/assets/xsl/pretext-beamer.xsl +43 -146
  14. package/assets/xsl/pretext-braille-preprint.xsl +457 -201
  15. package/assets/xsl/pretext-common.xsl +388 -423
  16. package/assets/xsl/pretext-epub.xsl +301 -72
  17. package/assets/xsl/pretext-fo.xsl +70 -86
  18. package/assets/xsl/pretext-html.xsl +331 -259
  19. package/assets/xsl/pretext-jupyter.xsl +534 -322
  20. package/assets/xsl/pretext-latex-classic.xsl +14 -15
  21. package/assets/xsl/pretext-latex-common.xsl +385 -2389
  22. package/assets/xsl/pretext-latex.xsl +1995 -5
  23. package/assets/xsl/pretext-markdown.xsl +919 -0
  24. package/assets/xsl/pretext-numbers.xsl +22 -4
  25. package/assets/xsl/pretext-revealjs.xsl +241 -33
  26. package/assets/xsl/pretext-runestone-fitb.xsl +20 -22
  27. package/assets/xsl/pretext-runestone.xsl +3 -3
  28. package/assets/xsl/pretext-sage-doctest.xsl +2 -2
  29. package/assets/xsl/pretext-text-utilities.xsl +69 -1
  30. package/assets/xsl/pretext-text.xsl +1077 -107
  31. package/assets/xsl/publisher-variables.xsl +396 -452
  32. package/assets/xsl/support/play-button/README.md +1 -3
  33. package/assets/xsl/tests/README.md +1 -1
  34. package/assets/xsl/utilities/README.md +6 -8
  35. package/assets/xsl/utilities/report-publisher-variables.xsl +15 -0
  36. package/assets/xsl-bundle.json +1 -1
  37. package/dist/{cli-CzoinNle.js → cli-Cp6C0sif.js} +220 -205
  38. package/dist/cli.js +1 -1
  39. package/dist/index.browser.js +351 -342
  40. package/dist/index.js +1 -1
  41. package/dist/publication.d.ts +9 -1
  42. package/dist/renderer.d.ts +20 -0
  43. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { d as r, f as i, a as t, i as a, r as l, m as o, s as m, b as n, x as d } from "./cli-CzoinNle.js";
1
+ import { d as r, f as i, a as t, i as a, r as l, m as o, s as m, b as n, x as d } from "./cli-Cp6C0sif.js";
2
2
  import { describeAsset as c, missingAssetPlaceholder as f, missingAssetSvg as g, rewriteAssetUrls as A } from "./assets.js";
3
3
  import { PREVIEW_THEME_MESSAGE as h, injectThemeBridge as S, isPreviewTheme as b, previewThemeMessage as u, themeBridgeScript as x } from "./theme.js";
4
4
  export {
@@ -8,12 +8,20 @@
8
8
  * variables can only come from a publication file — there is no stringparam
9
9
  * for `portable` — so we rewrite the user's publication file (or synthesize a
10
10
  * minimal one) and serve it through the fetch shim as a virtual file.
11
+ *
12
+ * That rewrite is also how an embedder's default HTML theme gets in
13
+ * (`<html><css theme="..."/></html>`): same reason, no stringparam for it
14
+ * either, short of `debug.html.theme-name`.
11
15
  */
12
16
  /**
13
17
  * Return publication-file XML with `<html><platform portable="yes"/></html>`
14
18
  * forced, preserving everything else from `publicationXml` when given.
19
+ *
20
+ * `cssTheme`, when given, supplies `<html><css theme="..."/></html>` for
21
+ * projects that do not choose an HTML theme themselves; see
22
+ * `RenderOptions.cssTheme`. A blank value is ignored.
15
23
  */
16
- export declare function forcePortablePublication(publicationXml?: string): string;
24
+ export declare function forcePortablePublication(publicationXml?: string, cssTheme?: string): string;
17
25
  /**
18
26
  * Where a project's images live, as declared by
19
27
  * `<source><directories external generated/></source>`.
@@ -35,6 +35,26 @@ export interface RenderOptions {
35
35
  * `<html><platform portable="yes"/></html>`, which the preview forces.
36
36
  */
37
37
  publicationPath?: string;
38
+ /**
39
+ * PreTeXt HTML theme to fall back on, inserted into the publication file
40
+ * used for the build as `<html><css theme="..."/></html>`.
41
+ *
42
+ * A default, not an override: it applies only when the project's own
43
+ * publication file names no theme (neither `@theme` nor the deprecated
44
+ * `@style`/`@shell`), so a project that has chosen one keeps it. Blank is
45
+ * ignored, and with no publication file at all it themes the synthesized
46
+ * minimal one.
47
+ *
48
+ * Portable builds load `theme-<name>.min.css` from the CDN, so an
49
+ * unrecognised name renders an unstyled page. The themes the vendored
50
+ * stylesheets know are default-modern (PreTeXt's own default), denver,
51
+ * tacoma, salem, greeley and boulder; `custom` additionally needs a locally
52
+ * compiled stylesheet, which this renderer cannot produce.
53
+ *
54
+ * Distinct from {@link RenderOptions.theme}, which is the light/dark mode
55
+ * *within* whichever css theme is in force.
56
+ */
57
+ cssTheme?: string;
38
58
  /** Additional XSLT string parameters, passed as strings (quoted for you). */
39
59
  stringParams?: Record<string, string>;
40
60
  /** Directory of PreTeXt XSL stylesheets. Defaults to the vendored copy. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pretextbook/pretext-html",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Convert PreTeXt documents to HTML in pure JavaScript using the official PreTeXt XSLT stylesheets via libxslt-wasm. No Python or PreTeXt installation required.",
5
5
  "author": "Oscar Levin",
6
6
  "license": "MIT",