@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,29 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import mapAttributes from '../helpers/mapAttributes.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* p element
|
|
21
|
+
* @param {HTMLElement} htmlParentNode
|
|
22
|
+
* @param {Element} xmlnode
|
|
23
|
+
*/
|
|
24
|
+
export default function (htmlParentNode, xmlnode) {
|
|
25
|
+
let paragraph = this.createNode('p');
|
|
26
|
+
mapAttributes(paragraph, xmlnode);
|
|
27
|
+
htmlParentNode.appendChild(paragraph);
|
|
28
|
+
this.passThrough(paragraph, xmlnode);
|
|
29
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import mapAttributes from '../helpers/mapAttributes.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* preface element
|
|
21
|
+
* @param {HTMLElement} htmlParentNode
|
|
22
|
+
* @param {Element} xmlnode
|
|
23
|
+
*/
|
|
24
|
+
export default function (htmlParentNode, xmlnode) {
|
|
25
|
+
// NOTE should only occur in books
|
|
26
|
+
const preface = this.createNode('section', '', {
|
|
27
|
+
role: 'doc-preface',
|
|
28
|
+
'data-ams-doc-level': 0
|
|
29
|
+
});
|
|
30
|
+
mapAttributes(preface, xmlnode);
|
|
31
|
+
htmlParentNode.appendChild(preface);
|
|
32
|
+
this.passThrough(preface, xmlnode);
|
|
33
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import mapAttributes from '../helpers/mapAttributes.js';
|
|
18
|
+
import getParentLevel from '../helpers/getParentLevel.js';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* ref-list element
|
|
22
|
+
* @param {HTMLElement} htmlParentNode
|
|
23
|
+
* @param {Element} xmlnode
|
|
24
|
+
*/
|
|
25
|
+
export default function (htmlParentNode, xmlnode) {
|
|
26
|
+
// calculate document level
|
|
27
|
+
const parentLevel = getParentLevel(htmlParentNode);
|
|
28
|
+
let level = this.isBook ? '0' : '1';
|
|
29
|
+
if (!Number.isNaN(parentLevel)) level = parentLevel + 1;
|
|
30
|
+
// check nesting NOTE no complex nesting allowed.
|
|
31
|
+
const isNestedRefList = (xmlnode.parentNode.tagName === 'ref-list');
|
|
32
|
+
const containsRefList = xmlnode.querySelector(':scope>ref-list');
|
|
33
|
+
// wrapping section to accomodate title
|
|
34
|
+
const section = this.createNode('section', '', {
|
|
35
|
+
'data-ams-doc-level': level
|
|
36
|
+
});
|
|
37
|
+
mapAttributes(section, xmlnode);
|
|
38
|
+
htmlParentNode.appendChild(section);
|
|
39
|
+
if (!isNestedRefList) {
|
|
40
|
+
section.setAttribute('role', 'doc-bibliography');
|
|
41
|
+
}
|
|
42
|
+
if (containsRefList) {
|
|
43
|
+
this.passThrough(section, xmlnode);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.recurseTheDom(section, xmlnode.querySelector('title'));
|
|
47
|
+
const dl = this.createNode('dl', '');
|
|
48
|
+
section.appendChild(dl);
|
|
49
|
+
xmlnode.querySelectorAll('ref').forEach(this.recurseTheDom.bind(null, dl));
|
|
50
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* ref element
|
|
19
|
+
* @param {HTMLElement} htmlParentNode
|
|
20
|
+
* @param {Element} xmlnode
|
|
21
|
+
*/
|
|
22
|
+
export default function (htmlParentNode, xmlnode) {
|
|
23
|
+
const dt = this.createNode('dt');
|
|
24
|
+
dt.id = xmlnode.id;
|
|
25
|
+
htmlParentNode.appendChild(dt);
|
|
26
|
+
this.recurseTheDom(dt, xmlnode.querySelector('label'));
|
|
27
|
+
this.recurseTheDom(htmlParentNode, xmlnode.querySelector('mixed-citation'));
|
|
28
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { node2macro } from '../helpers/helpers-tex.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* roman element
|
|
21
|
+
* @param {HTMLElement} htmlParentNode
|
|
22
|
+
* @param {Element} xmlnode
|
|
23
|
+
*/
|
|
24
|
+
export default function (htmlParentNode, xmlnode) {
|
|
25
|
+
if (xmlnode.closest('tex-math')) {
|
|
26
|
+
node2macro.apply(this, [htmlParentNode, xmlnode, 'textrm', true]);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const span = this.createNode('span', '', {
|
|
30
|
+
'data-ams-style': xmlnode.tagName
|
|
31
|
+
});
|
|
32
|
+
htmlParentNode.appendChild(span);
|
|
33
|
+
this.passThrough(span, xmlnode);
|
|
34
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { node2macro } from '../helpers/helpers-tex.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* sans-serif element
|
|
21
|
+
* @param {HTMLElement} htmlParentNode
|
|
22
|
+
* @param {Element} xmlnode
|
|
23
|
+
*/
|
|
24
|
+
export default function (htmlParentNode, xmlnode) {
|
|
25
|
+
if (xmlnode.closest("tex-math")) {
|
|
26
|
+
node2macro.apply(this, [htmlParentNode, xmlnode, 'textsf', true]);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const span = this.createNode("span", "", {
|
|
30
|
+
"data-ams-style": xmlnode.tagName,
|
|
31
|
+
});
|
|
32
|
+
htmlParentNode.appendChild(span);
|
|
33
|
+
this.passThrough(span, xmlnode);
|
|
34
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { node2macro } from '../helpers/helpers-tex.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* sc element
|
|
21
|
+
* @param {HTMLElement} htmlParentNode
|
|
22
|
+
* @param {Element} xmlnode
|
|
23
|
+
*/
|
|
24
|
+
export default function (htmlParentNode, xmlnode) {
|
|
25
|
+
if (xmlnode.closest('tex-math')) {
|
|
26
|
+
node2macro.apply(this, [htmlParentNode, xmlnode, 'mathsc', true, true]);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const span = this.createNode('span', '', {
|
|
31
|
+
'data-ams-style': xmlnode.tagName
|
|
32
|
+
});
|
|
33
|
+
htmlParentNode.appendChild(span);
|
|
34
|
+
this.passThrough(span, xmlnode);
|
|
35
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { generateByline } from "../helpers/generateByline.js";
|
|
18
|
+
/**
|
|
19
|
+
* sec-meta element
|
|
20
|
+
* @param {HTMLElement} htmlParentNode
|
|
21
|
+
* @param {Element} xmlnode
|
|
22
|
+
*/
|
|
23
|
+
export default function (htmlParentNode, xmlnode) {
|
|
24
|
+
const contributors = this.extractContribGroups(xmlnode);
|
|
25
|
+
const secmetaSection = this.createNode('section', '', {
|
|
26
|
+
'data-ams-doc': 'sec-meta',
|
|
27
|
+
'data-ams-contributors': JSON.stringify(contributors),
|
|
28
|
+
'data-ams-byline': generateByline(contributors),
|
|
29
|
+
});
|
|
30
|
+
htmlParentNode.appendChild(secmetaSection);
|
|
31
|
+
|
|
32
|
+
// NOTE: use cases for content within sec-meta so far: MCL1/14 has abstract; noti2382 has notes.
|
|
33
|
+
this.passThrough(secmetaSection, xmlnode);
|
|
34
|
+
// NOTE: MCL01, MCL14 also have questionable contrib-group with just author-comment (which was intentionally broken via #254, cf. also AmerMathSoc/mcl#13)
|
|
35
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const sectioningDictionary = {
|
|
18
|
+
part: 0,
|
|
19
|
+
chapter: 0,
|
|
20
|
+
section: 1,
|
|
21
|
+
refhead: 1, // NOTE NOTI only
|
|
22
|
+
subsection: 2,
|
|
23
|
+
subsubsection: 3,
|
|
24
|
+
paragraph: 4,
|
|
25
|
+
subparagraph: 5,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* sec element, also used for many other section-like elements
|
|
30
|
+
* @param {HTMLElement} htmlParentNode
|
|
31
|
+
* @param {Element} xmlnode
|
|
32
|
+
*/
|
|
33
|
+
export default function (htmlParentNode, xmlnode) {
|
|
34
|
+
const tagName = xmlnode.tagName;
|
|
35
|
+
const specificUse = xmlnode.getAttribute('specific-use');
|
|
36
|
+
const articleWithPartIncrement =
|
|
37
|
+
!this.isBook && xmlnode.getRootNode().querySelector('sec[specific-use="part"]')
|
|
38
|
+
? 1
|
|
39
|
+
: 0;
|
|
40
|
+
const hasDictionaryEntry = sectioningDictionary[specificUse] !== undefined;
|
|
41
|
+
const ancestorWithLevel = htmlParentNode.closest('[data-ams-doc-level]');
|
|
42
|
+
// if there is no sectioningDictionary entry, we use the ancestor to decide, if 0 or 5 is appropriate.
|
|
43
|
+
// NOTE front-matter (aliased to sec()) doesn't have an ancestor.
|
|
44
|
+
const level = hasDictionaryEntry
|
|
45
|
+
? sectioningDictionary[specificUse]
|
|
46
|
+
: ancestorWithLevel
|
|
47
|
+
? 5
|
|
48
|
+
: 0;
|
|
49
|
+
const section = this.createNode('section', '', {
|
|
50
|
+
'data-ams-doc-level': level + articleWithPartIncrement,
|
|
51
|
+
'data-ams-doc': specificUse,
|
|
52
|
+
id: xmlnode.getAttribute('id'),
|
|
53
|
+
});
|
|
54
|
+
htmlParentNode.appendChild(section);
|
|
55
|
+
|
|
56
|
+
if (specificUse === 'part') {
|
|
57
|
+
section.setAttribute('role', 'doc-part');
|
|
58
|
+
}
|
|
59
|
+
if (specificUse === 'chapter') {
|
|
60
|
+
section.setAttribute('role', 'doc-chapter');
|
|
61
|
+
}
|
|
62
|
+
section.removeAttribute('specific-use');
|
|
63
|
+
if (tagName === 'dedication')
|
|
64
|
+
section.setAttribute('role', 'doc-dedication');
|
|
65
|
+
|
|
66
|
+
// Acknowledgements
|
|
67
|
+
const titleChild = xmlnode.querySelector('title');
|
|
68
|
+
if (
|
|
69
|
+
tagName === 'ack' ||
|
|
70
|
+
(titleChild && titleChild.textContent.startsWith('Acknowledg'))
|
|
71
|
+
) {
|
|
72
|
+
section.setAttribute('role', 'doc-acknowledgments');
|
|
73
|
+
}
|
|
74
|
+
if (tagName === 'ack' && !this.isBook)
|
|
75
|
+
section.setAttribute('data-ams-doc-level', '1');
|
|
76
|
+
if (titleChild && titleChild.textContent.startsWith('Introduction'))
|
|
77
|
+
section.setAttribute('role', 'doc-introduction');
|
|
78
|
+
|
|
79
|
+
// book appendices
|
|
80
|
+
if (tagName === 'book-app-group') {
|
|
81
|
+
// NOTE might become redundant if book-app-group gets specific-use=part
|
|
82
|
+
section.setAttribute('role', 'doc-part');
|
|
83
|
+
section.setAttribute('data-ams-doc', 'part');
|
|
84
|
+
section.setAttribute('data-ams-doc-level', '0');
|
|
85
|
+
}
|
|
86
|
+
if (tagName === 'book-app') section.setAttribute('role', 'doc-appendix');
|
|
87
|
+
|
|
88
|
+
this.passThrough(section, xmlnode);
|
|
89
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import mapAttributes from '../helpers/mapAttributes.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* secheading element
|
|
21
|
+
* @param {HTMLElement} htmlParentNode
|
|
22
|
+
* @param {Element} xmlnode
|
|
23
|
+
*/
|
|
24
|
+
export default function (htmlParentNode, xmlnode) {
|
|
25
|
+
const parentLevel = htmlParentNode.closest('[data-ams-doc-level]')?.getAttribute('data-ams-doc-level') || 5;
|
|
26
|
+
const span = this.createNode('span', '', {
|
|
27
|
+
'data-ams-doc': 'secheading',
|
|
28
|
+
'data-ams-doc-level': parseInt(parentLevel)+1,
|
|
29
|
+
});
|
|
30
|
+
mapAttributes(span, xmlnode);
|
|
31
|
+
|
|
32
|
+
htmlParentNode.appendChild(span);
|
|
33
|
+
const label = xmlnode.querySelector('label');
|
|
34
|
+
const title = xmlnode.querySelector('title');
|
|
35
|
+
if (label) {
|
|
36
|
+
this.passThrough(span, label);
|
|
37
|
+
}
|
|
38
|
+
if (title && label) {
|
|
39
|
+
span.insertAdjacentText('beforeend', '. ');
|
|
40
|
+
// NOTE this does not match label/title punctuation where a title without label would get a period.
|
|
41
|
+
}
|
|
42
|
+
this.passThrough(span, title);
|
|
43
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* simpletabbing element
|
|
19
|
+
* @param {HTMLElement} htmlParentNode
|
|
20
|
+
* @param {Element} xmlnode
|
|
21
|
+
*/
|
|
22
|
+
export default function (htmlParentNode, xmlnode) {
|
|
23
|
+
const section = this.createNode('section', '', {
|
|
24
|
+
'data-ams-doc': xmlnode.tagName,
|
|
25
|
+
});
|
|
26
|
+
if (xmlnode.hasAttribute('id')) section.id = xmlnode.getAttribute('id');
|
|
27
|
+
htmlParentNode.appendChild(section);
|
|
28
|
+
this.passThrough(section, xmlnode);
|
|
29
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import mapAttributes from '../helpers/mapAttributes.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* statement element
|
|
21
|
+
* @param {HTMLElement} htmlParentNode
|
|
22
|
+
* @param {Element} xmlnode
|
|
23
|
+
*/
|
|
24
|
+
export default function (htmlParentNode, xmlnode) {
|
|
25
|
+
const figure = this.createNode('figure', '', {
|
|
26
|
+
'data-ams-doc': 'statement',
|
|
27
|
+
});
|
|
28
|
+
mapAttributes(figure, xmlnode);
|
|
29
|
+
htmlParentNode.appendChild(figure);
|
|
30
|
+
this.passThrough(figure, xmlnode);
|
|
31
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* string-name element
|
|
19
|
+
* @param {HTMLElement} htmlParentNode
|
|
20
|
+
* @param {Element} xmlnode
|
|
21
|
+
*/
|
|
22
|
+
export default function (htmlParentNode, xmlnode) {
|
|
23
|
+
const span = this.createNode('span', '', {
|
|
24
|
+
'data-ams-doc': 'stringname'
|
|
25
|
+
});
|
|
26
|
+
htmlParentNode.appendChild(span);
|
|
27
|
+
this.passThrough(span, xmlnode);
|
|
28
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { mapColorAttributes } from '../helpers/mapColorAttributes.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* styled-content element
|
|
21
|
+
* @param {HTMLElement} htmlParentNode
|
|
22
|
+
* @param {Element} xmlnode
|
|
23
|
+
*/
|
|
24
|
+
export default function (htmlParentNode, xmlnode) {
|
|
25
|
+
const span = this.createNode('span', '');
|
|
26
|
+
// handle style-type NOTE current values: sans-serif, oblique
|
|
27
|
+
if (xmlnode.hasAttribute('style-type')) span.setAttribute('data-ams-style', xmlnode.getAttribute('style-type'));
|
|
28
|
+
// handle color attributes
|
|
29
|
+
mapColorAttributes(span, xmlnode);
|
|
30
|
+
htmlParentNode.appendChild(span);
|
|
31
|
+
this.passThrough(span, xmlnode);
|
|
32
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* subj-group element
|
|
19
|
+
* @param {HTMLElement} htmlParentNode
|
|
20
|
+
* @param {Element} xmlnode
|
|
21
|
+
*/
|
|
22
|
+
export default function (htmlParentNode, xmlnode) {
|
|
23
|
+
htmlParentNode.appendChild(
|
|
24
|
+
this.createNode('dt', `Subjects`)
|
|
25
|
+
);
|
|
26
|
+
xmlnode
|
|
27
|
+
.querySelectorAll('subject')
|
|
28
|
+
.forEach(this.recurseTheDom.bind(null, htmlParentNode));
|
|
29
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* subject element
|
|
19
|
+
* @param {HTMLElement} htmlParentNode
|
|
20
|
+
* @param {Element} xmlnode
|
|
21
|
+
*/
|
|
22
|
+
export default function (htmlParentNode, xmlnode) {
|
|
23
|
+
const dd = this.createNode('dd');
|
|
24
|
+
htmlParentNode.appendChild(dd);
|
|
25
|
+
this.passThrough(dd, xmlnode);
|
|
26
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import getParentLevel from '../helpers/getParentLevel.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* subtitle element
|
|
21
|
+
* @param {HTMLElement} htmlParentNode
|
|
22
|
+
* @param {Element} xmlnode
|
|
23
|
+
*/
|
|
24
|
+
export default function (htmlParentNode, xmlnode) {
|
|
25
|
+
// NOTE the subtitle is also touched in label.js (which creates a header as htmlParent)
|
|
26
|
+
const p = this.createNode('p', '', { 'data-ams-doc': 'subtitle' });
|
|
27
|
+
htmlParentNode.appendChild(p);
|
|
28
|
+
this.passThrough(p, xmlnode);
|
|
29
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023 American Mathematical Society
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* table element
|
|
19
|
+
* @param {HTMLElement} htmlParentNode
|
|
20
|
+
* @param {Element} xmlnode
|
|
21
|
+
*/
|
|
22
|
+
export default function (htmlParentNode, xmlnode) {
|
|
23
|
+
const div = this.createNode('div', '', {
|
|
24
|
+
'data-ams-doc': `table-wrap`, // NOTE table-wrap (now) creates figure with same attribute value; ams-html/ams-bookhtml use this div for overflow
|
|
25
|
+
});
|
|
26
|
+
htmlParentNode.appendChild(div);
|
|
27
|
+
this.copyElement(div, xmlnode);
|
|
28
|
+
};
|