@amermathsoc/texml-to-html 18.1.0 → 18.3.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/CHANGELOG.md +30 -0
- package/README.md +2 -0
- package/lib/elements/abstract.js +2 -0
- package/lib/elements/app.js +2 -1
- package/lib/elements/attrib.js +2 -17
- package/lib/elements/book-meta-json.js +1 -1
- package/lib/elements/disp-formula-group.js +7 -0
- package/lib/elements/disp-quote.js +6 -3
- package/lib/elements/fig.js +7 -2
- package/lib/elements/formula.js +1 -2
- package/lib/elements/label.js +5 -49
- package/lib/elements/notes.js +1 -0
- package/lib/elements/ref-list.js +1 -1
- package/lib/elements/sec.js +3 -2
- package/lib/elements/secheading.js +3 -2
- package/lib/elements/statement.js +11 -0
- package/lib/elements/subtitle.js +1 -4
- package/lib/elements/tag.js +2 -2
- package/lib/elements/target.js +3 -6
- package/lib/elements/{subject.js → title-group.js} +3 -5
- package/lib/head.js +1 -1
- package/lib/postProcessing.js +81 -0
- package/lib/transformer.js +44 -14
- package/package.json +3 -1
- package/test/article--alttitle.xml +1 -1
- package/test/article.xml +40 -33
- package/test/book.xml +27 -7
- package/test/element-abstract-title.js +5 -2
- package/test/element-attrib.js +2 -2
- package/test/element-disp-quote.js +2 -1
- package/test/element-fig-subfig-label.js +2 -1
- package/test/element-fn.js +6 -3
- package/test/element-formula.js +63 -0
- package/test/element-front.js +2 -1
- package/test/{element-sec-app-front-matter-part-dedication-title-label.js → element-sec.js} +2 -1
- package/test/element-tag.js +5 -1
- package/test/element-tex-math.js +64 -0
- package/test/helper.js +4 -0
- package/test/postProcessing.js +45 -0
- package/test/snapshots/article--alttitle.html +121 -0
- package/test/snapshots/article--nometa.html +56 -0
- package/test/snapshots/article.html +561 -0
- package/test/snapshots/book.html +160 -0
- package/test/snapshots/texml-tests/LGR.html +104 -0
- package/test/snapshots/texml-tests/LGR.xml +82 -0
- package/test/snapshots/texml-tests/NLMnote.html +10 -0
- package/test/snapshots/texml-tests/NLMnote.xml +12 -0
- package/test/snapshots/texml-tests/OT1.html +61 -0
- package/test/snapshots/texml-tests/OT1.xml +39 -0
- package/test/snapshots/texml-tests/OT1ti.html +61 -0
- package/test/snapshots/texml-tests/OT1ti.xml +39 -0
- package/test/snapshots/texml-tests/OT1tt.html +60 -0
- package/test/snapshots/texml-tests/OT1tt.xml +38 -0
- package/test/snapshots/texml-tests/OT2.html +119 -0
- package/test/snapshots/texml-tests/OT2.xml +97 -0
- package/test/snapshots/texml-tests/OT4.html +68 -0
- package/test/snapshots/texml-tests/OT4.xml +46 -0
- package/test/snapshots/texml-tests/OT6.html +49 -0
- package/test/snapshots/texml-tests/OT6.xml +27 -0
- package/test/snapshots/texml-tests/T1.html +44 -0
- package/test/snapshots/texml-tests/T1.xml +22 -0
- package/test/snapshots/texml-tests/T4.html +48 -0
- package/test/snapshots/texml-tests/T4.xml +26 -0
- package/test/snapshots/texml-tests/T5.html +45 -0
- package/test/snapshots/texml-tests/T5.xml +23 -0
- package/test/snapshots/texml-tests/Uchar.html +9 -0
- package/test/snapshots/texml-tests/Uchar.xml +11 -0
- package/test/snapshots/texml-tests/Ucharcat.html +45 -0
- package/test/snapshots/texml-tests/Ucharcat.xml +23 -0
- package/test/snapshots/texml-tests/accent.html +54 -0
- package/test/snapshots/texml-tests/accent.xml +32 -0
- package/test/snapshots/texml-tests/algorithm.html +55 -0
- package/test/snapshots/texml-tests/algorithm.xml +35 -0
- package/test/snapshots/texml-tests/algorithmic.html +706 -0
- package/test/snapshots/texml-tests/algorithmic.xml +712 -0
- package/test/snapshots/texml-tests/algpseudocode.html +520 -0
- package/test/snapshots/texml-tests/algpseudocode.xml +538 -0
- package/test/snapshots/texml-tests/ams_measure.html +46 -0
- package/test/snapshots/texml-tests/ams_measure.xml +24 -0
- package/test/snapshots/texml-tests/amsart.html +66 -0
- package/test/snapshots/texml-tests/amsart.xml +39 -0
- package/test/snapshots/texml-tests/amscyr.html +53 -0
- package/test/snapshots/texml-tests/amscyr.xml +35 -0
- package/test/snapshots/texml-tests/amsfonts.html +41 -0
- package/test/snapshots/texml-tests/amsfonts.xml +21 -0
- package/test/snapshots/texml-tests/amsrefs.html +82 -0
- package/test/snapshots/texml-tests/amsrefs.xml +87 -0
- package/test/snapshots/texml-tests/amsthm.html +83 -0
- package/test/snapshots/texml-tests/amsthm.xml +61 -0
- package/test/snapshots/texml-tests/amsviet.html +42 -0
- package/test/snapshots/texml-tests/amsviet.xml +20 -0
- package/test/snapshots/texml-tests/appendix.html +69 -0
- package/test/snapshots/texml-tests/appendix.xml +43 -0
- package/test/snapshots/texml-tests/array.html +58 -0
- package/test/snapshots/texml-tests/array.xml +36 -0
- package/test/snapshots/texml-tests/arydshln.html +69 -0
- package/test/snapshots/texml-tests/arydshln.xml +47 -0
- package/test/snapshots/texml-tests/autoref.html +76 -0
- package/test/snapshots/texml-tests/autoref.xml +79 -0
- package/test/snapshots/texml-tests/begincsname.html +46 -0
- package/test/snapshots/texml-tests/begincsname.xml +24 -0
- package/test/snapshots/texml-tests/boldline.html +93 -0
- package/test/snapshots/texml-tests/boldline.xml +71 -0
- package/test/snapshots/texml-tests/book-app.html +22 -0
- package/test/snapshots/texml-tests/book-app.xml +26 -0
- package/test/snapshots/texml-tests/booktabs.html +7 -0
- package/test/snapshots/texml-tests/booktabs.xml +9 -0
- package/test/snapshots/texml-tests/boxes.html +54 -0
- package/test/snapshots/texml-tests/boxes.xml +32 -0
- package/test/snapshots/texml-tests/cases.html +13 -0
- package/test/snapshots/texml-tests/cases.xml +19 -0
- package/test/snapshots/texml-tests/cite.html +48 -0
- package/test/snapshots/texml-tests/cite.xml +40 -0
- package/test/snapshots/texml-tests/citesort.html +62 -0
- package/test/snapshots/texml-tests/citesort.xml +74 -0
- package/test/snapshots/texml-tests/cleveref.html +25 -0
- package/test/snapshots/texml-tests/cleveref.xml +28 -0
- package/test/snapshots/texml-tests/codes.html +7 -0
- package/test/snapshots/texml-tests/codes.xml +9 -0
- package/test/snapshots/texml-tests/colortbl.html +46 -0
- package/test/snapshots/texml-tests/colortbl.xml +24 -0
- package/test/snapshots/texml-tests/combinetoks.html +49 -0
- package/test/snapshots/texml-tests/combinetoks.xml +27 -0
- package/test/snapshots/texml-tests/constants.html +45 -0
- package/test/snapshots/texml-tests/constants.xml +23 -0
- package/test/snapshots/texml-tests/csstring.html +44 -0
- package/test/snapshots/texml-tests/csstring.xml +22 -0
- package/test/snapshots/texml-tests/detokenize.html +56 -0
- package/test/snapshots/texml-tests/detokenize.xml +34 -0
- package/test/snapshots/texml-tests/diacritics.html +41 -0
- package/test/snapshots/texml-tests/diacritics.xml +19 -0
- package/test/snapshots/texml-tests/dimexpr.html +42 -0
- package/test/snapshots/texml-tests/dimexpr.xml +20 -0
- package/test/snapshots/texml-tests/doi.html +6 -0
- package/test/snapshots/texml-tests/doi.xml +8 -0
- package/test/snapshots/texml-tests/drm.html +12 -0
- package/test/snapshots/texml-tests/drm.xml +76 -0
- package/test/snapshots/texml-tests/dz.html +25 -0
- package/test/snapshots/texml-tests/dz.xml +27 -0
- package/test/snapshots/texml-tests/edef.html +8 -0
- package/test/snapshots/texml-tests/edef.xml +10 -0
- package/test/snapshots/texml-tests/empheq.html +9 -0
- package/test/snapshots/texml-tests/empheq.xml +13 -0
- package/test/snapshots/texml-tests/enclose.html +27 -0
- package/test/snapshots/texml-tests/enclose.xml +45 -0
- package/test/snapshots/texml-tests/everyeof.html +42 -0
- package/test/snapshots/texml-tests/everyeof.xml +20 -0
- package/test/snapshots/texml-tests/expanded.html +44 -0
- package/test/snapshots/texml-tests/expanded.xml +22 -0
- package/test/snapshots/texml-tests/footnote.html +28 -0
- package/test/snapshots/texml-tests/footnote.xml +59 -0
- package/test/snapshots/texml-tests/frac.html +15 -0
- package/test/snapshots/texml-tests/frac.xml +21 -0
- package/test/snapshots/texml-tests/framebox.html +43 -0
- package/test/snapshots/texml-tests/framebox.xml +23 -0
- package/test/snapshots/texml-tests/glueexpr.html +42 -0
- package/test/snapshots/texml-tests/glueexpr.xml +20 -0
- package/test/snapshots/texml-tests/graphics.html +9 -0
- package/test/snapshots/texml-tests/graphics.xml +13 -0
- package/test/snapshots/texml-tests/gsm_l.html +35 -0
- package/test/snapshots/texml-tests/gsm_l.xml +71 -0
- package/test/snapshots/texml-tests/halign.html +78 -0
- package/test/snapshots/texml-tests/halign.xml +56 -0
- package/test/snapshots/texml-tests/hbox.html +11 -0
- package/test/snapshots/texml-tests/hbox.xml +17 -0
- package/test/snapshots/texml-tests/hello.html +38 -0
- package/test/snapshots/texml-tests/hello.xml +16 -0
- package/test/snapshots/texml-tests/hhline.html +101 -0
- package/test/snapshots/texml-tests/hhline.xml +79 -0
- package/test/snapshots/texml-tests/hline.html +40 -0
- package/test/snapshots/texml-tests/hline.xml +18 -0
- package/test/snapshots/texml-tests/href.html +6 -0
- package/test/snapshots/texml-tests/href.xml +8 -0
- package/test/snapshots/texml-tests/hyperams.html +43 -0
- package/test/snapshots/texml-tests/hyperams.xml +21 -0
- package/test/snapshots/texml-tests/hyperref.html +10 -0
- package/test/snapshots/texml-tests/hyperref.xml +12 -0
- package/test/snapshots/texml-tests/ifcondition.html +39 -0
- package/test/snapshots/texml-tests/ifcondition.xml +17 -0
- package/test/snapshots/texml-tests/ifcsname.html +40 -0
- package/test/snapshots/texml-tests/ifcsname.xml +18 -0
- package/test/snapshots/texml-tests/ifdefined.html +40 -0
- package/test/snapshots/texml-tests/ifdefined.xml +18 -0
- package/test/snapshots/texml-tests/ifdim.html +40 -0
- package/test/snapshots/texml-tests/ifdim.xml +18 -0
- package/test/snapshots/texml-tests/ifnum.html +40 -0
- package/test/snapshots/texml-tests/ifnum.xml +18 -0
- package/test/snapshots/texml-tests/ifprimitive.html +48 -0
- package/test/snapshots/texml-tests/ifprimitive.xml +26 -0
- package/test/snapshots/texml-tests/immediateassigned.html +44 -0
- package/test/snapshots/texml-tests/immediateassigned.xml +22 -0
- package/test/snapshots/texml-tests/immediateassignment.html +44 -0
- package/test/snapshots/texml-tests/immediateassignment.xml +22 -0
- package/test/snapshots/texml-tests/lastbox.html +40 -0
- package/test/snapshots/texml-tests/lastbox.xml +18 -0
- package/test/snapshots/texml-tests/lastnamedcs.html +40 -0
- package/test/snapshots/texml-tests/lastnamedcs.xml +18 -0
- package/test/snapshots/texml-tests/let.html +43 -0
- package/test/snapshots/texml-tests/let.xml +21 -0
- package/test/snapshots/texml-tests/letcharcode.html +41 -0
- package/test/snapshots/texml-tests/letcharcode.xml +19 -0
- package/test/snapshots/texml-tests/ligatures.html +69 -0
- package/test/snapshots/texml-tests/ligatures.xml +47 -0
- package/test/snapshots/texml-tests/list.html +12 -0
- package/test/snapshots/texml-tests/list.xml +14 -0
- package/test/snapshots/texml-tests/listings.html +46 -0
- package/test/snapshots/texml-tests/listings.xml +24 -0
- package/test/snapshots/texml-tests/longtable.html +61 -0
- package/test/snapshots/texml-tests/longtable.xml +39 -0
- package/test/snapshots/texml-tests/ltxcodes.html +1330 -0
- package/test/snapshots/texml-tests/ltxcodes.xml +1332 -0
- package/test/snapshots/texml-tests/ltxthm.html +6 -0
- package/test/snapshots/texml-tests/ltxthm.xml +8 -0
- package/test/snapshots/texml-tests/makecell.html +40 -0
- package/test/snapshots/texml-tests/makecell.xml +18 -0
- package/test/snapshots/texml-tests/maketitle.html +82 -0
- package/test/snapshots/texml-tests/maketitle.xml +67 -0
- package/test/snapshots/texml-tests/math.html +35 -0
- package/test/snapshots/texml-tests/math.xml +47 -0
- package/test/snapshots/texml-tests/mathscinet.html +41 -0
- package/test/snapshots/texml-tests/mathscinet.xml +19 -0
- package/test/snapshots/texml-tests/meaning.html +44 -0
- package/test/snapshots/texml-tests/meaning.xml +22 -0
- package/test/snapshots/texml-tests/metadata.html +125 -0
- package/test/snapshots/texml-tests/metadata.xml +137 -0
- package/test/snapshots/texml-tests/missingfile.html +3 -0
- package/test/snapshots/texml-tests/missingfile.xml +5 -0
- package/test/snapshots/texml-tests/muexpr.html +42 -0
- package/test/snapshots/texml-tests/muexpr.xml +20 -0
- package/test/snapshots/texml-tests/multicolumn.html +47 -0
- package/test/snapshots/texml-tests/multicolumn.xml +25 -0
- package/test/snapshots/texml-tests/multirow.html +47 -0
- package/test/snapshots/texml-tests/multirow.xml +25 -0
- package/test/snapshots/texml-tests/multirowcell.html +50 -0
- package/test/snapshots/texml-tests/multirowcell.xml +28 -0
- package/test/snapshots/texml-tests/multline.html +71 -0
- package/test/snapshots/texml-tests/multline.xml +55 -0
- package/test/snapshots/texml-tests/nameref.html +45 -0
- package/test/snapshots/texml-tests/nameref.xml +23 -0
- package/test/snapshots/texml-tests/noexpand.html +44 -0
- package/test/snapshots/texml-tests/noexpand.xml +22 -0
- package/test/snapshots/texml-tests/noindent.html +39 -0
- package/test/snapshots/texml-tests/noindent.xml +17 -0
- package/test/snapshots/texml-tests/null_cs.html +4 -0
- package/test/snapshots/texml-tests/null_cs.xml +6 -0
- package/test/snapshots/texml-tests/numexpr.html +48 -0
- package/test/snapshots/texml-tests/numexpr.xml +26 -0
- package/test/snapshots/texml-tests/parshape.html +41 -0
- package/test/snapshots/texml-tests/parshape.xml +19 -0
- package/test/snapshots/texml-tests/protected.html +47 -0
- package/test/snapshots/texml-tests/protected.xml +25 -0
- package/test/snapshots/texml-tests/quote.html +43 -0
- package/test/snapshots/texml-tests/quote.xml +21 -0
- package/test/snapshots/texml-tests/read.html +13 -0
- package/test/snapshots/texml-tests/read.xml +15 -0
- package/test/snapshots/texml-tests/refrange.html +126 -0
- package/test/snapshots/texml-tests/refrange.xml +110 -0
- package/test/snapshots/texml-tests/scantokens.html +45 -0
- package/test/snapshots/texml-tests/scantokens.xml +23 -0
- package/test/snapshots/texml-tests/secmeta.html +27 -0
- package/test/snapshots/texml-tests/secmeta.xml +39 -0
- package/test/snapshots/texml-tests/section.html +86 -0
- package/test/snapshots/texml-tests/section.xml +64 -0
- package/test/snapshots/texml-tests/showonlyrefs.html +95 -0
- package/test/snapshots/texml-tests/showonlyrefs.xml +85 -0
- package/test/snapshots/texml-tests/smash.html +41 -0
- package/test/snapshots/texml-tests/smash.xml +21 -0
- package/test/snapshots/texml-tests/strcmp.html +41 -0
- package/test/snapshots/texml-tests/strcmp.xml +19 -0
- package/test/snapshots/texml-tests/string.html +44 -0
- package/test/snapshots/texml-tests/string.xml +22 -0
- package/test/snapshots/texml-tests/sub_sup.html +50 -0
- package/test/snapshots/texml-tests/sub_sup.xml +28 -0
- package/test/snapshots/texml-tests/subcaption.html +54 -0
- package/test/snapshots/texml-tests/subcaption.xml +32 -0
- package/test/snapshots/texml-tests/subfig.html +45 -0
- package/test/snapshots/texml-tests/subfig.xml +23 -0
- package/test/snapshots/texml-tests/subfigure.html +44 -0
- package/test/snapshots/texml-tests/subfigure.xml +22 -0
- package/test/snapshots/texml-tests/tableofcontents.html +42 -0
- package/test/snapshots/texml-tests/tableofcontents.xml +95 -0
- package/test/snapshots/texml-tests/tabular.html +47 -0
- package/test/snapshots/texml-tests/tabular.xml +25 -0
- package/test/snapshots/texml-tests/tag.html +16 -0
- package/test/snapshots/texml-tests/tag.xml +20 -0
- package/test/snapshots/texml-tests/tcolorbox.html +43 -0
- package/test/snapshots/texml-tests/tcolorbox.xml +21 -0
- package/test/snapshots/texml-tests/textequation.html +55 -0
- package/test/snapshots/texml-tests/textequation.xml +33 -0
- package/test/snapshots/texml-tests/thm-restate.html +94 -0
- package/test/snapshots/texml-tests/thm-restate.xml +86 -0
- package/test/snapshots/texml-tests/tracingnodes.html +38 -0
- package/test/snapshots/texml-tests/tracingnodes.xml +16 -0
- package/test/snapshots/texml-tests/unexpanded.html +44 -0
- package/test/snapshots/texml-tests/unexpanded.xml +22 -0
- package/test/snapshots/texml-tests/unless.html +40 -0
- package/test/snapshots/texml-tests/unless.xml +18 -0
- package/test/snapshots/texml-tests/upgreek.html +79 -0
- package/test/snapshots/texml-tests/upgreek.xml +57 -0
- package/test/snapshots/texml-tests/uri.html +12 -0
- package/test/snapshots/texml-tests/uri.xml +14 -0
- package/test/snapshots/texml-tests/url.html +41 -0
- package/test/snapshots/texml-tests/url.xml +19 -0
- package/test/snapshots/texml-tests/vlist.html +48 -0
- package/test/snapshots/texml-tests/vlist.xml +28 -0
- package/test/snapshots/texml-tests/xcolor.html +50 -0
- package/test/snapshots/texml-tests/xcolor.xml +28 -0
- package/test/snapshots/updateTexmlSnapshots.js +14 -0
- package/texml-to-html.js +2 -2
- package/lib/elements/article-title.js +0 -26
- package/lib/elements/book-title.js +0 -26
- package/lib/elements/meta-name.js +0 -29
- package/lib/elements/meta-value.js +0 -27
- package/lib/elements/subj-group.js +0 -29
- package/lib/hacks.js +0 -43
- package/test/element-inline-formula-disp-formula-tex-math.js +0 -98
- package/test/hacks.js +0 -39
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* meta-name element
|
|
19
|
-
* @param {HTMLElement} htmlParentNode
|
|
20
|
-
* @param {Element} xmlnode
|
|
21
|
-
*/
|
|
22
|
-
export default function (htmlParentNode, xmlnode) {
|
|
23
|
-
// NOTE currently, we only have custom-meta[@specific-use='communicated-by']>meta-name; future publications might need more here
|
|
24
|
-
const dt = this.createNode('dt');
|
|
25
|
-
const specificUse = xmlnode.parentNode.getAttribute('specific-use');
|
|
26
|
-
if (specificUse) dt.setAttribute('data-ams-specific-use', specificUse);
|
|
27
|
-
htmlParentNode.appendChild(dt);
|
|
28
|
-
this.passThrough(dt, xmlnode);
|
|
29
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* meta-value element
|
|
19
|
-
* @param {HTMLElement} htmlParentNode
|
|
20
|
-
* @param {Element} xmlnode
|
|
21
|
-
*/
|
|
22
|
-
export default function (htmlParentNode, xmlnode) {
|
|
23
|
-
// NOTE currently, we only have custom-meta[@specific-use='communicated-by']>meta-value; future publications might need more here
|
|
24
|
-
const dd = this.createNode('dd');
|
|
25
|
-
htmlParentNode.appendChild(dd);
|
|
26
|
-
this.passThrough(dd, xmlnode);
|
|
27
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* subj-group element
|
|
19
|
-
* @param {HTMLElement} htmlParentNode
|
|
20
|
-
* @param {Element} xmlnode
|
|
21
|
-
*/
|
|
22
|
-
export default function (htmlParentNode, xmlnode) {
|
|
23
|
-
htmlParentNode.appendChild(
|
|
24
|
-
this.createNode('dt', `Subjects`)
|
|
25
|
-
);
|
|
26
|
-
xmlnode
|
|
27
|
-
.querySelectorAll('subject')
|
|
28
|
-
.forEach(this.recurseTheDom.bind(null, htmlParentNode));
|
|
29
|
-
};
|
package/lib/hacks.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
// From https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#phrasing_content
|
|
18
|
-
// Note: 'a', 'del', 'ins', 'link', 'map', 'meta' have additional constraints that we ignore since they shouldn't occur in our content
|
|
19
|
-
const phrasingContentTags = ['abbr', 'audio', 'b', 'bdo', 'br', 'button', 'canvas', 'cite', 'code', 'data', 'datalist', 'dfn', 'em', 'embed', 'i', 'iframe', 'img', 'input', 'kbd', 'label', 'mark', 'math', 'meter', 'noscript', 'object', 'output', 'picture', 'progress', 'q', 'ruby', 'samp', 'script', 'select', 'small', 'span', 'strong', 'sub', 'sup', 'svg', 'textarea', 'time', 'u', 'var', 'video', 'wbr', 'a', 'del', 'ins', 'link', 'map', 'meta']
|
|
20
|
-
/**
|
|
21
|
-
* Moves non-phrasing content out of paragraph node. Works around texml#104
|
|
22
|
-
* @param {HTMLElement} node
|
|
23
|
-
*/
|
|
24
|
-
const sanitizeParagraph = node => {
|
|
25
|
-
const childrenArray = [...node.children];
|
|
26
|
-
const maybeBadChild = childrenArray.find(child => (!child.tagName.includes('-') && !phrasingContentTags.includes(child.tagName.toLowerCase()))); // check for content that is not phrasing conetnt and not a custom element name.
|
|
27
|
-
if (!maybeBadChild) return;
|
|
28
|
-
console.log(`Info: texml-to-html: fixing non-phrasing in paragraph, cf. texml#104, near ID ${node.closest('[id]')?.getAttribute('id')}`)
|
|
29
|
-
const remainingChildren = childrenArray.slice(childrenArray.indexOf(maybeBadChild)).reverse();
|
|
30
|
-
remainingChildren.forEach(child => node.insertAdjacentElement('afterend', child));
|
|
31
|
-
if (node.innerHTML.trim() === '') {
|
|
32
|
-
node.remove();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Wrapper around hacks
|
|
38
|
-
* @param {Document} document
|
|
39
|
-
*/
|
|
40
|
-
export const applyHacks = document => {
|
|
41
|
-
// workaround texml#104
|
|
42
|
-
document.querySelectorAll('p').forEach(sanitizeParagraph);
|
|
43
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { article } from './helper.js';
|
|
18
|
-
import tape from 'tape';
|
|
19
|
-
|
|
20
|
-
tape('inline-formula, disp-formula, tex-math', async function (t) {
|
|
21
|
-
t.plan(20);
|
|
22
|
-
const document = article;
|
|
23
|
-
const inlineformula = document.querySelector(
|
|
24
|
-
'#equations [data-ams-doc="math inline"]'
|
|
25
|
-
);
|
|
26
|
-
t.ok(inlineformula, 'Inline formula');
|
|
27
|
-
const tex = inlineformula.innerHTML;
|
|
28
|
-
t.ok(
|
|
29
|
-
tex.includes('\\text{Te\\#t }'),
|
|
30
|
-
'tex-math/text (with unicode spacing characters)'
|
|
31
|
-
);
|
|
32
|
-
t.ok(
|
|
33
|
-
tex.includes('\\xhref[fn]{#fnid1}{{}^{1}}'),
|
|
34
|
-
'tex-math/xref@ref-type="fn"'
|
|
35
|
-
);
|
|
36
|
-
t.ok(
|
|
37
|
-
tex.includes('\\xhref[other]{#otherid1}{}'),
|
|
38
|
-
'tex-math/xref@ref-type="other"'
|
|
39
|
-
);
|
|
40
|
-
const footnote = document.querySelector('#fnid');
|
|
41
|
-
t.ok(
|
|
42
|
-
footnote.getAttribute('role'),
|
|
43
|
-
'doc-footnote',
|
|
44
|
-
'Inline-formula Footnote'
|
|
45
|
-
);
|
|
46
|
-
t.notOk(footnote.closest('p, span'), 'footnote moved out of span and paragraph');
|
|
47
|
-
t.ok(footnote.querySelector('a'), 'xref in footnote within tex-math not rewritten to TeX macro')
|
|
48
|
-
|
|
49
|
-
const displayformula = document.querySelector(
|
|
50
|
-
'#equations [data-ams-doc="math block"]'
|
|
51
|
-
);
|
|
52
|
-
t.ok(displayformula, 'Display formula');
|
|
53
|
-
t.equal(
|
|
54
|
-
displayformula.getAttribute('data-ams-qed-box'),
|
|
55
|
-
'true',
|
|
56
|
-
'has-qed-box'
|
|
57
|
-
);
|
|
58
|
-
t.equal(
|
|
59
|
-
displayformula.getAttribute('data-ams-specific-use'),
|
|
60
|
-
'special',
|
|
61
|
-
'disp-formula gets attributes from tex-math mapped'
|
|
62
|
-
);
|
|
63
|
-
t.ok(
|
|
64
|
-
displayformula.innerHTML.includes('\\xhref[fn]{#fnid2}{{}^{2}}'),
|
|
65
|
-
'tex-math/xref@ref-type="fn"'
|
|
66
|
-
);
|
|
67
|
-
t.ok(
|
|
68
|
-
displayformula.nextElementSibling.getAttribute('role'),
|
|
69
|
-
'doc-footnote',
|
|
70
|
-
'Display-formula Footnote'
|
|
71
|
-
);
|
|
72
|
-
const disptex = displayformula.lastElementChild.innerHTML;
|
|
73
|
-
// NOTE JS implementation removed extra space between the two strings
|
|
74
|
-
t.equal(
|
|
75
|
-
disptex, '\\xhref[fn]{#fnid2}{{}^{2}}\\text{Start\\xhref[other]{#otherid2}{\\$}End}',
|
|
76
|
-
'tex-math/text/xref'
|
|
77
|
-
);
|
|
78
|
-
const formulaNestedTeX = document.querySelectorAll('#equations [data-ams-doc="math inline"] > tex-math')[1];
|
|
79
|
-
t.equal(formulaNestedTeX.innerHTML, '\\text{Te\\$t$x^2$}');
|
|
80
|
-
|
|
81
|
-
// text-mode text styling
|
|
82
|
-
const dispWithText = document.querySelectorAll(
|
|
83
|
-
'#equations [data-ams-doc="math block"] > tex-math'
|
|
84
|
-
);
|
|
85
|
-
t.equal(dispWithText[1].innerHTML, ' \\text{\\textrm{roman\\#} $\\mathsc{sc\\$}$ \\textit{italic\\_} \\textbf{bold\\$} \\textsf{sans-serif\\&} \\texttt{monospace} \\href{https://ext~}{ext-link\\unicode{x7E}} inside text} ', 'Text markup inside text + escaping active characters');
|
|
86
|
-
|
|
87
|
-
// formula in footnote in formula not treated as nested formula
|
|
88
|
-
t.equal(document.querySelector('#fnid5').innerHTML, '<span data-ams-doc="label"><sup></sup></span><span data-ams-doc="math inline"><tex-math>x</tex-math></span>', 'Formula with footnote with formula');
|
|
89
|
-
// formula in formula at implicit text mode
|
|
90
|
-
t.equal(dispWithText[5].innerHTML, '\\tag{$x$}', 'Formula with with formula in implicit text mode');
|
|
91
|
-
|
|
92
|
-
// formula of type text (aka "thingy" environment)
|
|
93
|
-
t.ok(document.querySelector('div[data-ams-doc="math text"]'), 'Display Formula of content-type=text');
|
|
94
|
-
t.equal(document.querySelector('div[data-ams-doc="math text"] > span[data-ams-doc="label"]#textEquation+p').previousElementSibling.innerHTML, '(T)', 'Display Formula of content-type=text, label and paragraph');
|
|
95
|
-
|
|
96
|
-
// formula with cite-group and cite-detail
|
|
97
|
-
t.equal(dispWithText[9].innerHTML, ' <ams-x>[</ams-x>\\xhref[bibr]{#bibr-AEG0}{AEG08<cite-detail><ams-x>, </ams-x>Section 5</cite-detail>}<ams-x></ams-x> ', 'Formula with cite-group, cite-detail')
|
|
98
|
-
});
|
package/test/hacks.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { article } from './helper.js';
|
|
18
|
-
import tape from 'tape';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
tape('Hacks', async function (t) {
|
|
22
|
-
t.plan(5);
|
|
23
|
-
const document = article;
|
|
24
|
-
|
|
25
|
-
// moved from test/element-def-list-def-item-def-term.js (for the old def-list.js hack of "move DL after its P parent")
|
|
26
|
-
const wrappingParagraph = document.querySelector('#hacks p');
|
|
27
|
-
const firstDL = document.querySelector('#hacks dL');
|
|
28
|
-
t.equal(wrappingParagraph.innerHTML.trim(), 'text node', 'paragraph text remains');
|
|
29
|
-
t.ok(wrappingParagraph.nextElementSibling === firstDL, 'DL is placed after parent if XML parent is paragraph');
|
|
30
|
-
|
|
31
|
-
// Note. the old def-list.js hack ("move DL after its P parent") was inverting the order (e.g., when there are 2 DLs in the P)
|
|
32
|
-
const firstDT = firstDL.querySelector('dt');
|
|
33
|
-
t.equal(firstDT.innerHTML, '1', 'DLs moved out of paragraph appear in the correct oder');
|
|
34
|
-
|
|
35
|
-
t.equal(document.querySelectorAll('#hacks > p').length, 1, 'If paragraph is empty after postprocessing, it is removed.')
|
|
36
|
-
|
|
37
|
-
t.equal(document.querySelector('cite-group').parentNode.tagName, 'P', 'Custom elements remain in paragraph');
|
|
38
|
-
});
|
|
39
|
-
|