@amermathsoc/texml-to-html 15.0.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 (166) hide show
  1. package/CHANGELOG.md +1414 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +5 -0
  4. package/README.md +16 -0
  5. package/examples/cli.js +6 -0
  6. package/ldom.js +6 -0
  7. package/lib/doms.js +30 -0
  8. package/lib/elements/abstract.js +34 -0
  9. package/lib/elements/algorithm.js +78 -0
  10. package/lib/elements/app.js +35 -0
  11. package/lib/elements/article-metadata-json.js +167 -0
  12. package/lib/elements/article-title.js +26 -0
  13. package/lib/elements/article.js +28 -0
  14. package/lib/elements/attrib.js +41 -0
  15. package/lib/elements/bold.js +32 -0
  16. package/lib/elements/book-meta-json.js +134 -0
  17. package/lib/elements/book-meta.js +33 -0
  18. package/lib/elements/book-title.js +26 -0
  19. package/lib/elements/boxed-text.js +31 -0
  20. package/lib/elements/break.js +25 -0
  21. package/lib/elements/caption.js +52 -0
  22. package/lib/elements/compound-kwd.js +27 -0
  23. package/lib/elements/def-item.js +26 -0
  24. package/lib/elements/def-list.js +30 -0
  25. package/lib/elements/def.js +29 -0
  26. package/lib/elements/disp-formula-group.js +30 -0
  27. package/lib/elements/disp-quote.js +33 -0
  28. package/lib/elements/email.js +28 -0
  29. package/lib/elements/ext-link.js +38 -0
  30. package/lib/elements/fig.js +32 -0
  31. package/lib/elements/fn.js +42 -0
  32. package/lib/elements/formula.js +51 -0
  33. package/lib/elements/front.js +64 -0
  34. package/lib/elements/funding-group.js +26 -0
  35. package/lib/elements/graphic.js +49 -0
  36. package/lib/elements/img.js +28 -0
  37. package/lib/elements/italic.js +33 -0
  38. package/lib/elements/kwd-group.js +29 -0
  39. package/lib/elements/kwd.js +26 -0
  40. package/lib/elements/label.js +101 -0
  41. package/lib/elements/line.js +31 -0
  42. package/lib/elements/meta-name.js +29 -0
  43. package/lib/elements/meta-value.js +27 -0
  44. package/lib/elements/mixed-citation.js +35 -0
  45. package/lib/elements/monospace.js +35 -0
  46. package/lib/elements/notes.js +36 -0
  47. package/lib/elements/p.js +29 -0
  48. package/lib/elements/preface.js +33 -0
  49. package/lib/elements/ref-list.js +50 -0
  50. package/lib/elements/ref.js +28 -0
  51. package/lib/elements/roman.js +34 -0
  52. package/lib/elements/sans-serif.js +34 -0
  53. package/lib/elements/sc.js +35 -0
  54. package/lib/elements/sec-meta.js +35 -0
  55. package/lib/elements/sec.js +89 -0
  56. package/lib/elements/secheading.js +43 -0
  57. package/lib/elements/simpletabbing.js +29 -0
  58. package/lib/elements/statement.js +31 -0
  59. package/lib/elements/string-name.js +28 -0
  60. package/lib/elements/styled-content.js +32 -0
  61. package/lib/elements/subj-group.js +29 -0
  62. package/lib/elements/subject.js +26 -0
  63. package/lib/elements/subtitle.js +29 -0
  64. package/lib/elements/table.js +28 -0
  65. package/lib/elements/tag.js +50 -0
  66. package/lib/elements/target.js +39 -0
  67. package/lib/elements/term.js +31 -0
  68. package/lib/elements/tex-math.js +34 -0
  69. package/lib/elements/text.js +29 -0
  70. package/lib/elements/toc-entry.js +63 -0
  71. package/lib/elements/toc.js +35 -0
  72. package/lib/elements/underline.js +26 -0
  73. package/lib/elements/x.js +27 -0
  74. package/lib/elements/xref-group.js +36 -0
  75. package/lib/elements/xref.js +89 -0
  76. package/lib/hacks.js +43 -0
  77. package/lib/head.js +38 -0
  78. package/lib/helpers/copyElement.js +29 -0
  79. package/lib/helpers/extractContribGroups.js +94 -0
  80. package/lib/helpers/generateByline.js +35 -0
  81. package/lib/helpers/getParentLevel.js +24 -0
  82. package/lib/helpers/helpers-tex.js +54 -0
  83. package/lib/helpers/mapAttributes.js +54 -0
  84. package/lib/helpers/mapColorAttributes.js +36 -0
  85. package/lib/helpers/unnest.js +34 -0
  86. package/lib/transformer.js +311 -0
  87. package/out.html +550 -0
  88. package/package.json +39 -0
  89. package/test/article--alttitle.xml +146 -0
  90. package/test/article--nometa.xml +40 -0
  91. package/test/article-alttitle-meta-snapshot.json +94 -0
  92. package/test/article-meta-snapshot.json +129 -0
  93. package/test/article-nometa-meta-snapshot.json +46 -0
  94. package/test/article.xml +593 -0
  95. package/test/attribute-content-type.js +26 -0
  96. package/test/attribute-has-qed-box.js +28 -0
  97. package/test/attribute-hidden.js +27 -0
  98. package/test/attribute-rowspan-colspan.js +27 -0
  99. package/test/attribute-specific-use.js +27 -0
  100. package/test/attribute-style.js +27 -0
  101. package/test/book-meta-snapshot.json +78 -0
  102. package/test/book.xml +292 -0
  103. package/test/copyElement.js +38 -0
  104. package/test/element-abstract-title.js +27 -0
  105. package/test/element-algorithm.js +56 -0
  106. package/test/element-article.js +24 -0
  107. package/test/element-attrib.js +27 -0
  108. package/test/element-back-app-group-app.js +28 -0
  109. package/test/element-bold.js +26 -0
  110. package/test/element-book-meta.js +37 -0
  111. package/test/element-book-preface.js +29 -0
  112. package/test/element-book-ref-list.js +32 -0
  113. package/test/element-book.js +33 -0
  114. package/test/element-boxed-text.js +28 -0
  115. package/test/element-break.js +27 -0
  116. package/test/element-citegroup.js +25 -0
  117. package/test/element-compound-kwd.js +24 -0
  118. package/test/element-def-list-def-item-def-term.js +43 -0
  119. package/test/element-disp-formula-group.js +27 -0
  120. package/test/element-disp-quote.js +31 -0
  121. package/test/element-email.js +26 -0
  122. package/test/element-ext-link.js +30 -0
  123. package/test/element-fig-subfig-label.js +38 -0
  124. package/test/element-fn.js +40 -0
  125. package/test/element-front.js +45 -0
  126. package/test/element-funding-group.js +29 -0
  127. package/test/element-graphic-inline-graphic.js +40 -0
  128. package/test/element-img.js +30 -0
  129. package/test/element-inline-formula-disp-formula-tex-math.js +91 -0
  130. package/test/element-italic.js +28 -0
  131. package/test/element-kwd-group.js +28 -0
  132. package/test/element-kwd.js +27 -0
  133. package/test/element-mixed-citation.js +32 -0
  134. package/test/element-monospace.js +27 -0
  135. package/test/element-notes.js +42 -0
  136. package/test/element-p-p.js +27 -0
  137. package/test/element-ref-list-ref-label.js +40 -0
  138. package/test/element-roman.js +27 -0
  139. package/test/element-sans-serif.js +27 -0
  140. package/test/element-sc.js +27 -0
  141. package/test/element-sec-app-front-matter-part-dedication-title-label.js +87 -0
  142. package/test/element-sec-meta.js +43 -0
  143. package/test/element-secheading.js +28 -0
  144. package/test/element-simpletabbing-line.js +31 -0
  145. package/test/element-statement-label-title.js +120 -0
  146. package/test/element-string-name.js +27 -0
  147. package/test/element-stripEmptyLabel.js +26 -0
  148. package/test/element-styled-content.js +28 -0
  149. package/test/element-subtitle.js +36 -0
  150. package/test/element-table-wrap-group.js +30 -0
  151. package/test/element-table-wrap.js +51 -0
  152. package/test/element-table.js +34 -0
  153. package/test/element-tag.js +38 -0
  154. package/test/element-target.js +33 -0
  155. package/test/element-toc-toc-entry.js +77 -0
  156. package/test/element-underline.js +27 -0
  157. package/test/element-verse-group.js +28 -0
  158. package/test/element-x.js +30 -0
  159. package/test/element-xref-group.js +26 -0
  160. package/test/element-xref.js +32 -0
  161. package/test/hacks.js +37 -0
  162. package/test/helper-mapColorAttributes.js +27 -0
  163. package/test/helper.js +26 -0
  164. package/test/setHead.js +32 -0
  165. package/test/unit/abstract.js +35 -0
  166. package/texml-to-html.js +32 -0
