@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.
- package/CHANGELOG.md +1414 -0
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +16 -0
- package/examples/cli.js +6 -0
- package/ldom.js +6 -0
- package/lib/doms.js +30 -0
- package/lib/elements/abstract.js +34 -0
- package/lib/elements/algorithm.js +78 -0
- package/lib/elements/app.js +35 -0
- package/lib/elements/article-metadata-json.js +167 -0
- package/lib/elements/article-title.js +26 -0
- package/lib/elements/article.js +28 -0
- package/lib/elements/attrib.js +41 -0
- package/lib/elements/bold.js +32 -0
- package/lib/elements/book-meta-json.js +134 -0
- package/lib/elements/book-meta.js +33 -0
- package/lib/elements/book-title.js +26 -0
- package/lib/elements/boxed-text.js +31 -0
- package/lib/elements/break.js +25 -0
- package/lib/elements/caption.js +52 -0
- package/lib/elements/compound-kwd.js +27 -0
- package/lib/elements/def-item.js +26 -0
- package/lib/elements/def-list.js +30 -0
- package/lib/elements/def.js +29 -0
- package/lib/elements/disp-formula-group.js +30 -0
- package/lib/elements/disp-quote.js +33 -0
- package/lib/elements/email.js +28 -0
- package/lib/elements/ext-link.js +38 -0
- package/lib/elements/fig.js +32 -0
- package/lib/elements/fn.js +42 -0
- package/lib/elements/formula.js +51 -0
- package/lib/elements/front.js +64 -0
- package/lib/elements/funding-group.js +26 -0
- package/lib/elements/graphic.js +49 -0
- package/lib/elements/img.js +28 -0
- package/lib/elements/italic.js +33 -0
- package/lib/elements/kwd-group.js +29 -0
- package/lib/elements/kwd.js +26 -0
- package/lib/elements/label.js +101 -0
- package/lib/elements/line.js +31 -0
- package/lib/elements/meta-name.js +29 -0
- package/lib/elements/meta-value.js +27 -0
- package/lib/elements/mixed-citation.js +35 -0
- package/lib/elements/monospace.js +35 -0
- package/lib/elements/notes.js +36 -0
- package/lib/elements/p.js +29 -0
- package/lib/elements/preface.js +33 -0
- package/lib/elements/ref-list.js +50 -0
- package/lib/elements/ref.js +28 -0
- package/lib/elements/roman.js +34 -0
- package/lib/elements/sans-serif.js +34 -0
- package/lib/elements/sc.js +35 -0
- package/lib/elements/sec-meta.js +35 -0
- package/lib/elements/sec.js +89 -0
- package/lib/elements/secheading.js +43 -0
- package/lib/elements/simpletabbing.js +29 -0
- package/lib/elements/statement.js +31 -0
- package/lib/elements/string-name.js +28 -0
- package/lib/elements/styled-content.js +32 -0
- package/lib/elements/subj-group.js +29 -0
- package/lib/elements/subject.js +26 -0
- package/lib/elements/subtitle.js +29 -0
- package/lib/elements/table.js +28 -0
- package/lib/elements/tag.js +50 -0
- package/lib/elements/target.js +39 -0
- package/lib/elements/term.js +31 -0
- package/lib/elements/tex-math.js +34 -0
- package/lib/elements/text.js +29 -0
- package/lib/elements/toc-entry.js +63 -0
- package/lib/elements/toc.js +35 -0
- package/lib/elements/underline.js +26 -0
- package/lib/elements/x.js +27 -0
- package/lib/elements/xref-group.js +36 -0
- package/lib/elements/xref.js +89 -0
- package/lib/hacks.js +43 -0
- package/lib/head.js +38 -0
- package/lib/helpers/copyElement.js +29 -0
- package/lib/helpers/extractContribGroups.js +94 -0
- package/lib/helpers/generateByline.js +35 -0
- package/lib/helpers/getParentLevel.js +24 -0
- package/lib/helpers/helpers-tex.js +54 -0
- package/lib/helpers/mapAttributes.js +54 -0
- package/lib/helpers/mapColorAttributes.js +36 -0
- package/lib/helpers/unnest.js +34 -0
- package/lib/transformer.js +311 -0
- package/out.html +550 -0
- package/package.json +39 -0
- package/test/article--alttitle.xml +146 -0
- package/test/article--nometa.xml +40 -0
- package/test/article-alttitle-meta-snapshot.json +94 -0
- package/test/article-meta-snapshot.json +129 -0
- package/test/article-nometa-meta-snapshot.json +46 -0
- package/test/article.xml +593 -0
- package/test/attribute-content-type.js +26 -0
- package/test/attribute-has-qed-box.js +28 -0
- package/test/attribute-hidden.js +27 -0
- package/test/attribute-rowspan-colspan.js +27 -0
- package/test/attribute-specific-use.js +27 -0
- package/test/attribute-style.js +27 -0
- package/test/book-meta-snapshot.json +78 -0
- package/test/book.xml +292 -0
- package/test/copyElement.js +38 -0
- package/test/element-abstract-title.js +27 -0
- package/test/element-algorithm.js +56 -0
- package/test/element-article.js +24 -0
- package/test/element-attrib.js +27 -0
- package/test/element-back-app-group-app.js +28 -0
- package/test/element-bold.js +26 -0
- package/test/element-book-meta.js +37 -0
- package/test/element-book-preface.js +29 -0
- package/test/element-book-ref-list.js +32 -0
- package/test/element-book.js +33 -0
- package/test/element-boxed-text.js +28 -0
- package/test/element-break.js +27 -0
- package/test/element-citegroup.js +25 -0
- package/test/element-compound-kwd.js +24 -0
- package/test/element-def-list-def-item-def-term.js +43 -0
- package/test/element-disp-formula-group.js +27 -0
- package/test/element-disp-quote.js +31 -0
- package/test/element-email.js +26 -0
- package/test/element-ext-link.js +30 -0
- package/test/element-fig-subfig-label.js +38 -0
- package/test/element-fn.js +40 -0
- package/test/element-front.js +45 -0
- package/test/element-funding-group.js +29 -0
- package/test/element-graphic-inline-graphic.js +40 -0
- package/test/element-img.js +30 -0
- package/test/element-inline-formula-disp-formula-tex-math.js +91 -0
- package/test/element-italic.js +28 -0
- package/test/element-kwd-group.js +28 -0
- package/test/element-kwd.js +27 -0
- package/test/element-mixed-citation.js +32 -0
- package/test/element-monospace.js +27 -0
- package/test/element-notes.js +42 -0
- package/test/element-p-p.js +27 -0
- package/test/element-ref-list-ref-label.js +40 -0
- package/test/element-roman.js +27 -0
- package/test/element-sans-serif.js +27 -0
- package/test/element-sc.js +27 -0
- package/test/element-sec-app-front-matter-part-dedication-title-label.js +87 -0
- package/test/element-sec-meta.js +43 -0
- package/test/element-secheading.js +28 -0
- package/test/element-simpletabbing-line.js +31 -0
- package/test/element-statement-label-title.js +120 -0
- package/test/element-string-name.js +27 -0
- package/test/element-stripEmptyLabel.js +26 -0
- package/test/element-styled-content.js +28 -0
- package/test/element-subtitle.js +36 -0
- package/test/element-table-wrap-group.js +30 -0
- package/test/element-table-wrap.js +51 -0
- package/test/element-table.js +34 -0
- package/test/element-tag.js +38 -0
- package/test/element-target.js +33 -0
- package/test/element-toc-toc-entry.js +77 -0
- package/test/element-underline.js +27 -0
- package/test/element-verse-group.js +28 -0
- package/test/element-x.js +30 -0
- package/test/element-xref-group.js +26 -0
- package/test/element-xref.js +32 -0
- package/test/hacks.js +37 -0
- package/test/helper-mapColorAttributes.js +27 -0
- package/test/helper.js +26 -0
- package/test/setHead.js +32 -0
- package/test/unit/abstract.js +35 -0
- package/texml-to-html.js +32 -0
|
@@ -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
|
+
|
|
18
|
+
import { book } from './helper.js';
|
|
19
|
+
import tape from 'tape';
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
tape('Template: simpletabbing, line', async function(t) {
|
|
23
|
+
t.plan(4);
|
|
24
|
+
const document = book;
|
|
25
|
+
const tabbing = document.querySelector('section#simpletabbing');
|
|
26
|
+
t.equal(tabbing.getAttribute('data-ams-doc'), 'simpletabbing', 'Tabbing as section with data-ams-doc attribute');
|
|
27
|
+
const lines = document.querySelectorAll('section#simpletabbing > p');
|
|
28
|
+
t.equal(lines[0].getAttribute('data-ams-doc'), 'line', 'Line as p with data-ams-doc');
|
|
29
|
+
t.equal(lines[0].id, 'simpletabbing-line', 'Line id preserved');
|
|
30
|
+
t.equal(lines[1].getAttribute('data-ams-indent'), '1', 'Line with indent s data-ams-indent');
|
|
31
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
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, book } from './helper.js';
|
|
18
|
+
import tape from 'tape';
|
|
19
|
+
|
|
20
|
+
tape('Template: statement, label, title', async function(t) {
|
|
21
|
+
t.plan(20);
|
|
22
|
+
const document = article;
|
|
23
|
+
|
|
24
|
+
const statement1 = document.querySelector(
|
|
25
|
+
'figure[data-ams-doc="statement"]#statement1'
|
|
26
|
+
);
|
|
27
|
+
t.ok(statement1, 'statement as section with data-ams-doc');
|
|
28
|
+
const statement1Heading = statement1.querySelector('figcaption');
|
|
29
|
+
t.ok(statement1Heading, 'statement heading level in article');
|
|
30
|
+
t.equal(
|
|
31
|
+
statement1Heading.innerHTML,
|
|
32
|
+
'<span data-ams-doc="label">Label 1 </span>Title 1. ',
|
|
33
|
+
'statement with label+title creates space before and period after title'
|
|
34
|
+
);
|
|
35
|
+
const statement2 = document.querySelector(
|
|
36
|
+
'figure[data-ams-doc="statement"]#statement2'
|
|
37
|
+
);
|
|
38
|
+
t.ok(statement2, 'statement 2');
|
|
39
|
+
t.equal(
|
|
40
|
+
statement2.querySelector('figcaption').innerHTML,
|
|
41
|
+
'Label 2. ',
|
|
42
|
+
'statement with label creates period after'
|
|
43
|
+
);
|
|
44
|
+
const statement3 = document.querySelector(
|
|
45
|
+
'figure[data-ams-doc="statement"]#statement3'
|
|
46
|
+
);
|
|
47
|
+
t.ok(statement3, 'statement 3');
|
|
48
|
+
t.equal(
|
|
49
|
+
statement3.querySelector('figcaption').innerHTML,
|
|
50
|
+
'Title 3. ',
|
|
51
|
+
'statement with title creates period after'
|
|
52
|
+
);
|
|
53
|
+
const statementTitlePeriod = document.querySelector(
|
|
54
|
+
'figure[data-ams-doc="statement"]#statement-title-period'
|
|
55
|
+
);
|
|
56
|
+
t.equal(
|
|
57
|
+
statementTitlePeriod.querySelector('figcaption').innerHTML,
|
|
58
|
+
'Title 4. ',
|
|
59
|
+
'statement with title with period does not have extra period after'
|
|
60
|
+
);
|
|
61
|
+
const statement4 = document.querySelector(
|
|
62
|
+
'figure[data-ams-doc="statement"]#statement4'
|
|
63
|
+
);
|
|
64
|
+
t.ok(statement4, 'statement 4');
|
|
65
|
+
t.equal(
|
|
66
|
+
statement4.querySelector('figcaption').innerHTML,
|
|
67
|
+
'Proof. ',
|
|
68
|
+
'title in proof statement now also gets extra period'
|
|
69
|
+
);
|
|
70
|
+
const statement5 = document.querySelector(
|
|
71
|
+
'figure[data-ams-doc="statement"]#statement5'
|
|
72
|
+
);
|
|
73
|
+
t.ok(statement5, 'statement 5');
|
|
74
|
+
t.equal(
|
|
75
|
+
statement5.querySelector('figcaption').innerHTML,
|
|
76
|
+
'<span data-ams-doc="label">Label 5 </span>Proof. ',
|
|
77
|
+
'proof statement with label+title'
|
|
78
|
+
);
|
|
79
|
+
t.equal(
|
|
80
|
+
statement5.querySelector('[data-ams-doc="secheading"]').innerHTML,
|
|
81
|
+
'secheading',
|
|
82
|
+
'secheading with label within statement'
|
|
83
|
+
);
|
|
84
|
+
const statement6 = document.querySelector(
|
|
85
|
+
'figure[data-ams-doc="statement"]#statement6'
|
|
86
|
+
);
|
|
87
|
+
t.ok(statement6, 'statement 6');
|
|
88
|
+
t.equal(
|
|
89
|
+
statement6.querySelector('[data-ams-doc="secheading"]').innerHTML,
|
|
90
|
+
'Label 6. secheading',
|
|
91
|
+
'secheading with title+label within statement'
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const statement7 = document.querySelector(
|
|
95
|
+
'figure[data-ams-doc="statement"]#statement7'
|
|
96
|
+
);
|
|
97
|
+
const statement8 = statement7.querySelector(
|
|
98
|
+
' #statement8'
|
|
99
|
+
);
|
|
100
|
+
t.equal(
|
|
101
|
+
statement8.getAttribute('data-ams-doc-level'), statement7.getAttribute('data-ams-doc-level'),
|
|
102
|
+
'nested statement does not increase data-ams-doc-level'
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
const document2 = book;
|
|
106
|
+
const statement2_1 = document2.querySelector(
|
|
107
|
+
'figure[data-ams-doc="statement"]#statement2'
|
|
108
|
+
);
|
|
109
|
+
t.ok(statement2_1, 'statement as section with data-ams-doc');
|
|
110
|
+
t.ok(statement2_1.querySelector('figcaption'), 'statement heading level in book');
|
|
111
|
+
|
|
112
|
+
const statement_part = document2.querySelector(
|
|
113
|
+
'figure[data-ams-doc="statement"]#statement4'
|
|
114
|
+
);
|
|
115
|
+
t.ok(statement_part, 'statement as section with data-ams-doc');
|
|
116
|
+
t.ok(
|
|
117
|
+
statement_part.querySelector('figcaption'),
|
|
118
|
+
'statement heading level in part (in book)'
|
|
119
|
+
);
|
|
120
|
+
});
|
|
@@ -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: string-name', async function(t) {
|
|
22
|
+
t.plan(1);
|
|
23
|
+
const document = article;
|
|
24
|
+
const span = document.querySelector('span[data-ams-doc="stringname"]');
|
|
25
|
+
t.ok(span, 'stringname', 'Stringname data-ams-doc attribute');
|
|
26
|
+
});
|
|
27
|
+
|
|
@@ -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
|
+
import { article } from './helper.js';
|
|
19
|
+
import tape from 'tape';
|
|
20
|
+
|
|
21
|
+
tape('Empty Labels should be stripped', async function(t) {
|
|
22
|
+
t.plan(2);
|
|
23
|
+
const document = article;
|
|
24
|
+
t.equal(document.querySelector('#emptyLabel').innerHTML.trim(), '', 'Statement with no title and empty label');
|
|
25
|
+
t.equal(document.querySelector('#titleEmptyLabel').innerHTML.trim(), '<figcaption>Title. </figcaption>', 'Statement with no title and empty label');
|
|
26
|
+
});
|
|
@@ -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
|
+
import { article } from './helper.js';
|
|
19
|
+
import tape from 'tape';
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
tape('Template: styled-content', async function(t) {
|
|
23
|
+
t.plan(2);
|
|
24
|
+
const document = article;
|
|
25
|
+
t.ok(document.querySelector('span[data-ams-style="type"]'), 'Styled-content as span with data-ams-style');
|
|
26
|
+
t.ok(document.querySelector('span[data-ams-style-color]').getAttribute('data-ams-style-color'), 'Styled-content as span with data-ams-style'); // NOTE just check existence; correctness tested in helper-mapsColorAttributes
|
|
27
|
+
});
|
|
28
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
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, articleAlttitle } from './helper.js';
|
|
19
|
+
import tape from 'tape';
|
|
20
|
+
|
|
21
|
+
tape('subtitle', async function (t) {
|
|
22
|
+
t.plan(3);
|
|
23
|
+
const document = article;
|
|
24
|
+
|
|
25
|
+
const subtitle = document.querySelector('p[data-ams-doc="subtitle"]');
|
|
26
|
+
t.ok(subtitle, 'section subtitle to p with data-ams-doc');
|
|
27
|
+
|
|
28
|
+
const document2 = articleAlttitle;
|
|
29
|
+
const articleSubtitle = document2.querySelector('p[data-ams-doc="subtitle"]');
|
|
30
|
+
t.equal(
|
|
31
|
+
articleSubtitle.previousElementSibling.tagName, 'H1',
|
|
32
|
+
'article-level subtitle in content follows title'
|
|
33
|
+
);
|
|
34
|
+
const jsonData = JSON.parse(document2.querySelector('script[type="application/json"]').textContent);
|
|
35
|
+
t.equal(jsonData.subtitle, articleSubtitle.innerHTML, 'article-level subtitle in metadata matches in content');
|
|
36
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
tape('table-wrap-group element', async function (t) {
|
|
22
|
+
t.plan(3);
|
|
23
|
+
const document = article;
|
|
24
|
+
const tableWrapGroup = document.querySelector('figure[data-ams-doc="table-wrap-group"]');
|
|
25
|
+
t.ok(tableWrapGroup, 'table-wrap element as figure');
|
|
26
|
+
t.equal(tableWrapGroup.querySelector('figcaption > strong').innerHTML, 'Table with subtables. ', 'table-wrap-group caption');
|
|
27
|
+
t.equal(
|
|
28
|
+
tableWrapGroup.querySelector('figure[data-ams-doc="table-wrap"] > figcaption > strong').innerHTML, '(a) ', 'table-wrap label'
|
|
29
|
+
);
|
|
30
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
tape('table-wrap element', async function (t) {
|
|
22
|
+
t.plan(6);
|
|
23
|
+
const document = article;
|
|
24
|
+
const tableWrap = document.querySelector('figure[data-ams-doc="table-wrap"]');
|
|
25
|
+
t.ok(
|
|
26
|
+
tableWrap,
|
|
27
|
+
`table-wrap element as figure`
|
|
28
|
+
);
|
|
29
|
+
const tableCaption = tableWrap.querySelector('figcaption');
|
|
30
|
+
t.ok(
|
|
31
|
+
tableCaption,
|
|
32
|
+
`table caption as figcaption`
|
|
33
|
+
);
|
|
34
|
+
t.equal(
|
|
35
|
+
tableWrap.firstElementChild, tableCaption,
|
|
36
|
+
`first child of table is table caption `
|
|
37
|
+
);
|
|
38
|
+
const tableLabel = tableCaption.querySelector('strong')
|
|
39
|
+
t.ok(
|
|
40
|
+
tableLabel,
|
|
41
|
+
`table label in caption as strong element`
|
|
42
|
+
);
|
|
43
|
+
t.equal(
|
|
44
|
+
tableCaption.firstChild, tableLabel,
|
|
45
|
+
`first child of table caption is table label`
|
|
46
|
+
);
|
|
47
|
+
t.equal(
|
|
48
|
+
tableLabel.innerHTML, 'Table 1. ',
|
|
49
|
+
`first child of table caption is table label`
|
|
50
|
+
);
|
|
51
|
+
});
|
|
@@ -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
|
+
|
|
18
|
+
import { article } from './helper.js';
|
|
19
|
+
import tape from 'tape';
|
|
20
|
+
|
|
21
|
+
tape('table element', async function (t) {
|
|
22
|
+
t.plan(2);
|
|
23
|
+
const document = article;
|
|
24
|
+
// NOTE <table> is tested in test/copyElement.js
|
|
25
|
+
t.ok(
|
|
26
|
+
document.querySelector('div[data-ams-doc="table-wrap"] > table'),
|
|
27
|
+
`Table has wrapper`
|
|
28
|
+
);
|
|
29
|
+
t.ok(
|
|
30
|
+
document.querySelector('table[class="tbl"]'),
|
|
31
|
+
`Table has class attributes`
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
});
|
|
@@ -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
|
+
|
|
18
|
+
import { article } from './helper.js';
|
|
19
|
+
import tape from 'tape';
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
tape('Template: tag', async function (t) {
|
|
23
|
+
t.plan(4);
|
|
24
|
+
const document = article;
|
|
25
|
+
|
|
26
|
+
const equationsBlock = [...document.querySelectorAll('[data-ams-doc="math block"] > tex-math')];
|
|
27
|
+
|
|
28
|
+
t.ok(equationsBlock.find(node => node.innerHTML === '\\cssId{targetMath}{_\\tag{$x$}}'), 'Tag with tex-math');
|
|
29
|
+
|
|
30
|
+
const tagStar = equationsBlock.find(node => node.innerHTML === '\\tag*{tag*}')
|
|
31
|
+
t.ok(tagStar, 'Tag with parens="no"');
|
|
32
|
+
|
|
33
|
+
// tag extraction
|
|
34
|
+
t.notOk(tagStar.hasAttribute('data-ams-tags'), 'No extracted tags if none are linked to');
|
|
35
|
+
t.equal(equationsBlock.find(node => node.innerHTML === '\\tag{PlainTag}\\cssId{targetMath2}{\\tag{$\\mathbb{N}$}}\\cssId{targetMath3}{\\tag{TextTag}}').getAttribute('data-ams-tags'), '["PlainTag","$\\\\mathbb{N}$","TextTag"]', 'All tags stored in attribute if one was linked to');
|
|
36
|
+
|
|
37
|
+
});
|
|
38
|
+
|
|
@@ -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
|
+
|
|
18
|
+
import { article } from './helper.js';
|
|
19
|
+
import tape from 'tape';
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
tape('Template: target', async function(t) {
|
|
23
|
+
t.plan(2);
|
|
24
|
+
const document = article;
|
|
25
|
+
const targetSpan = document.querySelector('section[data-ams-doc="article"] span#target');
|
|
26
|
+
t.ok(targetSpan, 'Convert to span inside article');
|
|
27
|
+
|
|
28
|
+
// target in tex-math
|
|
29
|
+
const equationsBlock = [...document.querySelectorAll('[data-ams-doc="math block"]>tex-math')];
|
|
30
|
+
t.ok(equationsBlock.find(node => node.innerHTML === '\\cssId{targetMath}{_\\tag{$x$}}'), 'Convert to \\cssId inside tex-math');
|
|
31
|
+
|
|
32
|
+
});
|
|
33
|
+
|
|
@@ -0,0 +1,77 @@
|
|
|
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 { book } from './helper.js';
|
|
18
|
+
import tape from 'tape';
|
|
19
|
+
|
|
20
|
+
tape('Template: (book) toc, toc-entry', async function(t) {
|
|
21
|
+
t.plan(14);
|
|
22
|
+
const document = book;
|
|
23
|
+
|
|
24
|
+
const toc = document.querySelector('nav[role="doc-toc"]#toc');
|
|
25
|
+
t.ok(toc, 'toc: wrapping nav element with role=doc-toc and id');
|
|
26
|
+
const title = document.querySelector('nav[role="doc-toc"] h1'); // NOTE xslt will have nav>h1, JS will have nav>header>h1
|
|
27
|
+
t.ok(title, 'toc: title-group passthrough, title becomes heading');
|
|
28
|
+
const list = toc.querySelector('ol');
|
|
29
|
+
t.ok(list, 'toc: ordered list');
|
|
30
|
+
t.equal(list.children.length, 6, 'Nested toc-entries remain nested')
|
|
31
|
+
t.equal(
|
|
32
|
+
list.querySelector('li a[href="#tocid1"]').innerHTML,
|
|
33
|
+
'Chunk',
|
|
34
|
+
'toc-entry and nav-pointer'
|
|
35
|
+
);
|
|
36
|
+
t.equal(
|
|
37
|
+
list.querySelector('li a[href="#tocid2"]').innerHTML,
|
|
38
|
+
'2. Chunk',
|
|
39
|
+
'toc-entry, label, nav-pointer'
|
|
40
|
+
);
|
|
41
|
+
t.equal(list.querySelector('ol').children.length, 1, 'Doubly nested toc-entries remain nested');
|
|
42
|
+
t.equal(
|
|
43
|
+
list.querySelector('li a[href="#tocid2"]+ol li a[href="#tocid3"]').innerHTML,
|
|
44
|
+
'1. SubChunk',
|
|
45
|
+
'Nested toc-entry, label, nav-pointer'
|
|
46
|
+
);
|
|
47
|
+
t.equal(
|
|
48
|
+
list.querySelector('li a[href="#tocid4"]').innerHTML,
|
|
49
|
+
'1. SubSubChunk with Link',
|
|
50
|
+
'toc-entry with xref in title'
|
|
51
|
+
);
|
|
52
|
+
t.equal(
|
|
53
|
+
list.querySelector('li a[href="#tocid5"]').innerHTML,
|
|
54
|
+
'Chunk with alt title',
|
|
55
|
+
'toc-entry with alt-title: content'
|
|
56
|
+
);
|
|
57
|
+
t.equal(
|
|
58
|
+
list.querySelector('li a[href="#tocid5"]').getAttribute('data-ams-doc-alttitle'),
|
|
59
|
+
'Alt title',
|
|
60
|
+
'toc-entry with alt-title: data-ams-doc-alttitle'
|
|
61
|
+
);
|
|
62
|
+
t.equal(
|
|
63
|
+
list.querySelector('li a[href="#tocid6"]').innerHTML,
|
|
64
|
+
'Chunk without label but subchunk with label',
|
|
65
|
+
'toc-entry without label but sub-entry with label'
|
|
66
|
+
);
|
|
67
|
+
t.equal(
|
|
68
|
+
list.querySelector('li a[href="#tocid8"]+br+em').innerHTML,
|
|
69
|
+
'Chapter Author',
|
|
70
|
+
'toc-entry with contributor'
|
|
71
|
+
);
|
|
72
|
+
t.equal(
|
|
73
|
+
list.querySelector('li a[href="#tocid9"]+br+em+em').innerHTML,
|
|
74
|
+
'A Nother Author',
|
|
75
|
+
'toc-entry with contributors'
|
|
76
|
+
);
|
|
77
|
+
});
|
|
@@ -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('Template: underline', async function(t) {
|
|
23
|
+
t.plan(1);
|
|
24
|
+
const document = article;
|
|
25
|
+
t.ok(document.querySelector('u'), 'Underline u element');
|
|
26
|
+
});
|
|
27
|
+
|
|
@@ -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
|
+
import { article } from './helper.js';
|
|
19
|
+
import tape from 'tape';
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
tape('Template: verse-group', async function(t) {
|
|
23
|
+
t.plan(1);
|
|
24
|
+
const document = article;
|
|
25
|
+
const figure = document.querySelector('figure[data-ams-doc="verse-group"]');
|
|
26
|
+
t.ok(figure, 'Figure data-ams-doc=verse-group attribute');
|
|
27
|
+
});
|
|
28
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
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, book } from './helper.js';
|
|
19
|
+
import tape from 'tape';
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
tape('Template: x', async function(t) {
|
|
23
|
+
t.plan(4);
|
|
24
|
+
const document = article;
|
|
25
|
+
t.equal(document.querySelector('a[href="#rid5"][data-ams-ref="type"]').innerHTML, 'Context ref', 'xref with generic type with x child preserved');
|
|
26
|
+
t.equal(document.querySelector('cite a[href="#rid4"][data-ams-ref="bibr"][role="doc-biblioref"]').innerHTML, 'ref, note', 'xref with ref-type bibr with x child preserve');
|
|
27
|
+
t.equal(document.querySelector('p#pwithx').innerHTML, 'Is ignored.', 'x in article is ignored');
|
|
28
|
+
const document2 = book;
|
|
29
|
+
t.equal(document2.querySelector('p#pwithx').innerHTML, 'Is not ignored.', 'x in book is preserved');
|
|
30
|
+
});
|
|
@@ -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
|
+
import { article } from './helper.js';
|
|
19
|
+
import tape from 'tape';
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
tape('Template: xref-group', async function (t) {
|
|
23
|
+
t.plan(1);
|
|
24
|
+
const xrefGroup = article.querySelector('#xrefgroup [data-ams-doc="refgroup"]');
|
|
25
|
+
t.equal(xrefGroup.outerHTML, '<span data-ams-refrange="xrefgroup2 xrefgroup3" data-ams-ref="grp" data-ams-doc="refgroup"><a data-ams-ref="grp" href="#xrefgroup1">2</a>–<a data-ams-ref="grp" href="#xrefgroup4">5</a></span>', 'xrefgroup snapshot test')
|
|
26
|
+
});
|