@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,27 @@
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('Template: @hidden', async function(t) {
22
+ t.plan(1);
23
+ const document = article;
24
+ const hiddenEl = document.querySelector('[hidden]');
25
+ t.ok(hiddenEl, 'Element with hidden attribute');
26
+ });
27
+
@@ -0,0 +1,27 @@
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('Template: @rowspan, @colspan', async function(t) {
21
+ t.plan(2);
22
+ const document = article;
23
+ const td = document.querySelector('td#tdattributes');
24
+ t.equal(td.getAttribute('colspan'), '1', 'colspan attribute');
25
+ t.equal(td.getAttribute('rowspan'), '2', 'colspan attribute');
26
+ });
27
+
@@ -0,0 +1,27 @@
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('Template: @position', async function(t) {
22
+ t.plan(1);
23
+ const document = article;
24
+ const qedboxEl = document.querySelector('[data-ams-specific-use]');
25
+ t.ok(qedboxEl, 'Element with data-ams-specific-use attribute');
26
+ });
27
+
@@ -0,0 +1,27 @@
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('Template: @style', async function(t) {
22
+ t.plan(1);
23
+ const document = article;
24
+ const style = document.querySelector('[data-ams-style]');
25
+ t.ok(style, 'Element with data-ams-style attribute');
26
+ });
27
+
@@ -0,0 +1,78 @@
1
+ {
2
+ "book": {
3
+ "identifiers": {
4
+ "AMS": {
5
+ "publKey": "series",
6
+ "volumeId": "volume",
7
+ "volumeNr": "volume"
8
+ },
9
+ "crossref": {
10
+ "doi": "doi"
11
+ },
12
+ "issn": {
13
+ "print": "issn print"
14
+ },
15
+ "isbn": {
16
+ "electronic": "isbn pdf",
17
+ "google": "isbn google pdf",
18
+ "print": "isbn print",
19
+ "epub": "isbn epub"
20
+ },
21
+ "basename": "seriesvolume"
22
+ },
23
+ "title": "title",
24
+ "subtitle": "subtitle",
25
+ "alttitle": "title"
26
+ },
27
+ "publishers": [
28
+ {
29
+ "name": "name1",
30
+ "location": "loc"
31
+ },
32
+ {
33
+ "name": "name2"
34
+ }
35
+ ],
36
+ "contributors": {
37
+ "authors": [
38
+ {
39
+ "name": "Given Sur Jr.",
40
+ "bio": "",
41
+ "affiliations": [
42
+ "aff"
43
+ ],
44
+ "emails": [
45
+ "email"
46
+ ],
47
+ "mrauth": "mrauthid",
48
+ "orcid": "orcidid",
49
+ "uri": "uri",
50
+ "byline": "comment"
51
+ }
52
+ ],
53
+ "contrib-group-type2": [
54
+ {
55
+ "name": "Given Sur",
56
+ "bio": "",
57
+ "affiliations": [],
58
+ "emails": []
59
+ }
60
+ ],
61
+ "contrib-group-type3": [
62
+ {
63
+ "name": "String Name",
64
+ "bio": "",
65
+ "affiliations": [],
66
+ "emails": [],
67
+ "byline": "comment"
68
+ }
69
+ ]
70
+ },
71
+ "permissions": {
72
+ "copyrightStatement": "Copyright 2020 American Mathematical Society"
73
+ },
74
+ "collection": {
75
+ "title": "Collection Title",
76
+ "subseries": "subseriesName"
77
+ }
78
+ }
package/test/book.xml ADDED
@@ -0,0 +1,292 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE book PUBLIC "-//NLM//DTD BITS Book Interchange DTD v1.0 20131225//EN" "BITS-book1.dtd">
3
+ <book xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:html="http://www.w3.org/1999/html">
4
+ <collection-meta>
5
+ <title-group>
6
+ <title>Collection Title</title>
7
+ </title-group>
8
+ <volume-in-collection>
9
+ <volume-number>volume</volume-number>
10
+ </volume-in-collection>
11
+ <issn publication-format="print">issn</issn>
12
+ <publisher>
13
+ <publisher-name>American Mathematical Society</publisher-name>
14
+ <publisher-loc>Providence, Rhode Island</publisher-loc>
15
+ </publisher>
16
+ <custom-meta-group>
17
+ <custom-meta>
18
+ <meta-name>subseries</meta-name>
19
+ <meta-value>subseriesName</meta-value>
20
+ </custom-meta>
21
+ </custom-meta-group>
22
+ </collection-meta>
23
+ <book-meta>
24
+ <book-id assigning-authority="AMS" book-id-type="publisher">series</book-id>
25
+ <book-id assigning-authority="AMS" book-id-type="volume_id">volume</book-id>
26
+ <book-id assigning-authority="crossref" book-id-type="doi">doi</book-id>
27
+ <book-title-group>
28
+ <book-title>title</book-title>
29
+ <subtitle>subtitle</subtitle>
30
+ </book-title-group>
31
+ <book-volume-number>volume</book-volume-number>
32
+ <publisher>
33
+ <publisher-name>name1</publisher-name>
34
+ <publisher-loc>loc</publisher-loc>
35
+ </publisher>
36
+ <publisher>
37
+ <publisher-name>name2</publisher-name>
38
+ </publisher>
39
+ <contrib-group content-type="authors">
40
+ <contrib contrib-type="author">
41
+ <contrib-id contrib-id-type="orcid">orcidid</contrib-id>
42
+ <contrib-id contrib-id-type="mrauth">mrauthid</contrib-id>
43
+ <name name-style="western">
44
+ <surname>Sur</surname>
45
+ <given-names>Given</given-names>
46
+ <suffix>Jr.</suffix>
47
+ </name>
48
+ <xref ref-type="aff" rid="aff1"/>
49
+ <email>email</email>
50
+ <uri>uri</uri>
51
+ </contrib>
52
+ <aff id="aff1">aff</aff>
53
+ <author-comment>comment</author-comment>
54
+ </contrib-group>
55
+ <contrib-group content-type="contrib-group-type2">
56
+ <contrib contrib-type="contrib-type2">
57
+ <name name-style="western">
58
+ <surname>Sur</surname>
59
+ <given-names>Given</given-names>
60
+ </name>
61
+ </contrib>
62
+ </contrib-group>
63
+ <contrib-group content-type="contrib-group-type3">
64
+ <author-comment>comment</author-comment>
65
+ <contrib contrib-type="contrib-type3">
66
+ <name name-style="given-only">
67
+ <given-names>should be ignored</given-names>
68
+ </name>
69
+ <string-name>String Name</string-name>
70
+ </contrib>
71
+ </contrib-group>
72
+ <issn publication-format="print">issn print</issn>
73
+ <isbn publication-format="electronic">isbn pdf</isbn>
74
+ <isbn publication-format="google">isbn google pdf</isbn>
75
+ <isbn publication-format="print">isbn print</isbn>
76
+ <isbn publication-format="epub">isbn epub</isbn>
77
+ <permissions>
78
+ <copyright-statement>Copyright 2020 American Mathematical Society</copyright-statement>
79
+ <copyright-year>2020</copyright-year>
80
+ <copyright-holder>American Mathematical Society</copyright-holder>
81
+ </permissions>
82
+ </book-meta>
83
+ <front-matter>
84
+ <toc id="toc">
85
+ <title-group>
86
+ <title>Contents</title>
87
+ </title-group>
88
+ <toc-entry>
89
+ <title>Chunk</title>
90
+ <nav-pointer rid="tocid1"/>
91
+ </toc-entry>
92
+ <toc-entry>
93
+ <label>2</label>
94
+ <title>Chunk</title>
95
+ <nav-pointer rid="tocid2"/>
96
+ <toc-entry>
97
+ <label>1</label>
98
+ <title>SubChunk</title>
99
+ <nav-pointer rid="tocid3"/>
100
+ <toc-entry>
101
+ <label>1</label>
102
+ <title>SubSubChunk with <xref ref-type="sec" rid="chapter" specific-use="ref">Link</xref></title>
103
+ <nav-pointer rid="tocid4"/>
104
+ </toc-entry>
105
+ </toc-entry>
106
+ </toc-entry>
107
+ <toc-entry>
108
+ <label/>
109
+ <title>Chunk with alt title</title>
110
+ <alt-title>Alt title</alt-title>
111
+ <nav-pointer rid="tocid5"/>
112
+ </toc-entry>
113
+ <toc-entry>
114
+ <title>Chunk without label but subchunk with label</title>
115
+ <nav-pointer rid="tocid6"/>
116
+ <toc-entry>
117
+ <label>1</label>
118
+ <title>SubChunk</title>
119
+ <nav-pointer rid="tocid7"/>
120
+ </toc-entry>
121
+ </toc-entry>
122
+ <toc-entry>
123
+ <label/>
124
+ <title>Chunk with contrib</title>
125
+ <contrib-group>
126
+ <contrib>
127
+ <string-name>Chapter Author</string-name>
128
+ </contrib>
129
+ </contrib-group>
130
+ <nav-pointer rid="tocid8"/>
131
+ </toc-entry>
132
+ <toc-entry>
133
+ <label/>
134
+ <title>Chunk with multiple contribs</title>
135
+ <contrib-group>
136
+ <contrib>
137
+ <string-name>Chapter Author</string-name>
138
+ </contrib>
139
+ <contrib>
140
+ <string-name>A Nother Author</string-name>
141
+ </contrib>
142
+ </contrib-group>
143
+ <nav-pointer rid="tocid9"/>
144
+ </toc-entry>
145
+ </toc>
146
+ <notes notes-type="publishers-note" specific-use="epub-opening-page">
147
+ <title>Publisher's Notice</title>
148
+ <p>Some notes.
149
+ </p>
150
+ </notes>
151
+ <preface disp-level="1" id="preface">
152
+ <book-part-meta>
153
+ <title-group>
154
+ <title>Preface</title>
155
+ </title-group>
156
+ </book-part-meta>
157
+ <named-book-part-body>
158
+ <p/>
159
+ </named-book-part-body>
160
+ </preface>
161
+ <front-matter-part id="fmlabeltitle" disp-level="1">
162
+ <label>Label</label>
163
+ <title>Title</title>
164
+ </front-matter-part>
165
+ <front-matter-part id="fmlabel" disp-level="1">
166
+ <label>Label</label>
167
+ <subtitle>Subtitle</subtitle>
168
+ </front-matter-part>
169
+ <front-matter-part id="fmtitle" disp-level="1">
170
+ <title>Title</title>
171
+ <subtitle>Subtitle</subtitle>
172
+ </front-matter-part>
173
+ </front-matter>
174
+ <book-body>
175
+ <book-part>
176
+ <body>
177
+ <sec disp-level="2" id="chapter" specific-use="chapter">
178
+ <def-list id="dlist1" content-type="itemize" html:style="list-style-type: disc">
179
+ <def-item id="ditem1">
180
+ <term>•</term> <def><p>Item 1</p></def>
181
+ </def-item>
182
+ </def-list>
183
+ <p id="pwithx">Is <x>not</x> ignored.</p>
184
+ </sec>
185
+ <sec disp-level="1" id="chapter2" specific-use="chapter">
186
+ <sec id="ack3" disp-level="2" specific-use="section">
187
+ <title>Acknowledg</title>
188
+ </sec>
189
+ <sec id="intro2" disp-level="2" specific-use="section">
190
+ <title>Introduction</title>
191
+ </sec>
192
+ <sec id="seclabeltitle" disp-level="2" specific-use="section">
193
+ <label>Label</label>
194
+ <title>Title</title>
195
+ </sec>
196
+ <sec id="seclabel" disp-level="2" specific-use="section">
197
+ <label>Label</label>
198
+ </sec>
199
+ <sec id="sectitle" disp-level="2" specific-use="section">
200
+ <title>Title</title>
201
+ </sec>
202
+ </sec>
203
+ <sec id="part" disp-level="1" specific-use="part">
204
+ <sec disp-level="2" specific-use="chapter">
205
+ <sec id="inparttitle" disp-level="3" specific-use="section">
206
+ <title>Title</title>
207
+ </sec>
208
+ <sec id="inpartlabel" disp-level="3" specific-use="section">
209
+ <label>Label</label>
210
+ </sec>
211
+ </sec>
212
+ </sec>
213
+
214
+ <!-- NOTE sec-meta special treatment (see notes in code and tests)-->
215
+ <sec disp-level="1" id="secmeta" specific-use="chapter">
216
+ <title>Title</title>
217
+ <sec-meta>
218
+ <contrib-group>
219
+ <!-- NOTE: this contrib-group example is for MCL 1, 14 only; intentionally broken via #254 -->
220
+ <author-comment>
221
+ comment
222
+ </author-comment>
223
+ </contrib-group>
224
+ <abstract>
225
+ <title>Abstract</title>
226
+ </abstract>
227
+ </sec-meta>
228
+ </sec>
229
+
230
+ <!-- statement etc -->
231
+ <sec disp-level="1" id="statementchapter" specific-use="chapter">
232
+ <statement content-type="content type" id="statement2" style="style">
233
+ <label>Theorem 1</label>
234
+ <p></p>
235
+ </statement>
236
+ </sec>
237
+ <sec disp-level="1" id="statementpart" specific-use="part">
238
+ <sec disp-level="2" id="statementpartchapter" specific-use="chapter">
239
+ <sec disp-level="3" id="statementsection" specific-use="section">
240
+ <statement content-type="content type" id="statement4" style="style">
241
+ <label>Theorem 1</label>
242
+ <p></p>
243
+ </statement>
244
+ </sec>
245
+ </sec>
246
+ </sec>
247
+
248
+ <!-- statement etc -->
249
+ <sec disp-level="1" id="reflistchapter" specific-use="chapter">
250
+ <ref-list id="chapterreflist">
251
+ <title>title</title>
252
+ </ref-list>
253
+ </sec>
254
+
255
+ <!-- alt-title -->
256
+ <sec disp-level="1" id="alttitle" specific-use="chapter">
257
+ <label>Label</label>
258
+ <title>Title</title>
259
+ <alt-title>Alt title</alt-title>
260
+ </sec>
261
+ <!-- simpletabbing -->
262
+ <sec disp-level="1" id="tabbing" specific-use="chapter">
263
+ <title>Tabbing</title>
264
+ <simpletabbing id="simpletabbing">
265
+ <line id="simpletabbing-line">Line</line>
266
+ <line indent="1">Indented line.</line>
267
+ </simpletabbing>
268
+ </sec>
269
+ </body>
270
+ </book-part>
271
+ </book-body>
272
+ <book-back>
273
+ <book-app-group id="book-app-group">
274
+ <book-app id="applabeltitle" disp-level="1" specific-use="chapter">
275
+ <label>Label</label>
276
+ <title>Title</title>
277
+ </book-app>
278
+ <book-app id="applabel" disp-level="1" specific-use="chapter">
279
+ <label>Label</label>
280
+ </book-app>
281
+ <book-app id="apptitle" disp-level="1" specific-use="chapter">
282
+ <title>Title</title>
283
+ </book-app>
284
+ </book-app-group>
285
+ <ref-list id="reflist">
286
+ <title>title</title>
287
+ </ref-list>
288
+ <ack id="ack1" disp-level="1">
289
+ <title/>
290
+ </ack>
291
+ </book-back>
292
+ </book>
@@ -0,0 +1,38 @@
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('"copied" elements', async function(t) {
21
+ const copyElements = [
22
+ 'sup',
23
+ 'sub',
24
+ 'table',
25
+ 'tbody',
26
+ 'thead',
27
+ 'th',
28
+ 'tr',
29
+ 'td',
30
+ 'pre',
31
+ 'hr'
32
+ ];
33
+ t.plan(copyElements.length);
34
+ const document = article;
35
+ copyElements.forEach(selector =>
36
+ t.ok(document.querySelector(selector), `${selector} copied to output`)
37
+ );
38
+ });
@@ -0,0 +1,27 @@
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('abstract, abstract/title', async function(t) {
22
+ t.plan(2);
23
+ const document = article;
24
+ const abstract = document.querySelector('section[data-ams-doc-level="1"][role="doc-abstract"]');
25
+ t.ok(abstract, 'Abstract as Section with data-ams-doc-level 1, role doc-abstract');
26
+ t.ok(abstract.querySelector('h2'), 'Abstract title as h2');
27
+ });
@@ -0,0 +1,56 @@
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
+ import { article } from './helper.js';
19
+ import tape from 'tape';
20
+
21
+
22
+ tape('Element: alg:* elements', async function (t) {
23
+ t.plan(14);
24
+ const document = article;
25
+ // alg:algorithm
26
+ const algorithm = document.querySelector('alg-algorithm');
27
+ t.ok(algorithm, 'alg-algorithm element');
28
+ t.equal(algorithm.getAttribute('data-ams-alg-linenodelimiter'), ':', 'alg-algorithm element');
29
+ // alg:line
30
+ const algLines = document.querySelectorAll('alg-line');
31
+ t.equal(algLines[0].previousElementSibling.tagName, 'ALG-LINENO', 'alg-line preceded by alg-lineno');
32
+ t.equal(algLines[0].previousElementSibling.innerHTML, '', 'alg-line with empty line number');
33
+ t.ok(algLines[0].hasAttribute('data-ams-alg-spanslineno'), 'alg-line with data-ams-alg-spanslineno');
34
+ t.equal(algLines[3].previousElementSibling.innerHTML, '3:', 'alg-line with proper line number');
35
+ // alg:statement
36
+ const algStatement = document.querySelector('alg-statement');
37
+ t.ok(algStatement, 'alg:statement');
38
+ // alg:algComment
39
+ const algComment = document.querySelector('alg-comment');
40
+ t.ok(algComment, 'alg:comment');
41
+ // alg:block
42
+ const algBlock = document.querySelector('alg-block');
43
+ t.equal(algBlock.getAttribute('data-ams-alg-blocklevel'), '1', 'alg:block data-ams-alg-blocklevel');
44
+ const algBlockNested = document.querySelector('alg-block > alg-block');
45
+ t.equal(algBlockNested.getAttribute('data-ams-alg-blocklevel'), '2', 'Nested alg:block data-ams-alg-blocklevel');
46
+ // pass-through elements
47
+ const cond = [...algorithm.querySelectorAll('alg-line > alg-statement')].find(node => node.textContent.trim() === 'if condition then');
48
+ t.ok(cond, 'alg:condition (and thus alg:if) pass through');
49
+ const fr = [...algorithm.querySelectorAll('alg-line > alg-statement > *:first-of-type')].find(node => node.textContent === 'for');
50
+ t.ok(fr, 'alg:for pass through');
51
+ const func = [...algorithm.querySelectorAll('alg-line > alg-statement > *:first-of-type')].find(node => node.textContent === 'Function');
52
+ t.ok(func, 'alg:function pass through');
53
+ const proc = [...algorithm.querySelectorAll('alg-line > alg-statement > *:first-of-type')].find(node => node.textContent === 'Procedure');
54
+ t.ok(proc, 'alg:procedure pass through');
55
+ });
56
+
@@ -0,0 +1,24 @@
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, articleAlttitle } from './helper.js';
18
+ import tape from 'tape';
19
+
20
+ tape('Template: article', async function(t) {
21
+ t.plan(1);
22
+ const document = article;
23
+ t.ok(document.querySelector('section[data-ams-doc="article"]'));
24
+ });
@@ -0,0 +1,27 @@
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
+ import { article } from './helper.js';
19
+ import tape from 'tape';
20
+
21
+
22
+ tape('Fig with attrib', async function(t) {
23
+ t.plan(1);
24
+ const document = article;
25
+ t.ok(document.querySelector('figure#figattrib figcaption span'), 'attrib in figcaption');
26
+ });
27
+