@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,107 +1,107 @@
|
|
|
1
|
-
<?xml version='1.0'?> <!-- As XML file -->
|
|
2
|
-
|
|
3
|
-
<!--********************************************************************
|
|
4
|
-
Copyright 2018 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
|
-
<!-- http://pimpmyxslt.com/articles/entity-tricks-part2/ -->
|
|
23
|
-
<!DOCTYPE xsl:stylesheet [
|
|
24
|
-
<!ENTITY % entities SYSTEM "../entities.ent">
|
|
25
|
-
%entities;
|
|
26
|
-
]>
|
|
27
|
-
|
|
28
|
-
<!-- Identify as a stylesheet -->
|
|
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
|
-
|
|
32
|
-
<!-- NB: (2020-06-07) xref/@provisional gets replaced by placeholder -->
|
|
33
|
-
<!-- text in the "assembly" phase, so think carefully about whether -->
|
|
34
|
-
<!-- or not this stylesheet should run against orginal source or -->
|
|
35
|
-
<!-- enhanced source, they *are* different. -->
|
|
36
|
-
|
|
37
|
-
<!-- Uses "strip-leading-whitespace" and more -->
|
|
38
|
-
<!-- Standard conversion groundwork -->
|
|
39
|
-
<xsl:import href="../publisher-variables.xsl"/>
|
|
40
|
-
<xsl:import href="../pretext-assembly.xsl"/>
|
|
41
|
-
<xsl:import href="../pretext-common.xsl"/>
|
|
42
|
-
|
|
43
|
-
<!-- ASCII output intended, consistent with -common -->
|
|
44
|
-
<xsl:output method="text" />
|
|
45
|
-
|
|
46
|
-
<!-- Generally, traverse the tree, -->
|
|
47
|
-
<!-- looking for things to do -->
|
|
48
|
-
<!-- http://stackoverflow.com/questions/3776333/ -->
|
|
49
|
-
<!-- stripping-all-elements-except-one-in-xml-using-xslt -->
|
|
50
|
-
<xsl:template match="@*|node()|comment()">
|
|
51
|
-
<xsl:apply-templates select="@*|node()|comment()"/>
|
|
52
|
-
</xsl:template>
|
|
53
|
-
|
|
54
|
-
<!-- ############## -->
|
|
55
|
-
<!-- Entry Template -->
|
|
56
|
-
<!-- ############## -->
|
|
57
|
-
|
|
58
|
-
<xsl:template match="/">
|
|
59
|
-
<xsl:call-template name="converter-blurb-text"/>
|
|
60
|
-
<xsl:apply-templates select="$document-root" />
|
|
61
|
-
</xsl:template>
|
|
62
|
-
|
|
63
|
-
<!-- Headers, per division or structure -->
|
|
64
|
-
<xsl:template match="&STRUCTURAL;">
|
|
65
|
-
<xsl:text>
**************************************
</xsl:text>
|
|
66
|
-
<xsl:apply-templates select="." mode="long-name" />
|
|
67
|
-
<xsl:text>
**************************************
</xsl:text>
|
|
68
|
-
<xsl:apply-templates select="*[not(self::subtitle)]|comment()"/>
|
|
69
|
-
</xsl:template>
|
|
70
|
-
|
|
71
|
-
<!-- Kill titles as metadata, but restore behavior on nodes to -->
|
|
72
|
-
<!-- allow the "long-name" template above to perform as intended -->
|
|
73
|
-
<xsl:template match="title"/>
|
|
74
|
-
<xsl:template match="title/node()">
|
|
75
|
-
<xsl:value-of select="." />
|
|
76
|
-
</xsl:template>
|
|
77
|
-
|
|
78
|
-
<!-- Looking for todo's and provisional citations, cross-references -->
|
|
79
|
-
<!-- May need to abandon counting if conditions get more complex -->
|
|
80
|
-
|
|
81
|
-
<!-- This template comes close to doing the right thing, -->
|
|
82
|
-
<!-- but is off by one (or more) in strange ways, so we -->
|
|
83
|
-
<!-- are not numbering the reported items -->
|
|
84
|
-
<xsl:template match="xref|comment()" mode="overall-number">
|
|
85
|
-
<xsl:number level="any" count="xref[@provisional]|comment()[translate(substring(normalize-space(string(.)), 1, 4), &UPPERCASE;, &LOWERCASE;) = 'todo']"/>
|
|
86
|
-
</xsl:template>
|
|
87
|
-
|
|
88
|
-
<xsl:template match="comment()[translate(substring(normalize-space(string(.)), 1, 4), &UPPERCASE;, &LOWERCASE;) = 'todo']">
|
|
89
|
-
<!-- <xsl:apply-templates select="." mode="overall-number"/> -->
|
|
90
|
-
<!-- <xsl:text>. </xsl:text> -->
|
|
91
|
-
<xsl:call-template name="strip-leading-whitespace">
|
|
92
|
-
<xsl:with-param name="text">
|
|
93
|
-
<xsl:value-of select="."/>
|
|
94
|
-
</xsl:with-param>
|
|
95
|
-
</xsl:call-template>
|
|
96
|
-
<xsl:text>
</xsl:text>
|
|
97
|
-
</xsl:template>
|
|
98
|
-
|
|
99
|
-
<xsl:template match="xref[@provisional]">
|
|
100
|
-
<!-- <xsl:apply-templates select="." mode="overall-number"/> -->
|
|
101
|
-
<!-- <xsl:text>.</xsl:text> -->
|
|
102
|
-
<xsl:text>xref: </xsl:text>
|
|
103
|
-
<xsl:value-of select="@provisional" />
|
|
104
|
-
<xsl:text>
</xsl:text>
|
|
105
|
-
</xsl:template>
|
|
106
|
-
|
|
107
|
-
</xsl:stylesheet>
|
|
1
|
+
<?xml version='1.0'?> <!-- As XML file -->
|
|
2
|
+
|
|
3
|
+
<!--********************************************************************
|
|
4
|
+
Copyright 2018 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
|
+
<!-- http://pimpmyxslt.com/articles/entity-tricks-part2/ -->
|
|
23
|
+
<!DOCTYPE xsl:stylesheet [
|
|
24
|
+
<!ENTITY % entities SYSTEM "../entities.ent">
|
|
25
|
+
%entities;
|
|
26
|
+
]>
|
|
27
|
+
|
|
28
|
+
<!-- Identify as a stylesheet -->
|
|
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
|
+
|
|
32
|
+
<!-- NB: (2020-06-07) xref/@provisional gets replaced by placeholder -->
|
|
33
|
+
<!-- text in the "assembly" phase, so think carefully about whether -->
|
|
34
|
+
<!-- or not this stylesheet should run against orginal source or -->
|
|
35
|
+
<!-- enhanced source, they *are* different. -->
|
|
36
|
+
|
|
37
|
+
<!-- Uses "strip-leading-whitespace" and more -->
|
|
38
|
+
<!-- Standard conversion groundwork -->
|
|
39
|
+
<xsl:import href="../publisher-variables.xsl"/>
|
|
40
|
+
<xsl:import href="../pretext-assembly.xsl"/>
|
|
41
|
+
<xsl:import href="../pretext-common.xsl"/>
|
|
42
|
+
|
|
43
|
+
<!-- ASCII output intended, consistent with -common -->
|
|
44
|
+
<xsl:output method="text" />
|
|
45
|
+
|
|
46
|
+
<!-- Generally, traverse the tree, -->
|
|
47
|
+
<!-- looking for things to do -->
|
|
48
|
+
<!-- http://stackoverflow.com/questions/3776333/ -->
|
|
49
|
+
<!-- stripping-all-elements-except-one-in-xml-using-xslt -->
|
|
50
|
+
<xsl:template match="@*|node()|comment()">
|
|
51
|
+
<xsl:apply-templates select="@*|node()|comment()"/>
|
|
52
|
+
</xsl:template>
|
|
53
|
+
|
|
54
|
+
<!-- ############## -->
|
|
55
|
+
<!-- Entry Template -->
|
|
56
|
+
<!-- ############## -->
|
|
57
|
+
|
|
58
|
+
<xsl:template match="/">
|
|
59
|
+
<xsl:call-template name="converter-blurb-text"/>
|
|
60
|
+
<xsl:apply-templates select="$document-root" />
|
|
61
|
+
</xsl:template>
|
|
62
|
+
|
|
63
|
+
<!-- Headers, per division or structure -->
|
|
64
|
+
<xsl:template match="&STRUCTURAL;">
|
|
65
|
+
<xsl:text>
**************************************
</xsl:text>
|
|
66
|
+
<xsl:apply-templates select="." mode="long-name" />
|
|
67
|
+
<xsl:text>
**************************************
</xsl:text>
|
|
68
|
+
<xsl:apply-templates select="*[not(self::subtitle)]|comment()"/>
|
|
69
|
+
</xsl:template>
|
|
70
|
+
|
|
71
|
+
<!-- Kill titles as metadata, but restore behavior on nodes to -->
|
|
72
|
+
<!-- allow the "long-name" template above to perform as intended -->
|
|
73
|
+
<xsl:template match="title"/>
|
|
74
|
+
<xsl:template match="title/node()">
|
|
75
|
+
<xsl:value-of select="." />
|
|
76
|
+
</xsl:template>
|
|
77
|
+
|
|
78
|
+
<!-- Looking for todo's and provisional citations, cross-references -->
|
|
79
|
+
<!-- May need to abandon counting if conditions get more complex -->
|
|
80
|
+
|
|
81
|
+
<!-- This template comes close to doing the right thing, -->
|
|
82
|
+
<!-- but is off by one (or more) in strange ways, so we -->
|
|
83
|
+
<!-- are not numbering the reported items -->
|
|
84
|
+
<xsl:template match="xref|comment()" mode="overall-number">
|
|
85
|
+
<xsl:number level="any" count="xref[@provisional]|comment()[translate(substring(normalize-space(string(.)), 1, 4), &UPPERCASE;, &LOWERCASE;) = 'todo']"/>
|
|
86
|
+
</xsl:template>
|
|
87
|
+
|
|
88
|
+
<xsl:template match="comment()[translate(substring(normalize-space(string(.)), 1, 4), &UPPERCASE;, &LOWERCASE;) = 'todo']">
|
|
89
|
+
<!-- <xsl:apply-templates select="." mode="overall-number"/> -->
|
|
90
|
+
<!-- <xsl:text>. </xsl:text> -->
|
|
91
|
+
<xsl:call-template name="strip-leading-whitespace">
|
|
92
|
+
<xsl:with-param name="text">
|
|
93
|
+
<xsl:value-of select="."/>
|
|
94
|
+
</xsl:with-param>
|
|
95
|
+
</xsl:call-template>
|
|
96
|
+
<xsl:text>
</xsl:text>
|
|
97
|
+
</xsl:template>
|
|
98
|
+
|
|
99
|
+
<xsl:template match="xref[@provisional]">
|
|
100
|
+
<!-- <xsl:apply-templates select="." mode="overall-number"/> -->
|
|
101
|
+
<!-- <xsl:text>.</xsl:text> -->
|
|
102
|
+
<xsl:text>xref: </xsl:text>
|
|
103
|
+
<xsl:value-of select="@provisional" />
|
|
104
|
+
<xsl:text>
</xsl:text>
|
|
105
|
+
</xsl:template>
|
|
106
|
+
|
|
107
|
+
</xsl:stylesheet>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
# PreTeXt deprecations of xref/@autoname attribute
|
|
2
|
-
# Robert Beezer, 2017-07-25
|
|
3
|
-
|
|
4
|
-
# Sample usage on directory of *.xml files
|
|
5
|
-
# Converts from current directory to "newdir" subdirectory
|
|
6
|
-
#
|
|
7
|
-
# for f in *.xml; do echo $f; sed -f mathbook/xsl/utilities/deprecate-autoname.sed $f > newdir/$f; done
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
s/autoname="no"/text="global"/g
|
|
11
|
-
s/autoname = "no"/text = "global"/g
|
|
12
|
-
|
|
13
|
-
s/autoname="yes"/text="type-global"/g
|
|
14
|
-
s/autoname = "yes"/text = "type-global"/g
|
|
15
|
-
|
|
16
|
-
s/autoname="title"/text="title"/g
|
|
17
|
-
s/autoname = "title"/text = "title"/g
|
|
18
|
-
|
|
1
|
+
# PreTeXt deprecations of xref/@autoname attribute
|
|
2
|
+
# Robert Beezer, 2017-07-25
|
|
3
|
+
|
|
4
|
+
# Sample usage on directory of *.xml files
|
|
5
|
+
# Converts from current directory to "newdir" subdirectory
|
|
6
|
+
#
|
|
7
|
+
# for f in *.xml; do echo $f; sed -f mathbook/xsl/utilities/deprecate-autoname.sed $f > newdir/$f; done
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
s/autoname="no"/text="global"/g
|
|
11
|
+
s/autoname = "no"/text = "global"/g
|
|
12
|
+
|
|
13
|
+
s/autoname="yes"/text="type-global"/g
|
|
14
|
+
s/autoname = "yes"/text = "type-global"/g
|
|
15
|
+
|
|
16
|
+
s/autoname="title"/text="title"/g
|
|
17
|
+
s/autoname = "title"/text = "title"/g
|
|
18
|
+
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
# PreTeXt deprecations of index creation elements
|
|
2
|
-
# Robert Beezer, 2017-07-14
|
|
3
|
-
|
|
4
|
-
# Sample usage on directory of *.xml files
|
|
5
|
-
# Converts from current directory to "newdir" subdirectory
|
|
6
|
-
#
|
|
7
|
-
# for f in *.xml; do echo $f; sed -f mathbook/xsl/utilities/deprecate-index.sed $f > newdir/$f; done
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
# First, protect elements that begin with "index"
|
|
11
|
-
# so "index" match below will not affect them
|
|
12
|
-
s/<index-part/PARTPART/g
|
|
13
|
-
s/<\/index-part>/PARTENDPARTEND/g
|
|
14
|
-
s/<index-list/LISTLIST/g
|
|
15
|
-
|
|
16
|
-
# index -> idx
|
|
17
|
-
s/<index/<idx/g
|
|
18
|
-
s/<\/index>/<\/idx>/g
|
|
19
|
-
|
|
20
|
-
# main -> h
|
|
21
|
-
s/<main/<h/g
|
|
22
|
-
s/<\/main>/<\/h>/g
|
|
23
|
-
|
|
24
|
-
# sub -> h
|
|
25
|
-
# careful not to clobber <subsection>, etc.
|
|
26
|
-
s/<sub /<h /g
|
|
27
|
-
s/<sub>/<h>/g
|
|
28
|
-
s/<\/sub>/<\/h>/g
|
|
29
|
-
|
|
30
|
-
# Remove protection, convert to new elements
|
|
31
|
-
s/PARTPART/<index/g
|
|
32
|
-
s/PARTENDPARTEND/<\/index>/g
|
|
33
|
-
s/LISTLIST/<index-list/g
|
|
1
|
+
# PreTeXt deprecations of index creation elements
|
|
2
|
+
# Robert Beezer, 2017-07-14
|
|
3
|
+
|
|
4
|
+
# Sample usage on directory of *.xml files
|
|
5
|
+
# Converts from current directory to "newdir" subdirectory
|
|
6
|
+
#
|
|
7
|
+
# for f in *.xml; do echo $f; sed -f mathbook/xsl/utilities/deprecate-index.sed $f > newdir/$f; done
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# First, protect elements that begin with "index"
|
|
11
|
+
# so "index" match below will not affect them
|
|
12
|
+
s/<index-part/PARTPART/g
|
|
13
|
+
s/<\/index-part>/PARTENDPARTEND/g
|
|
14
|
+
s/<index-list/LISTLIST/g
|
|
15
|
+
|
|
16
|
+
# index -> idx
|
|
17
|
+
s/<index/<idx/g
|
|
18
|
+
s/<\/index>/<\/idx>/g
|
|
19
|
+
|
|
20
|
+
# main -> h
|
|
21
|
+
s/<main/<h/g
|
|
22
|
+
s/<\/main>/<\/h>/g
|
|
23
|
+
|
|
24
|
+
# sub -> h
|
|
25
|
+
# careful not to clobber <subsection>, etc.
|
|
26
|
+
s/<sub /<h /g
|
|
27
|
+
s/<sub>/<h>/g
|
|
28
|
+
s/<\/sub>/<\/h>/g
|
|
29
|
+
|
|
30
|
+
# Remove protection, convert to new elements
|
|
31
|
+
s/PARTPART/<index/g
|
|
32
|
+
s/PARTENDPARTEND/<\/index>/g
|
|
33
|
+
s/LISTLIST/<index-list/g
|