@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,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: back/app-group, back/app-group/app', async function(t) {
|
|
23
|
+
t.plan(1);
|
|
24
|
+
const document = article;
|
|
25
|
+
const app = document.querySelector('section[role="doc-appendix"][data-ams-doc-level="1"]');
|
|
26
|
+
t.ok(app, 'app element');
|
|
27
|
+
});
|
|
28
|
+
|
|
@@ -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
|
+
import { article } from './helper.js';
|
|
18
|
+
import tape from 'tape';
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
tape('Template: bold', async function(t) {
|
|
22
|
+
t.plan(1);
|
|
23
|
+
const document = article;
|
|
24
|
+
t.ok(document.querySelector('strong'), 'Bold as strong');
|
|
25
|
+
});
|
|
26
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
import { createRequire } from "module";
|
|
22
|
+
const require = createRequire(import.meta.url);
|
|
23
|
+
const jsonSnapshot = require('./book-meta-snapshot.json');
|
|
24
|
+
|
|
25
|
+
tape('Template: book-meta', async function (t) {
|
|
26
|
+
t.plan(2);
|
|
27
|
+
|
|
28
|
+
const document = book;
|
|
29
|
+
const titlepage = document.querySelector('section[data-ams-doc="titlepage"]');
|
|
30
|
+
t.ok(titlepage, 'book-meta creates section with data-ams-doc=titlepage');
|
|
31
|
+
|
|
32
|
+
const jsonScript = titlepage.querySelector('script[type="application/json"]');
|
|
33
|
+
const jsonData = JSON.parse(jsonScript.textContent);
|
|
34
|
+
|
|
35
|
+
t.deepEqual(jsonData, jsonSnapshot, 'JSON metadata');
|
|
36
|
+
|
|
37
|
+
});
|
|
@@ -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
|
+
import { book } from './helper.js';
|
|
19
|
+
import tape from 'tape';
|
|
20
|
+
|
|
21
|
+
tape('Template: book preface', async function(t) {
|
|
22
|
+
t.plan(3);
|
|
23
|
+
|
|
24
|
+
const document = book;
|
|
25
|
+
const preface = document.querySelector('section[role="doc-preface"]');
|
|
26
|
+
t.ok(preface, 'preface as section with role doc-preface');
|
|
27
|
+
t.equal(preface.id, 'preface', 'preface preserves ID');
|
|
28
|
+
t.ok(preface.querySelector('h1'), 'Preface title should become an h1');
|
|
29
|
+
});
|
|
@@ -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
|
+
|
|
18
|
+
import { book } from './helper.js';
|
|
19
|
+
import tape from 'tape';
|
|
20
|
+
|
|
21
|
+
tape('Template: book-back/ref-list ', async function(t) {
|
|
22
|
+
t.plan(4);
|
|
23
|
+
|
|
24
|
+
const document = book;
|
|
25
|
+
const bibl = document.querySelector('section#reflist[role="doc-bibliography"]');
|
|
26
|
+
t.ok(bibl, 'ref-list becomes section with id, role, doc-level');
|
|
27
|
+
const title = bibl.querySelector('h1');
|
|
28
|
+
t.equal(title.outerHTML, '<h1>title</h1>', 'ref-list title as heading');
|
|
29
|
+
const list = bibl.querySelector('dl');
|
|
30
|
+
t.ok(list, 'dl created for ref items');
|
|
31
|
+
t.ok(document.querySelector('section#reflistchapter [role="doc-bibliography"] h2'), 'Chapter-level ref-list title gets h2')
|
|
32
|
+
});
|
|
@@ -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 { book } from './helper.js';
|
|
19
|
+
import tape from 'tape';
|
|
20
|
+
|
|
21
|
+
tape('Template: book', async function(t) {
|
|
22
|
+
t.plan(5);
|
|
23
|
+
|
|
24
|
+
const document = book;
|
|
25
|
+
|
|
26
|
+
const head = document.head;
|
|
27
|
+
t.ok(head, 'document head created');
|
|
28
|
+
t.ok(document.querySelector('head meta[name="viewport"][content="width=device-width, initial-scale=1"]'), 'meta tag viewport');
|
|
29
|
+
t.equal(document.title, 'title', 'document title from book-title');
|
|
30
|
+
t.ok(document.body.querySelector('section[data-ams-doc="titlepage"]'), 'document body has titlepage');
|
|
31
|
+
t.ok(document.body.querySelector('section[role="doc-chapter"]'), 'document body has chapter');
|
|
32
|
+
|
|
33
|
+
});
|
|
@@ -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
|
+
tape('Template: boxed-text', async function(t) {
|
|
22
|
+
t.plan(2);
|
|
23
|
+
const document = article;
|
|
24
|
+
const framedBoxedText = document.querySelector('div[data-ams-style="boxed"][data-ams-content-type="framed"]');
|
|
25
|
+
t.ok(framedBoxedText, 'boxed-text as div with data-ams-content-type="framed"');
|
|
26
|
+
const tcolorbox = document.querySelector('div[data-ams-style="boxed"][data-ams-content-type="tcolorbox"]');
|
|
27
|
+
t.ok(tcolorbox.getAttribute('data-ams-style-color'), 'boxed-text as div with data-ams-style="boxed"'); // NOTE just check existence; correctness tested in helper-mapsColorAttributes
|
|
28
|
+
});
|
|
@@ -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: break', async function(t) {
|
|
22
|
+
t.plan(1);
|
|
23
|
+
const document = article;
|
|
24
|
+
const br = document.querySelector('section[data-ams-doc="article"] br');
|
|
25
|
+
t.ok(br, 'BR element in article');
|
|
26
|
+
});
|
|
27
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
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: cite-group', async function(t) {
|
|
22
|
+
t.plan(1);
|
|
23
|
+
const document = article;
|
|
24
|
+
t.equal(document.querySelectorAll('section#citegroup a').length, 2, 'cite-group passed through, leaving two anchors');
|
|
25
|
+
});
|
|
@@ -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 } from './helper.js';
|
|
18
|
+
import tape from 'tape';
|
|
19
|
+
|
|
20
|
+
tape('compound-kwd.js', async function(t) {
|
|
21
|
+
t.plan(1);
|
|
22
|
+
const document = article;
|
|
23
|
+
t.equal(document.querySelector('section[data-ams-doc="frontmatter"] ul[data-ams-doc="MSC scheme"] li').outerHTML, '<li data-msc-key="key1" data-msc-role="primary">Formal groups, <span data-ams-doc="math inline"><tex-math>p</tex-math></span>-divisible groups</li>', 'compound-kwd to li with data attributes and content');
|
|
24
|
+
});
|
|
@@ -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 { article, book } from './helper.js';
|
|
18
|
+
import tape from 'tape';
|
|
19
|
+
|
|
20
|
+
tape('def-list, def-item, def, term', async function(t) {
|
|
21
|
+
t.plan(6);
|
|
22
|
+
const document = article;
|
|
23
|
+
|
|
24
|
+
const deflist = document.querySelector(
|
|
25
|
+
'section[data-ams-doc="article"] dl#dlist1'
|
|
26
|
+
);
|
|
27
|
+
t.ok(deflist, 'Def-list');
|
|
28
|
+
const defitem = deflist.firstElementChild;
|
|
29
|
+
t.equal(defitem.tagName, 'DIV', 'Def-item in article');
|
|
30
|
+
t.ok(deflist.querySelector('div>dt'), 'Term');
|
|
31
|
+
t.equal(
|
|
32
|
+
deflist.querySelector('div>dt').id,
|
|
33
|
+
'ditem1',
|
|
34
|
+
'Def-list ID moved to DT'
|
|
35
|
+
);
|
|
36
|
+
t.ok(deflist.querySelector('div>dt+dd'), 'Def');
|
|
37
|
+
const document2 = book;
|
|
38
|
+
t.equal(
|
|
39
|
+
document2.querySelector('dl#dlist1').firstElementChild.tagName,
|
|
40
|
+
'DIV',
|
|
41
|
+
'Def-item in book'
|
|
42
|
+
);
|
|
43
|
+
});
|
|
@@ -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('disp-formula-group', async function(t) {
|
|
21
|
+
t.plan(3);
|
|
22
|
+
const document = article;
|
|
23
|
+
const groupChild = document.querySelector('#equations figure[data-ams-doc="statement"]#disp-formula-group');
|
|
24
|
+
t.ok(groupChild, 'disp-formula-group as figure with data-ams-doc="statement" with id')
|
|
25
|
+
t.equal(groupChild.firstElementChild.tagName, 'FIGCAPTION', 'disp-formula-group label');
|
|
26
|
+
t.equal(groupChild.firstElementChild.innerHTML, 'Formula Group', 'disp-formula-group passes label along');
|
|
27
|
+
});
|
|
@@ -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 { article } from './helper.js';
|
|
19
|
+
import tape from 'tape';
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
tape('Template: disp-quote, disp-quote/attrib', async function(t) {
|
|
23
|
+
t.plan(4);
|
|
24
|
+
const document = article;
|
|
25
|
+
const quotes = document.querySelectorAll('blockquote[data-ams-style="use"]');
|
|
26
|
+
t.ok(quotes[0], 'disp-quote with specific-use to blockquote with data-ams-style');
|
|
27
|
+
t.ok(quotes[0].querySelector('footer span'), 'attrib in disp-quote as footer with span');
|
|
28
|
+
t.notEqual(quotes[1].parentNode.tagName, 'P', 'blockquote moved out of paragraph to avoid invalid HTML');
|
|
29
|
+
t.ok(document.querySelector('blockquote[role="doc-epigraph"]'), 'Epigraphs get role');
|
|
30
|
+
});
|
|
31
|
+
|
|
@@ -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('Template: email', async function(t) {
|
|
22
|
+
t.plan(1);
|
|
23
|
+
const document = article;
|
|
24
|
+
const email = document.querySelector('a[href="mailto://email"]');
|
|
25
|
+
t.equal(email.innerHTML, 'email', 'email to anchor with mailto address');
|
|
26
|
+
});
|
|
@@ -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
|
+
|
|
22
|
+
tape('Template: ext-link', async function (t) {
|
|
23
|
+
t.plan(3);
|
|
24
|
+
const document = article;
|
|
25
|
+
const extlink = document.querySelector('a[href="https://"]');
|
|
26
|
+
t.ok(extlink, 'Element ext-link becomes a with href');
|
|
27
|
+
t.notOk(document.querySelector('a[href="https://nested2"] a'), 'ext-link with xref inside does not produce nested link');
|
|
28
|
+
t.ok(document.querySelector('a[href="https://nested2"]+span').querySelector('a[data-ams-ref="nested"]'), 'xref inside ext-link moved after ext-link');
|
|
29
|
+
});
|
|
30
|
+
|
|
@@ -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: fig, fig-group, caption, label', async function(t) {
|
|
23
|
+
t.plan(11);
|
|
24
|
+
const document = article;
|
|
25
|
+
const figurePosition = document.querySelector('#figures figure#position');
|
|
26
|
+
t.equal(figurePosition.getAttribute('data-ams-position'), 'anchor', 'Figure with data-ams-position attribute');
|
|
27
|
+
t.notOk(figurePosition.getAttribute('role'), 'Figure has no explicit role');
|
|
28
|
+
const labels = document.querySelectorAll('#figures figure strong');
|
|
29
|
+
t.equal(labels[0].innerHTML, 'Label 1. ', 'Fig label with caption gets period');
|
|
30
|
+
t.equal(labels[1].innerHTML, 'Grouplabel 1. ', 'Fig-group label with caption gets period');
|
|
31
|
+
t.equal(labels[2].innerHTML,'(Sublabel 1) ', 'Subfigure label with caption gets parentheses');
|
|
32
|
+
t.equal(labels[3].innerHTML,'Label 2. ', 'Fig label without caption gets period');
|
|
33
|
+
t.equal(labels[4].innerHTML, 'Grouplabel 2. ', 'Fig-group label without caption gets period');
|
|
34
|
+
t.equal(labels[5].innerHTML, '(Sublabel 2) ', 'Subfigure label without caption gets parentheses');
|
|
35
|
+
t.notOk(figurePosition.nextElementSibling.hasAttribute('id'), 'Fig without id does not create a (bad) id');
|
|
36
|
+
t.notOk(figurePosition.nextElementSibling.getAttribute('data-ams-position'), 'Fig without position does not create a (bad) data attribute');
|
|
37
|
+
t.equal(figurePosition.nextElementSibling.getAttribute('data-ams-specific-use'), 'special', 'Fig with specific-use');
|
|
38
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
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: fn, fn/label', async function(t) {
|
|
23
|
+
t.plan(8);
|
|
24
|
+
const document = article;
|
|
25
|
+
const footnote = document.querySelector('div[role="doc-footnote"]');
|
|
26
|
+
t.ok(footnote, 'fn becomes div with role doc-footnote');
|
|
27
|
+
t.equal(footnote.getAttribute('aria-label'), 'Footnote Label', 'footnote aria-label attribute');
|
|
28
|
+
const footnoteLabel = footnote.firstElementChild;
|
|
29
|
+
t.equal(footnoteLabel.tagName, 'SPAN', 'footnote label');
|
|
30
|
+
t.equal(footnoteLabel.getAttribute('data-ams-doc'), 'label', 'footnote label data attribute');
|
|
31
|
+
t.equal(footnoteLabel.innerHTML, '<sup>Label</sup>', 'footnote label content');
|
|
32
|
+
t.notOk(document.querySelector('#fnid').closest('p'), 'footnote moved out of paragraph')
|
|
33
|
+
|
|
34
|
+
const parWithFootnotes = document.querySelector('#multifootnotes');
|
|
35
|
+
const fn3 = document.querySelector('div#fnid3[role="doc-footnote"]');
|
|
36
|
+
const fn4 = document.querySelector('div#fnid4[role="doc-footnote"]');
|
|
37
|
+
t.equal(parWithFootnotes.nextElementSibling, fn3, 'Paragraph with multiple footnotes followed by first footnote');
|
|
38
|
+
t.equal(fn3.nextElementSibling, fn4, 'Paragraph with multiple footnotes: first footnote followed by second footnote');
|
|
39
|
+
});
|
|
40
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
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, articleNometa } from './helper.js';
|
|
19
|
+
import tape from 'tape';
|
|
20
|
+
|
|
21
|
+
import { createRequire } from "module";
|
|
22
|
+
const require = createRequire(import.meta.url);
|
|
23
|
+
const jsonSnapshot = require('./article-meta-snapshot.json');
|
|
24
|
+
const jsonSnapshot2 = require('./article-alttitle-meta-snapshot.json');
|
|
25
|
+
const jsonSnapshot3 = require('./article-nometa-meta-snapshot.json');
|
|
26
|
+
|
|
27
|
+
tape('front.js', async function (t) {
|
|
28
|
+
t.plan(4);
|
|
29
|
+
|
|
30
|
+
const document = article;
|
|
31
|
+
const frontmatter = document.querySelector('section[data-ams-doc="frontmatter"]');
|
|
32
|
+
t.ok(frontmatter, 'front creates section with data-ams-doc=frontmatter');
|
|
33
|
+
|
|
34
|
+
const jsonScript = frontmatter.querySelector('script[type="application/json"]');
|
|
35
|
+
const jsonData = JSON.parse(jsonScript.textContent);
|
|
36
|
+
|
|
37
|
+
t.deepEqual(jsonData, jsonSnapshot, 'article.xml JSON metadata');
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const document2 = articleAlttitle;
|
|
41
|
+
t.deepEqual(JSON.parse(document2.querySelector('script[type="application/json"]').textContent), jsonSnapshot2, 'article--alttitle.xml JSON metadata');
|
|
42
|
+
|
|
43
|
+
const document3 = articleNometa;
|
|
44
|
+
t.deepEqual(JSON.parse(document3.querySelector('script[type="application/json"]').textContent), jsonSnapshot3, 'article--nometa.xml JSON metadata');
|
|
45
|
+
});
|
|
@@ -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
|
+
import { article } from './helper.js';
|
|
19
|
+
import tape from 'tape';
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
tape('Template: funding-group, funding-statement', async function(t) {
|
|
23
|
+
t.plan(2);
|
|
24
|
+
const document = article;
|
|
25
|
+
let fundinggroup = document.querySelector('div[data-ams-doc="funding-group"]')
|
|
26
|
+
t.ok(fundinggroup, 'funding-group produces div with data-ams-doc');
|
|
27
|
+
t.equal(fundinggroup.querySelectorAll('p').length, 2, 'funding-group contains paragraph for each funding-statement');
|
|
28
|
+
});
|
|
29
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
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: img, graphics', async function(t) {
|
|
22
|
+
t.plan(10);
|
|
23
|
+
const document = article;
|
|
24
|
+
const graphic = document.querySelector('img[data-ams-doc="graphic"]');
|
|
25
|
+
t.ok(graphic, 'img with data-ams-doc=graphic');
|
|
26
|
+
t.equal(graphic.getAttribute('src'), 'file', 'graphic href as source');
|
|
27
|
+
t.equal(graphic.getAttribute('alt'), 'text', 'graphic alt-text');
|
|
28
|
+
t.equal(graphic.getAttribute('data-ams-style'), 'use', 'graphic specific-use');
|
|
29
|
+
t.equal(graphic.getAttribute('data-ams-height'), '100pt', 'graphic height');
|
|
30
|
+
t.equal(graphic.getAttribute('data-ams-width'), '100px', 'graphic width (with added unit)');
|
|
31
|
+
t.equal(graphic.getAttribute('alt'), 'text', 'alt attribute');
|
|
32
|
+
|
|
33
|
+
const inlinegraphic = document.querySelector('img[data-ams-doc="inline-graphic"]');
|
|
34
|
+
t.ok(inlinegraphic, 'img with data-ams-doc=inline-graphic');
|
|
35
|
+
t.equal(inlinegraphic.getAttribute('alt'), 'Graphic without alt text', 'alt attribute fallback');
|
|
36
|
+
|
|
37
|
+
const mathWithGraphic = [...document.querySelectorAll('[data-ams-doc="math block"] > tex-math')].find(node => node.innerHTML.trim() === 'x = \\vcenter{\\img[][12pt][12pt][{custom dictionary alt}]{Images/test.svg}}');
|
|
38
|
+
t.ok(mathWithGraphic, 'Graphic inside formula');
|
|
39
|
+
});
|
|
40
|
+
|