@@ -0,0 +1,29 @@
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 mapAttributes from '../helpers/mapAttributes.js';
18
+
19
+ /**
20
+ * p element
21
+ * @param {HTMLElement} htmlParentNode
22
+ * @param {Element} xmlnode
23
+ */
24
+ export default function (htmlParentNode, xmlnode) {
25
+ let paragraph = this.createNode('p');
26
+ mapAttributes(paragraph, xmlnode);
27
+ htmlParentNode.appendChild(paragraph);
28
+ this.passThrough(paragraph, xmlnode);
29
+ };
@@ -0,0 +1,33 @@
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 mapAttributes from '../helpers/mapAttributes.js';
18
+
19
+ /**
20
+ * preface element
21
+ * @param {HTMLElement} htmlParentNode
22
+ * @param {Element} xmlnode
23
+ */
24
+ export default function (htmlParentNode, xmlnode) {
25
+ // NOTE should only occur in books
26
+ const preface = this.createNode('section', '', {
27
+ role: 'doc-preface',
28
+ 'data-ams-doc-level': 0
29
+ });
30
+ mapAttributes(preface, xmlnode);
31
+ htmlParentNode.appendChild(preface);
32
+ this.passThrough(preface, xmlnode);
33
+ };
@@ -0,0 +1,50 @@
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 mapAttributes from '../helpers/mapAttributes.js';
18
+ import getParentLevel from '../helpers/getParentLevel.js';
19
+
20
+ /**
21
+ * ref-list element
22
+ * @param {HTMLElement} htmlParentNode
23
+ * @param {Element} xmlnode
24
+ */
25
+ export default function (htmlParentNode, xmlnode) {
26
+ // calculate document level
27
+ const parentLevel = getParentLevel(htmlParentNode);
28
+ let level = this.isBook ? '0' : '1';
29
+ if (!Number.isNaN(parentLevel)) level = parentLevel + 1;
30
+ // check nesting NOTE no complex nesting allowed.
31
+ const isNestedRefList = (xmlnode.parentNode.tagName === 'ref-list');
32
+ const containsRefList = xmlnode.querySelector(':scope>ref-list');
33
+ // wrapping section to accomodate title
34
+ const section = this.createNode('section', '', {
35
+ 'data-ams-doc-level': level
36
+ });
37
+ mapAttributes(section, xmlnode);
38
+ htmlParentNode.appendChild(section);
39
+ if (!isNestedRefList) {
40
+ section.setAttribute('role', 'doc-bibliography');
41
+ }
42
+ if (containsRefList) {
43
+ this.passThrough(section, xmlnode);
44
+ return;
45
+ }
46
+ this.recurseTheDom(section, xmlnode.querySelector('title'));
47
+ const dl = this.createNode('dl', '');
48
+ section.appendChild(dl);
49
+ xmlnode.querySelectorAll('ref').forEach(this.recurseTheDom.bind(null, dl));
50
+ };
@@ -0,0 +1,28 @@
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
+ * ref element
19
+ * @param {HTMLElement} htmlParentNode
20
+ * @param {Element} xmlnode
21
+ */
22
+ export default function (htmlParentNode, xmlnode) {
23
+ const dt = this.createNode('dt');
24
+ dt.id = xmlnode.id;
25
+ htmlParentNode.appendChild(dt);
26
+ this.recurseTheDom(dt, xmlnode.querySelector('label'));
27
+ this.recurseTheDom(htmlParentNode, xmlnode.querySelector('mixed-citation'));
28
+ };
@@ -0,0 +1,34 @@
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 { node2macro } from '../helpers/helpers-tex.js';
18
+
19
+ /**
20
+ * roman element
21
+ * @param {HTMLElement} htmlParentNode
22
+ * @param {Element} xmlnode
23
+ */
24
+ export default function (htmlParentNode, xmlnode) {
25
+ if (xmlnode.closest('tex-math')) {
26
+ node2macro.apply(this, [htmlParentNode, xmlnode, 'textrm', true]);
27
+ return;
28
+ }
29
+ const span = this.createNode('span', '', {
30
+ 'data-ams-style': xmlnode.tagName
31
+ });
32
+ htmlParentNode.appendChild(span);
33
+ this.passThrough(span, xmlnode);
34
+ };
@@ -0,0 +1,34 @@
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 { node2macro } from '../helpers/helpers-tex.js';
18
+
19
+ /**
20
+ * sans-serif element
21
+ * @param {HTMLElement} htmlParentNode
22
+ * @param {Element} xmlnode
23
+ */
24
+ export default function (htmlParentNode, xmlnode) {
25
+ if (xmlnode.closest("tex-math")) {
26
+ node2macro.apply(this, [htmlParentNode, xmlnode, 'textsf', true]);
27
+ return;
28
+ }
29
+ const span = this.createNode("span", "", {
30
+ "data-ams-style": xmlnode.tagName,
31
+ });
32
+ htmlParentNode.appendChild(span);
33
+ this.passThrough(span, xmlnode);
34
+ };
@@ -0,0 +1,35 @@
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 { node2macro } from '../helpers/helpers-tex.js';
18
+
19
+ /**
20
+ * sc element
21
+ * @param {HTMLElement} htmlParentNode
22
+ * @param {Element} xmlnode
23
+ */
24
+ export default function (htmlParentNode, xmlnode) {
25
+ if (xmlnode.closest('tex-math')) {
26
+ node2macro.apply(this, [htmlParentNode, xmlnode, 'mathsc', true, true]);
27
+ return;
28
+ }
29
+
30
+ const span = this.createNode('span', '', {
31
+ 'data-ams-style': xmlnode.tagName
32
+ });
33
+ htmlParentNode.appendChild(span);
34
+ this.passThrough(span, xmlnode);
35
+ };
@@ -0,0 +1,35 @@
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 { generateByline } from "../helpers/generateByline.js";
18
+ /**
19
+ * sec-meta element
20
+ * @param {HTMLElement} htmlParentNode
21
+ * @param {Element} xmlnode
22
+ */
23
+ export default function (htmlParentNode, xmlnode) {
24
+ const contributors = this.extractContribGroups(xmlnode);
25
+ const secmetaSection = this.createNode('section', '', {
26
+ 'data-ams-doc': 'sec-meta',
27
+ 'data-ams-contributors': JSON.stringify(contributors),
28
+ 'data-ams-byline': generateByline(contributors),
29
+ });
30
+ htmlParentNode.appendChild(secmetaSection);
31
+
32
+ // NOTE: use cases for content within sec-meta so far: MCL1/14 has abstract; noti2382 has notes.
33
+ this.passThrough(secmetaSection, xmlnode);
34
+ // NOTE: MCL01, MCL14 also have questionable contrib-group with just author-comment (which was intentionally broken via #254, cf. also AmerMathSoc/mcl#13)
35
+ };
@@ -0,0 +1,89 @@
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
+ const sectioningDictionary = {
18
+ part: 0,
19
+ chapter: 0,
20
+ section: 1,
21
+ refhead: 1, // NOTE NOTI only
22
+ subsection: 2,
23
+ subsubsection: 3,
24
+ paragraph: 4,
25
+ subparagraph: 5,
26
+ };
27
+
28
+ /**
29
+ * sec element, also used for many other section-like elements
30
+ * @param {HTMLElement} htmlParentNode
31
+ * @param {Element} xmlnode
32
+ */
33
+ export default function (htmlParentNode, xmlnode) {
34
+ const tagName = xmlnode.tagName;
35
+ const specificUse = xmlnode.getAttribute('specific-use');
36
+ const articleWithPartIncrement =
37
+ !this.isBook && xmlnode.getRootNode().querySelector('sec[specific-use="part"]')
38
+ ? 1
39
+ : 0;
40
+ const hasDictionaryEntry = sectioningDictionary[specificUse] !== undefined;
41
+ const ancestorWithLevel = htmlParentNode.closest('[data-ams-doc-level]');
42
+ // if there is no sectioningDictionary entry, we use the ancestor to decide, if 0 or 5 is appropriate.
43
+ // NOTE front-matter (aliased to sec()) doesn't have an ancestor.
44
+ const level = hasDictionaryEntry
45
+ ? sectioningDictionary[specificUse]
46
+ : ancestorWithLevel
47
+ ? 5
48
+ : 0;
49
+ const section = this.createNode('section', '', {
50
+ 'data-ams-doc-level': level + articleWithPartIncrement,
51
+ 'data-ams-doc': specificUse,
52
+ id: xmlnode.getAttribute('id'),
53
+ });
54
+ htmlParentNode.appendChild(section);
55
+
56
+ if (specificUse === 'part') {
57
+ section.setAttribute('role', 'doc-part');
58
+ }
59
+ if (specificUse === 'chapter') {
60
+ section.setAttribute('role', 'doc-chapter');
61
+ }
62
+ section.removeAttribute('specific-use');
63
+ if (tagName === 'dedication')
64
+ section.setAttribute('role', 'doc-dedication');
65
+
66
+ // Acknowledgements
67
+ const titleChild = xmlnode.querySelector('title');
68
+ if (
69
+ tagName === 'ack' ||
70
+ (titleChild && titleChild.textContent.startsWith('Acknowledg'))
71
+ ) {
72
+ section.setAttribute('role', 'doc-acknowledgments');
73
+ }
74
+ if (tagName === 'ack' && !this.isBook)
75
+ section.setAttribute('data-ams-doc-level', '1');
76
+ if (titleChild && titleChild.textContent.startsWith('Introduction'))
77
+ section.setAttribute('role', 'doc-introduction');
78
+
79
+ // book appendices
80
+ if (tagName === 'book-app-group') {
81
+ // NOTE might become redundant if book-app-group gets specific-use=part
82
+ section.setAttribute('role', 'doc-part');
83
+ section.setAttribute('data-ams-doc', 'part');
84
+ section.setAttribute('data-ams-doc-level', '0');
85
+ }
86
+ if (tagName === 'book-app') section.setAttribute('role', 'doc-appendix');
87
+
88
+ this.passThrough(section, xmlnode);
89
+ };
@@ -0,0 +1,43 @@
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 mapAttributes from '../helpers/mapAttributes.js';
18
+
19
+ /**
20
+ * secheading element
21
+ * @param {HTMLElement} htmlParentNode
22
+ * @param {Element} xmlnode
23
+ */
24
+ export default function (htmlParentNode, xmlnode) {
25
+ const parentLevel = htmlParentNode.closest('[data-ams-doc-level]')?.getAttribute('data-ams-doc-level') || 5;
26
+ const span = this.createNode('span', '', {
27
+ 'data-ams-doc': 'secheading',
28
+ 'data-ams-doc-level': parseInt(parentLevel)+1,
29
+ });
30
+ mapAttributes(span, xmlnode);
31
+
32
+ htmlParentNode.appendChild(span);
33
+ const label = xmlnode.querySelector('label');
34
+ const title = xmlnode.querySelector('title');
35
+ if (label) {
36
+ this.passThrough(span, label);
37
+ }
38
+ if (title && label) {
39
+ span.insertAdjacentText('beforeend', '. ');
40
+ // NOTE this does not match label/title punctuation where a title without label would get a period.
41
+ }
42
+ this.passThrough(span, title);
43
+ };
@@ -0,0 +1,29 @@
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
+ * simpletabbing element
19
+ * @param {HTMLElement} htmlParentNode
20
+ * @param {Element} xmlnode
21
+ */
22
+ export default function (htmlParentNode, xmlnode) {
23
+ const section = this.createNode('section', '', {
24
+ 'data-ams-doc': xmlnode.tagName,
25
+ });
26
+ if (xmlnode.hasAttribute('id')) section.id = xmlnode.getAttribute('id');
27
+ htmlParentNode.appendChild(section);
28
+ this.passThrough(section, xmlnode);
29
+ };
@@ -0,0 +1,31 @@
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 mapAttributes from '../helpers/mapAttributes.js';
18
+
19
+ /**
20
+ * statement element
21
+ * @param {HTMLElement} htmlParentNode
22
+ * @param {Element} xmlnode
23
+ */
24
+ export default function (htmlParentNode, xmlnode) {
25
+ const figure = this.createNode('figure', '', {
26
+ 'data-ams-doc': 'statement',
27
+ });
28
+ mapAttributes(figure, xmlnode);
29
+ htmlParentNode.appendChild(figure);
30
+ this.passThrough(figure, xmlnode);
31
+ };
@@ -0,0 +1,28 @@
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
+ * string-name element
19
+ * @param {HTMLElement} htmlParentNode
20
+ * @param {Element} xmlnode
21
+ */
22
+ export default function (htmlParentNode, xmlnode) {
23
+ const span = this.createNode('span', '', {
24
+ 'data-ams-doc': 'stringname'
25
+ });
26
+ htmlParentNode.appendChild(span);
27
+ this.passThrough(span, xmlnode);
28
+ };
@@ -0,0 +1,32 @@
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 { mapColorAttributes } from '../helpers/mapColorAttributes.js';
18
+
19
+ /**
20
+ * styled-content element
21
+ * @param {HTMLElement} htmlParentNode
22
+ * @param {Element} xmlnode
23
+ */
24
+ export default function (htmlParentNode, xmlnode) {
25
+ const span = this.createNode('span', '');
26
+ // handle style-type NOTE current values: sans-serif, oblique
27
+ if (xmlnode.hasAttribute('style-type')) span.setAttribute('data-ams-style', xmlnode.getAttribute('style-type'));
28
+ // handle color attributes
29
+ mapColorAttributes(span, xmlnode);
30
+ htmlParentNode.appendChild(span);
31
+ this.passThrough(span, xmlnode);
32
+ };
@@ -0,0 +1,29 @@
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
+ };
@@ -0,0 +1,26 @@
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
+ * subject element
19
+ * @param {HTMLElement} htmlParentNode
20
+ * @param {Element} xmlnode
21
+ */
22
+ export default function (htmlParentNode, xmlnode) {
23
+ const dd = this.createNode('dd');
24
+ htmlParentNode.appendChild(dd);
25
+ this.passThrough(dd, xmlnode);
26
+ };
@@ -0,0 +1,29 @@
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 getParentLevel from '../helpers/getParentLevel.js';
18
+
19
+ /**
20
+ * subtitle element
21
+ * @param {HTMLElement} htmlParentNode
22
+ * @param {Element} xmlnode
23
+ */
24
+ export default function (htmlParentNode, xmlnode) {
25
+ // NOTE the subtitle is also touched in label.js (which creates a header as htmlParent)
26
+ const p = this.createNode('p', '', { 'data-ams-doc': 'subtitle' });
27
+ htmlParentNode.appendChild(p);
28
+ this.passThrough(p, xmlnode);
29
+ };
@@ -0,0 +1,28 @@
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
+ * table element
19
+ * @param {HTMLElement} htmlParentNode
20
+ * @param {Element} xmlnode
21
+ */
22
+ export default function (htmlParentNode, xmlnode) {
23
+ const div = this.createNode('div', '', {
24
+ 'data-ams-doc': `table-wrap`, // NOTE table-wrap (now) creates figure with same attribute value; ams-html/ams-bookhtml use this div for overflow
25
+ });
26
+ htmlParentNode.appendChild(div);
27
+ this.copyElement(div, xmlnode);
28
+ };