@amermathsoc/texml-to-html 18.3.0 → 18.5.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 +17 -0
- package/README.md +1 -0
- package/lib/elements/book-meta-json.js +27 -3
- package/lib/elements/book-meta.js +10 -0
- package/lib/elements/graphic.js +1 -2
- package/package.json +1 -1
- package/test/article.xml +1 -2
- package/test/book--metadata-meta-snapshot.json +102 -0
- package/test/book--metadata.xml +144 -0
- package/test/book-meta-snapshot.json +5 -1
- package/test/book.xml +5 -0
- package/test/element-book-meta.js +15 -3
- package/test/helper.js +2 -0
- package/test/helpers/generateByline.js +87 -0
- package/test/snapshots/article.html +0 -1
- package/test/snapshots/book--metadata.html +25 -0
- package/test/snapshots/book.html +1 -1
- package/test/snapshots/texml-tests/book-app.html +1 -1
- package/test/snapshots/texml-tests/drm.html +1 -1
- package/test/snapshots/texml-tests/gsm_l.html +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [18.5.0](https://github.com/AmerMathSoc/texml-to-html/compare/v18.4.0...v18.5.0) (2025-05-19)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **book-meta-json.js:** support issue note ([52bb0be](https://github.com/AmerMathSoc/texml-to-html/commit/52bb0be03ce504dca93623f648e5995398ade119)), closes [#480](https://github.com/AmerMathSoc/texml-to-html/issues/480)
|
|
11
|
+
* **book-meta:** support abstract, keywords, MSCs ([1aee280](https://github.com/AmerMathSoc/texml-to-html/commit/1aee28047bc8f69c0c5067fc088e11272be24993)), closes [#479](https://github.com/AmerMathSoc/texml-to-html/issues/479)
|
|
12
|
+
|
|
13
|
+
## [18.4.0](https://github.com/AmerMathSoc/texml-to-html/compare/v18.3.0...v18.4.0) (2025-05-05)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **book-meta-json.js:** collection contributors ([04fb7ae](https://github.com/AmerMathSoc/texml-to-html/commit/04fb7aefeb1077b4b1e51f50188ebb7b78f9e7ea)), closes [#481](https://github.com/AmerMathSoc/texml-to-html/issues/481)
|
|
19
|
+
* **book-meta-json.js:** support book-issue-number ([32dd1a6](https://github.com/AmerMathSoc/texml-to-html/commit/32dd1a611b29fe35c76912f7bda5709238687e68)), closes [#476](https://github.com/AmerMathSoc/texml-to-html/issues/476)
|
|
20
|
+
* **book-meta-json.js:** support pub-date&history ([29155a7](https://github.com/AmerMathSoc/texml-to-html/commit/29155a723e37e1c4b846c119d12b8e225c7ef33c)), closes [#478](https://github.com/AmerMathSoc/texml-to-html/issues/478)
|
|
21
|
+
|
|
5
22
|
## [18.3.0](https://github.com/AmerMathSoc/texml-to-html/compare/v18.2.0...v18.3.0) (2025-02-24)
|
|
6
23
|
|
|
7
24
|
|
package/README.md
CHANGED
|
@@ -95,15 +95,29 @@ export function generateBookJson(bookMetaNode) {
|
|
|
95
95
|
// Volume number
|
|
96
96
|
bookMetaJson.book.identifiers.AMS.volumeNr = bookMetaNode.querySelector('book-volume-number')?.textContent;
|
|
97
97
|
|
|
98
|
+
// Issue number (e.g. MEMO)
|
|
99
|
+
bookMetaJson.book.identifiers.AMS.issueNr = bookMetaNode.querySelector('book-issue-number')?.textContent;
|
|
100
|
+
|
|
101
|
+
// history (including pub-date)
|
|
102
|
+
// Most books have only `pub-date` but some have history (e.g. MEMO)
|
|
103
|
+
bookMetaJson.history = {
|
|
104
|
+
published: bookMetaNode.querySelector('pub-date')?.getAttribute('iso-8601-date'),
|
|
105
|
+
received: bookMetaNode.querySelector('history date[date-type="received"]')?.getAttribute('iso-8601-date'),
|
|
106
|
+
issue: bookMetaNode.querySelector('history date[date-type="issue-date"]')?.getAttribute('iso-8601-date'),
|
|
107
|
+
};
|
|
108
|
+
if (bookMetaNode.querySelector('history')) {
|
|
109
|
+
bookMetaJson.history['rev-recd'] = bookMetaNode.querySelectorAll('history date[date-type="rev-recd"]').map(node => node.getAttribute('iso-8601-date'))
|
|
110
|
+
}
|
|
111
|
+
|
|
98
112
|
// basename
|
|
99
|
-
bookMetaJson.book.identifiers.basename = bookMetaJson.book.identifiers.AMS.publKey + bookMetaJson.book.identifiers.AMS.volumeNr
|
|
113
|
+
bookMetaJson.book.identifiers.basename = bookMetaJson.book.identifiers.AMS.publKey + (bookMetaJson.book.identifiers.AMS.issueNr || bookMetaJson.book.identifiers.AMS.volumeNr);
|
|
100
114
|
|
|
101
115
|
bookMetaJson.contributors = this.extractContribGroups(bookMetaNode);
|
|
102
116
|
|
|
103
|
-
bookMetaNode.querySelectorAll('publisher').
|
|
117
|
+
bookMetaJson.publishers = [...bookMetaNode.querySelectorAll('publisher')].map(publisher => {
|
|
104
118
|
const publisherData = { name: publisher.querySelector('publisher-name').textContent };
|
|
105
119
|
if (publisher.querySelector('publisher-loc')) publisherData.location = publisher.querySelector('publisher-loc').textContent;
|
|
106
|
-
|
|
120
|
+
return publisherData;
|
|
107
121
|
})
|
|
108
122
|
|
|
109
123
|
bookMetaJson.permissions.copyrightStatement = bookMetaNode.querySelector('copyright-statement')?.textContent;
|
|
@@ -131,6 +145,16 @@ export function generateBookJson(bookMetaNode) {
|
|
|
131
145
|
// NOTE custom-meta should have exactly two children - meta-name and meta-value
|
|
132
146
|
bookMetaJson.collection[customMeta.querySelector('meta-name').textContent] = customMeta.querySelector('meta-value').textContent;
|
|
133
147
|
});
|
|
148
|
+
bookMetaJson.collection.contributors = this.extractContribGroups(collectionMeta);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Issue data (e.g., MEMO)
|
|
152
|
+
if (bookMetaJson.book.identifiers.AMS.issueNr) {
|
|
153
|
+
bookMetaJson.issue = {
|
|
154
|
+
number: bookMetaJson.book.identifiers.AMS.issueNr,
|
|
155
|
+
note: bookMetaNode.querySelector('book-issue-note')?.textContent,
|
|
156
|
+
date: bookMetaNode.querySelector('history date[date-type="issue-date"]')?.getAttribute('iso-8601-date'),
|
|
157
|
+
}
|
|
134
158
|
}
|
|
135
159
|
|
|
136
160
|
return JSON.stringify(bookMetaJson);
|
|
@@ -30,4 +30,14 @@ export default function (htmlParentNode, xmlnode) {
|
|
|
30
30
|
const script = this.createNode('script', '', { type: "application/json" });
|
|
31
31
|
titlepage.append(script);
|
|
32
32
|
script.textContent = generateBookJson.call(this, xmlnode);
|
|
33
|
+
|
|
34
|
+
// MEMO books include abstract and other metadata inside book-meta; they are presented together so we group them here
|
|
35
|
+
if (!xmlnode.querySelector('abstract')) return;
|
|
36
|
+
const wrapperAbstract = this.createNode('section', '', {
|
|
37
|
+
'data-ams-doc': 'abstract' //NOTE: abstract itself gets role=doc-abstract
|
|
38
|
+
});
|
|
39
|
+
htmlParentNode.appendChild(wrapperAbstract);
|
|
40
|
+
this.recurseTheDom(wrapperAbstract, xmlnode.querySelector('abstract'));
|
|
41
|
+
xmlnode.querySelectorAll('kwd-group').forEach(this.recurseTheDom.bind(null, wrapperAbstract));
|
|
42
|
+
xmlnode.querySelectorAll('funding-group').forEach(this.recurseTheDom.bind(null, wrapperAbstract));
|
|
33
43
|
};
|
package/lib/elements/graphic.js
CHANGED
|
@@ -43,7 +43,6 @@ export default function (htmlParentNode, xmlnode) {
|
|
|
43
43
|
});
|
|
44
44
|
htmlParentNode.appendChild(img);
|
|
45
45
|
if (xmlnode.parentNode.tagName !== 'fig') return;
|
|
46
|
-
|
|
47
|
-
const altText = xmlnode.parentNode.querySelector('alt-text');
|
|
46
|
+
const altText = xmlnode.querySelector('alt-text');
|
|
48
47
|
if (altText) img.setAttribute('alt', altText.textContent);
|
|
49
48
|
};
|
package/package.json
CHANGED
package/test/article.xml
CHANGED
|
@@ -365,8 +365,7 @@
|
|
|
365
365
|
<!-- graphic, inline-graphic, img -->
|
|
366
366
|
<sec disp-level="1" id="graphics" specific-use="section">
|
|
367
367
|
<fig>
|
|
368
|
-
<graphic height="100pt" mimetype="mime" width="100" xlink:href="file" specific-use="use"
|
|
369
|
-
<alt-text>text</alt-text>
|
|
368
|
+
<graphic height="100pt" mimetype="mime" width="100" xlink:href="file" specific-use="use"><alt-text>text</alt-text></graphic>
|
|
370
369
|
</fig>
|
|
371
370
|
<inline-graphic height="height" mimetype="mime" width="width" xlink:href="file" specific-use="use"/>
|
|
372
371
|
<img src="file" alt="text"></img>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{
|
|
2
|
+
"book": {
|
|
3
|
+
"identifiers": {
|
|
4
|
+
"AMS": {
|
|
5
|
+
"publKey": "series",
|
|
6
|
+
"volumeId": "volume",
|
|
7
|
+
"volumeNr": "volume",
|
|
8
|
+
"issueNr": "issue"
|
|
9
|
+
},
|
|
10
|
+
"crossref": {
|
|
11
|
+
"doi": "doi"
|
|
12
|
+
},
|
|
13
|
+
"issn": {
|
|
14
|
+
"print": "issn print"
|
|
15
|
+
},
|
|
16
|
+
"isbn": {
|
|
17
|
+
"electronic": "isbn pdf",
|
|
18
|
+
"google": "isbn google pdf",
|
|
19
|
+
"print": "isbn print",
|
|
20
|
+
"epub": "isbn epub"
|
|
21
|
+
},
|
|
22
|
+
"loc": {
|
|
23
|
+
"lccn": "0123456789"
|
|
24
|
+
},
|
|
25
|
+
"basename": "seriesissue"
|
|
26
|
+
},
|
|
27
|
+
"title": "title",
|
|
28
|
+
"subtitle": "subtitle",
|
|
29
|
+
"alttitle": "title"
|
|
30
|
+
},
|
|
31
|
+
"issue": {
|
|
32
|
+
"number": "issue",
|
|
33
|
+
"note": "issue note",
|
|
34
|
+
"date": "2025-01-01"
|
|
35
|
+
},
|
|
36
|
+
"publishers": [
|
|
37
|
+
{
|
|
38
|
+
"name": "name1",
|
|
39
|
+
"location": "loc"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "name2"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"contributors": {
|
|
46
|
+
"authors": [
|
|
47
|
+
{
|
|
48
|
+
"name": "Given Sur Jr.",
|
|
49
|
+
"bio": "",
|
|
50
|
+
"affiliations": [
|
|
51
|
+
"aff"
|
|
52
|
+
],
|
|
53
|
+
"emails": [
|
|
54
|
+
"email"
|
|
55
|
+
],
|
|
56
|
+
"mrauth": "mrauthid",
|
|
57
|
+
"orcid": "orcidid",
|
|
58
|
+
"uri": "uri",
|
|
59
|
+
"byline": "comment"
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"contrib-group-type2": [
|
|
63
|
+
{
|
|
64
|
+
"name": "Given Sur",
|
|
65
|
+
"bio": "",
|
|
66
|
+
"affiliations": [],
|
|
67
|
+
"emails": []
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"contrib-group-type3": [
|
|
71
|
+
{
|
|
72
|
+
"name": "String Name",
|
|
73
|
+
"bio": "",
|
|
74
|
+
"affiliations": [],
|
|
75
|
+
"emails": [],
|
|
76
|
+
"byline": "comment"
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
"permissions": {
|
|
81
|
+
"copyrightStatement": "Copyright 2020 American Mathematical Society"
|
|
82
|
+
},
|
|
83
|
+
"history": {
|
|
84
|
+
"published": "2025-01-14",
|
|
85
|
+
"rev-recd": [],
|
|
86
|
+
"issue": "2025-01-01"
|
|
87
|
+
},
|
|
88
|
+
"collection": {
|
|
89
|
+
"title": "Collection Title",
|
|
90
|
+
"subseries": "subseriesName",
|
|
91
|
+
"contributors": {
|
|
92
|
+
"editors": [
|
|
93
|
+
{
|
|
94
|
+
"name": "An Editor",
|
|
95
|
+
"bio": "",
|
|
96
|
+
"affiliations": [],
|
|
97
|
+
"emails": []
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!DOCTYPE book PUBLIC "-//NLM//DTD BITS Book Interchange DTD v1.0 20131225//EN" "BITS-book1.dtd">
|
|
3
|
+
<book xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:html="http://www.w3.org/1999/html">
|
|
4
|
+
<collection-meta>
|
|
5
|
+
<title-group>
|
|
6
|
+
<title>Collection Title</title>
|
|
7
|
+
</title-group>
|
|
8
|
+
<volume-in-collection>
|
|
9
|
+
<volume-number>volume</volume-number>
|
|
10
|
+
</volume-in-collection>
|
|
11
|
+
<issn publication-format="print">issn</issn>
|
|
12
|
+
<publisher>
|
|
13
|
+
<publisher-name>American Mathematical Society</publisher-name>
|
|
14
|
+
<publisher-loc>Providence, Rhode Island</publisher-loc>
|
|
15
|
+
</publisher>
|
|
16
|
+
<custom-meta-group>
|
|
17
|
+
<custom-meta>
|
|
18
|
+
<meta-name>subseries</meta-name>
|
|
19
|
+
<meta-value>subseriesName</meta-value>
|
|
20
|
+
</custom-meta>
|
|
21
|
+
</custom-meta-group>
|
|
22
|
+
<contrib-group content-type="editors">
|
|
23
|
+
<contrib contrib-type="editor">
|
|
24
|
+
<string-name>An Editor</string-name>
|
|
25
|
+
</contrib>
|
|
26
|
+
</contrib-group>
|
|
27
|
+
</collection-meta>
|
|
28
|
+
<book-meta>
|
|
29
|
+
<book-id assigning-authority="AMS" book-id-type="publisher">series</book-id>
|
|
30
|
+
<book-id assigning-authority="AMS" book-id-type="volume_id">volume</book-id>
|
|
31
|
+
<book-id assigning-authority="crossref" book-id-type="doi">doi</book-id>
|
|
32
|
+
<book-id assigning-authority="Library of Congress" book-id-type="lccn">0123456789</book-id>
|
|
33
|
+
<book-title-group>
|
|
34
|
+
<book-title>title</book-title>
|
|
35
|
+
<subtitle>subtitle</subtitle>
|
|
36
|
+
</book-title-group>
|
|
37
|
+
<book-volume-number>volume</book-volume-number>
|
|
38
|
+
<book-issue-number>issue</book-issue-number>
|
|
39
|
+
<book-issue-note>issue note</book-issue-note>
|
|
40
|
+
<publisher>
|
|
41
|
+
<publisher-name>name1</publisher-name>
|
|
42
|
+
<publisher-loc>loc</publisher-loc>
|
|
43
|
+
</publisher>
|
|
44
|
+
<publisher>
|
|
45
|
+
<publisher-name>name2</publisher-name>
|
|
46
|
+
</publisher>
|
|
47
|
+
<contrib-group content-type="authors">
|
|
48
|
+
<contrib contrib-type="author">
|
|
49
|
+
<contrib-id contrib-id-type="orcid">orcidid</contrib-id>
|
|
50
|
+
<contrib-id contrib-id-type="mrauth">mrauthid</contrib-id>
|
|
51
|
+
<name name-style="western">
|
|
52
|
+
<surname>Sur</surname>
|
|
53
|
+
<given-names>Given</given-names>
|
|
54
|
+
<suffix>Jr.</suffix>
|
|
55
|
+
</name>
|
|
56
|
+
<xref ref-type="aff" rid="aff1"/>
|
|
57
|
+
<email>email</email>
|
|
58
|
+
<uri>uri</uri>
|
|
59
|
+
</contrib>
|
|
60
|
+
<aff id="aff1">aff</aff>
|
|
61
|
+
<role>comment</role>
|
|
62
|
+
</contrib-group>
|
|
63
|
+
<contrib-group content-type="contrib-group-type2">
|
|
64
|
+
<contrib contrib-type="contrib-type2">
|
|
65
|
+
<name name-style="western">
|
|
66
|
+
<surname>Sur</surname>
|
|
67
|
+
<given-names>Given</given-names>
|
|
68
|
+
</name>
|
|
69
|
+
</contrib>
|
|
70
|
+
</contrib-group>
|
|
71
|
+
<contrib-group content-type="contrib-group-type3">
|
|
72
|
+
<role>comment</role>
|
|
73
|
+
<contrib contrib-type="contrib-type3">
|
|
74
|
+
<name name-style="given-only">
|
|
75
|
+
<given-names>should be ignored</given-names>
|
|
76
|
+
</name>
|
|
77
|
+
<string-name>String Name</string-name>
|
|
78
|
+
</contrib>
|
|
79
|
+
</contrib-group>
|
|
80
|
+
<history>
|
|
81
|
+
<date date-type="issue-date" iso-8601-date="2025-01-01">
|
|
82
|
+
<day>1</day>
|
|
83
|
+
<month>1</month>
|
|
84
|
+
<year>2025</year>
|
|
85
|
+
</date>
|
|
86
|
+
<date date-type="xml-last-modified" iso-8601-date="2025-04-25T03:14:18Z">
|
|
87
|
+
<string-date>2025-04-25T03:14:18Z</string-date>
|
|
88
|
+
</date>
|
|
89
|
+
</history>
|
|
90
|
+
<pub-date iso-8601-date="2025-01-14">
|
|
91
|
+
<day>14</day>
|
|
92
|
+
<month>1</month>
|
|
93
|
+
<year>2025</year>
|
|
94
|
+
</pub-date>
|
|
95
|
+
<issn publication-format="print">issn print</issn>
|
|
96
|
+
<isbn publication-format="electronic">isbn pdf</isbn>
|
|
97
|
+
<isbn publication-format="google">isbn google pdf</isbn>
|
|
98
|
+
<isbn publication-format="print">isbn print</isbn>
|
|
99
|
+
<isbn publication-format="epub">isbn epub</isbn>
|
|
100
|
+
<permissions>
|
|
101
|
+
<copyright-statement>Copyright 2020 American Mathematical Society</copyright-statement>
|
|
102
|
+
<copyright-year>2020</copyright-year>
|
|
103
|
+
<copyright-holder>American Mathematical Society</copyright-holder>
|
|
104
|
+
</permissions>
|
|
105
|
+
<self-uri content-type="abstract" xlink:href="https://www.ams.org/memo/1537/">https://www.ams.org/memo/1537/</self-uri>
|
|
106
|
+
<self-uri content-type="pdf" xlink:href="https://www.ams.org/memo/1537/memo1537.pdf">https://www.ams.org/memo/1537/memo1537.pdf</self-uri>
|
|
107
|
+
<abstract xml:lang="en">
|
|
108
|
+
<title>Abstract<x>.</x></title>
|
|
109
|
+
<p>Book abstract</p>
|
|
110
|
+
</abstract>
|
|
111
|
+
<kwd-group kwd-group-type="author">
|
|
112
|
+
<kwd>author keyword</kwd>
|
|
113
|
+
</kwd-group>
|
|
114
|
+
<kwd-group vocab="MSC 2020" vocab-identifier="https://mathscinet.ams.org/msc/msc2020.html">
|
|
115
|
+
<compound-kwd content-type="primary">
|
|
116
|
+
<compound-kwd-part content-type="code">11A63</compound-kwd-part>
|
|
117
|
+
<compound-kwd-part content-type="text">Radix representation; digital problems</compound-kwd-part>
|
|
118
|
+
</compound-kwd>
|
|
119
|
+
</kwd-group>
|
|
120
|
+
<funding-group>
|
|
121
|
+
<funding-statement>The authors were supported.</funding-statement>
|
|
122
|
+
</funding-group>
|
|
123
|
+
</book-meta>
|
|
124
|
+
<front-matter>
|
|
125
|
+
<toc id="toc">
|
|
126
|
+
<title-group>
|
|
127
|
+
<title>Contents</title>
|
|
128
|
+
</title-group>
|
|
129
|
+
<toc-entry specific-use="chapter">
|
|
130
|
+
<title>Chunk</title>
|
|
131
|
+
<nav-pointer rid="tocid1"/>
|
|
132
|
+
</toc-entry>
|
|
133
|
+
</toc>
|
|
134
|
+
</front-matter>
|
|
135
|
+
<book-body>
|
|
136
|
+
<book-part>
|
|
137
|
+
<body>
|
|
138
|
+
<sec disp-level="1" id="chapter2" specific-use="chapter">
|
|
139
|
+
<title>Title</title>
|
|
140
|
+
</sec>
|
|
141
|
+
</body>
|
|
142
|
+
</book-part>
|
|
143
|
+
</book-body>
|
|
144
|
+
</book>
|
|
@@ -74,8 +74,12 @@
|
|
|
74
74
|
"permissions": {
|
|
75
75
|
"copyrightStatement": "Copyright 2020 American Mathematical Society"
|
|
76
76
|
},
|
|
77
|
+
"history": {
|
|
78
|
+
"published": "2025-04-25"
|
|
79
|
+
},
|
|
77
80
|
"collection": {
|
|
78
81
|
"title": "Collection Title",
|
|
79
|
-
"subseries": "subseriesName"
|
|
82
|
+
"subseries": "subseriesName",
|
|
83
|
+
"contributors":{}
|
|
80
84
|
}
|
|
81
85
|
}
|
package/test/book.xml
CHANGED
|
@@ -70,6 +70,11 @@
|
|
|
70
70
|
<string-name>String Name</string-name>
|
|
71
71
|
</contrib>
|
|
72
72
|
</contrib-group>
|
|
73
|
+
<pub-date iso-8601-date="2025-04-25">
|
|
74
|
+
<day>25</day>
|
|
75
|
+
<month>4</month>
|
|
76
|
+
<year>2025</year>
|
|
77
|
+
</pub-date>
|
|
73
78
|
<issn publication-format="print">issn print</issn>
|
|
74
79
|
<isbn publication-format="electronic">isbn pdf</isbn>
|
|
75
80
|
<isbn publication-format="google">isbn google pdf</isbn>
|
|
@@ -15,15 +15,16 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
import { book } from './helper.js';
|
|
18
|
+
import { book, bookMetadata } from './helper.js';
|
|
19
19
|
import tape from 'tape';
|
|
20
20
|
|
|
21
21
|
import { createRequire } from "module";
|
|
22
22
|
const require = createRequire(import.meta.url);
|
|
23
23
|
const jsonSnapshot = require('./book-meta-snapshot.json');
|
|
24
|
+
const jsonSnapshot2 = require('./book--metadata-meta-snapshot.json');
|
|
24
25
|
|
|
25
26
|
tape('Template: book-meta', async function (t) {
|
|
26
|
-
t.plan(
|
|
27
|
+
t.plan(7);
|
|
27
28
|
|
|
28
29
|
const document = book;
|
|
29
30
|
const titlepage = document.querySelector('section[data-ams-doc="titlepage"]');
|
|
@@ -32,6 +33,17 @@ tape('Template: book-meta', async function (t) {
|
|
|
32
33
|
const jsonScript = titlepage.querySelector('script[type="application/json"]');
|
|
33
34
|
const jsonData = JSON.parse(jsonScript.textContent);
|
|
34
35
|
|
|
35
|
-
t.deepEqual(jsonData, jsonSnapshot, 'JSON metadata');
|
|
36
|
+
t.deepEqual(jsonData, jsonSnapshot, 'JSON metadata for book.xml');
|
|
36
37
|
|
|
38
|
+
const document2 = bookMetadata;
|
|
39
|
+
const jsonScript2 = document2.querySelector('script[type="application/json"]');
|
|
40
|
+
const jsonData2 = JSON.parse(jsonScript2.textContent);
|
|
41
|
+
|
|
42
|
+
t.deepEqual(jsonData2, jsonSnapshot2, 'JSON metadata book-metadata.xml');
|
|
43
|
+
|
|
44
|
+
const abstractWrapper = document2.querySelector('[data-ams-doc="abstract"]');
|
|
45
|
+
t.ok(abstractWrapper, 'book-meta creates wrapper for abstract');
|
|
46
|
+
t.ok(abstractWrapper.querySelector(':scope > [role="doc-abstract"]'), 'wrapper for abstract contains abstract');
|
|
47
|
+
t.ok(abstractWrapper.querySelector(':scope > [data-ams-doc="keywords"]'), 'wrapper for abstract contains keywords');
|
|
48
|
+
t.ok(abstractWrapper.querySelector(':scope > [data-ams-doc="MSC 2020"]'), 'wrapper for abstract contains MSCs');
|
|
37
49
|
});
|
package/test/helper.js
CHANGED
|
@@ -28,3 +28,5 @@ export const articleNometa = xml2html(fs.readFileSync(path.resolve(__dirname, 'a
|
|
|
28
28
|
fs.writeFileSync(path.join(__dirname, 'snapshots', 'article--nometa.html'), articleNometa.toString())
|
|
29
29
|
export const book = xml2html(fs.readFileSync(path.resolve(__dirname, 'book.xml')).toString()).window.document;
|
|
30
30
|
fs.writeFileSync(path.join(__dirname, 'snapshots', 'book.html'), book.toString())
|
|
31
|
+
export const bookMetadata = xml2html(fs.readFileSync(path.resolve(__dirname, 'book--metadata.xml')).toString()).window.document;
|
|
32
|
+
fs.writeFileSync(path.join(__dirname, 'snapshots', 'book--metadata.html'), bookMetadata.toString())
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2025 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 "../../lib/helpers/generateByline.js";
|
|
18
|
+
import tape from 'tape';
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
tape('Helpers: generateByline', async function (t) {
|
|
22
|
+
t.plan(3);
|
|
23
|
+
|
|
24
|
+
let sample = {
|
|
25
|
+
"contribAs": [
|
|
26
|
+
{
|
|
27
|
+
"name": "Given Sur",
|
|
28
|
+
"byline": "comment"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "Given2 Sur2",
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"contribBs": [
|
|
35
|
+
{
|
|
36
|
+
"name": "Given Sur Jr.",
|
|
37
|
+
"byline": "comment"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
t.equal(generateByline(sample), 'comment Given Sur and Given2 Sur2, comment Given Sur Jr.', 'generatByline: 2 contrib-groups, 2 contributors');
|
|
43
|
+
|
|
44
|
+
sample = {
|
|
45
|
+
"contribAs": [
|
|
46
|
+
{
|
|
47
|
+
"name": "Given Sur",
|
|
48
|
+
"byline": "comment"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "Given2 Sur2",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "Given Sur Jr.",
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
t.equal(generateByline(sample), 'comment Given Sur, Given2 Sur2, and Given Sur Jr.', 'generatByline: 1 contrib-groups, 3 contributors');
|
|
60
|
+
|
|
61
|
+
sample = {
|
|
62
|
+
"contribAs": [
|
|
63
|
+
{
|
|
64
|
+
"name": "Given Sur",
|
|
65
|
+
"byline": "comment"
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
"contribBs": [
|
|
69
|
+
{
|
|
70
|
+
"name": "Given2 Sur2",
|
|
71
|
+
"byline": "comment"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "Given Sur Jr.",
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"contribCs": [
|
|
78
|
+
{
|
|
79
|
+
"name": "Given Sur3",
|
|
80
|
+
"byline": "comment"
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
t.equal(generateByline(sample), 'comment Given Sur, comment Given2 Sur2 and Given Sur Jr., comment Given Sur3', 'generatByline: 3 contrib-groups, 1+2+1 contributors');
|
|
86
|
+
});
|
|
87
|
+
|
|
@@ -344,7 +344,6 @@
|
|
|
344
344
|
<section id="graphics" data-ams-doc="section" data-ams-doc-level="1">
|
|
345
345
|
<figure data-ams-doc="fig">
|
|
346
346
|
<img alt="text" data-ams-height="100pt" data-ams-width="100px" data-ams-style="use" src="file" data-ams-doc="graphic">
|
|
347
|
-
|
|
348
347
|
</figure>
|
|
349
348
|
<img alt="Graphic without alt text" data-ams-height="height" data-ams-width="width" data-ams-style="use" src="file" data-ams-doc="inline-graphic">
|
|
350
349
|
<img alt="text" src="file">
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!DOCTYPE html> <html dir="ltr" lang="en"><head><meta charset="utf-8"><meta content="width=device-width, initial-scale=1" name="viewport"><title>title</title></head><body>
|
|
2
|
+
|
|
3
|
+
<section data-ams-doc="titlepage"><script type="application/json">{"book":{"identifiers":{"AMS":{"publKey":"series","volumeId":"volume","volumeNr":"volume","issueNr":"issue"},"crossref":{"doi":"doi"},"issn":{"print":"issn print"},"isbn":{"electronic":"isbn pdf","google":"isbn google pdf","print":"isbn print","epub":"isbn epub"},"loc":{"lccn":"0123456789"},"basename":"seriesissue"},"title":"title","subtitle":"subtitle","alttitle":"title"},"publishers":[{"name":"name1","location":"loc"},{"name":"name2"}],"contributors":{"authors":[{"name":"Given Sur Jr.","bio":"","affiliations":["aff"],"emails":["email"],"mrauth":"mrauthid","orcid":"orcidid","uri":"uri","byline":"comment"}],"contrib-group-type2":[{"name":"Given Sur","bio":"","affiliations":[],"emails":[]}],"contrib-group-type3":[{"name":"String Name","bio":"","affiliations":[],"emails":[],"byline":"comment"}]},"permissions":{"copyrightStatement":"Copyright 2020 American Mathematical Society"},"history":{"published":"2025-01-14","issue":"2025-01-01","rev-recd":[]},"collection":{"title":"Collection Title","subseries":"subseriesName","contributors":{"editors":[{"name":"An Editor","bio":"","affiliations":[],"emails":[]}]}},"issue":{"number":"issue","note":"issue note","date":"2025-01-01"}}</script></section><section data-ams-doc="abstract"><section lang="en" role="doc-abstract" data-ams-doc-level="1"><h2><span data-ams-doc="title">Abstract<ams-x>.</ams-x></span></h2>
|
|
4
|
+
|
|
5
|
+
<p>Book abstract</p>
|
|
6
|
+
</section><ul data-ams-doc="keywords">
|
|
7
|
+
<li>author keyword</li>
|
|
8
|
+
</ul><ul data-ams-doc="MSC 2020">
|
|
9
|
+
<li data-msc-key="11A63" data-msc-role="primary">Radix representation; digital problems</li>
|
|
10
|
+
</ul><div data-ams-doc="funding-group">
|
|
11
|
+
<p>The authors were supported.</p>
|
|
12
|
+
</div></section>
|
|
13
|
+
|
|
14
|
+
<nav id="toc" data-ams-doc-level="0" role="doc-toc"><h1><span data-ams-doc="title">Contents</span></h1><ol><li><a data-ams-ref="chapter" href="#tocid1"><span data-ams-doc="title">Chunk</span></a></li></ol></nav>
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
<section role="doc-chapter" id="chapter2" data-ams-doc="chapter" data-ams-doc-level="0"><h1><span data-ams-doc="title">Title</span></h1>
|
|
20
|
+
|
|
21
|
+
</section>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
</body></html>
|
package/test/snapshots/book.html
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!DOCTYPE html> <html dir="ltr" lang="en"><head><meta charset="utf-8"><meta content="width=device-width, initial-scale=1" name="viewport"><title>title</title></head><body>
|
|
2
2
|
|
|
3
|
-
<section data-ams-doc="titlepage"><script type="application/json">{"book":{"identifiers":{"AMS":{"publKey":"series","volumeId":"volume","volumeNr":"volume"},"crossref":{"doi":"doi"},"issn":{"print":"issn print"},"isbn":{"electronic":"isbn pdf","google":"isbn google pdf","print":"isbn print","epub":"isbn epub"},"loc":{"lccn":"0123456789"},"basename":"seriesvolume"},"title":"title","subtitle":"subtitle","alttitle":"title"},"publishers":[{"name":"name1","location":"loc"},{"name":"name2"}],"contributors":{"authors":[{"name":"Given Sur Jr.","bio":"","affiliations":["aff"],"emails":["email"],"mrauth":"mrauthid","orcid":"orcidid","uri":"uri","byline":"comment"}],"contrib-group-type2":[{"name":"Given Sur","bio":"","affiliations":[],"emails":[]}],"contrib-group-type3":[{"name":"String Name","bio":"","affiliations":[],"emails":[],"byline":"comment"}]},"permissions":{"copyrightStatement":"Copyright 2020 American Mathematical Society"},"collection":{"title":"Collection Title","subseries":"subseriesName"}}</script></section>
|
|
3
|
+
<section data-ams-doc="titlepage"><script type="application/json">{"book":{"identifiers":{"AMS":{"publKey":"series","volumeId":"volume","volumeNr":"volume"},"crossref":{"doi":"doi"},"issn":{"print":"issn print"},"isbn":{"electronic":"isbn pdf","google":"isbn google pdf","print":"isbn print","epub":"isbn epub"},"loc":{"lccn":"0123456789"},"basename":"seriesvolume"},"title":"title","subtitle":"subtitle","alttitle":"title"},"publishers":[{"name":"name1","location":"loc"},{"name":"name2"}],"contributors":{"authors":[{"name":"Given Sur Jr.","bio":"","affiliations":["aff"],"emails":["email"],"mrauth":"mrauthid","orcid":"orcidid","uri":"uri","byline":"comment"}],"contrib-group-type2":[{"name":"Given Sur","bio":"","affiliations":[],"emails":[]}],"contrib-group-type3":[{"name":"String Name","bio":"","affiliations":[],"emails":[],"byline":"comment"}]},"permissions":{"copyrightStatement":"Copyright 2020 American Mathematical Society"},"history":{"published":"2025-04-25"},"collection":{"title":"Collection Title","subseries":"subseriesName","contributors":{}}}</script></section>
|
|
4
4
|
|
|
5
5
|
<nav id="toc" data-ams-doc-level="0" role="doc-toc"><h1><span data-ams-doc="title">Contents</span></h1><ol><li><a data-ams-ref="chapter" href="#tocid1"><span data-ams-doc="title">Chunk</span></a></li><li><a data-ams-ref="null" href="#tocid2"><span data-ams-doc="label">2<ams-x>.</ams-x></span> <span data-ams-doc="title">Chunk</span></a><ol><li><a data-ams-ref="null" href="#tocid3"><span data-ams-doc="label">1</span> <span data-ams-doc="title">SubChunk</span></a><ol><li><a data-ams-ref="null" href="#tocid4"><span data-ams-doc="label">1</span> <span data-ams-doc="title">SubSubChunk with <span data-ams-href="chapter">Link</span></span></a></li></ol></li></ol></li><li><a data-ams-doc-alttitle="Alt title" data-ams-ref="null" href="#tocid5"><span data-ams-doc="title">Chunk with alt title</span></a></li><li><a data-ams-ref="null" href="#tocid6"><span data-ams-doc="title">Chunk without label but subchunk with label</span></a><ol><li><a data-ams-ref="null" href="#tocid7"><span data-ams-doc="label">1</span> <span data-ams-doc="title">SubChunk</span></a></li></ol></li><li><a data-ams-ref="null" href="#tocid8"><span data-ams-doc="title">Chunk with contrib</span></a><br><em>Chapter Author</em></li><li><a data-ams-ref="null" href="#tocid9"><span data-ams-doc="title">Chunk with multiple contribs</span></a><br><em>Chapter Author</em>, <em>A Nother Author</em></li></ol></nav>
|
|
6
6
|
<section data-ams-doc-level="0" data-ams-content-type="publishers-note" data-ams-doc="notes" data-ams-specific-use="epub-opening-page"><h1><span data-ams-doc="title">Publisher's Notice</span></h1>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!DOCTYPE html> <html dir="ltr" lang="en"><head><meta charset="utf-8"><meta content="width=device-width, initial-scale=1" name="viewport"><title>AMS Publication</title></head><body>
|
|
2
|
-
<section data-ams-doc="titlepage"><script type="application/json">{"book":{"identifiers":{"AMS":{},"crossref":{},"issn":{},"isbn":{},"loc":{},"basename":null},"title":""},"publishers":[],"contributors":{},"permissions":{}}</script></section>
|
|
2
|
+
<section data-ams-doc="titlepage"><script type="application/json">{"book":{"identifiers":{"AMS":{},"crossref":{},"issn":{},"isbn":{},"loc":{},"basename":null},"title":""},"publishers":[],"contributors":{},"permissions":{},"history":{}}</script></section>
|
|
3
3
|
<section role="doc-chapter" id="ltxid1" data-ams-doc="chapter" data-ams-doc-level="0"><h1><span data-ams-doc="label">Chapter 1</span> <span data-ams-doc="title">Chapter heading</span></h1>
|
|
4
4
|
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!DOCTYPE html> <html dir="ltr" lang="en"><head><meta charset="utf-8"><meta content="width=device-width, initial-scale=1" name="viewport"><title>A First Course in Spectral Theory</title></head><body>
|
|
2
2
|
|
|
3
|
-
<section data-ams-doc="titlepage"><script type="application/json">{"book":{"identifiers":{"AMS":{"publKey":"gsm","volumeId":"lukic","volumeNr":"226"},"crossref":{"doi":"10.1090/gsm/226"},"issn":{},"isbn":{"electronic":"978-1-4704-7191-0","print":"978-1-4704-6656-5","softcover":"978-1-4704-7192-7","epub":"978-1-4704-7661-8"},"loc":{"lccn":"2022028354"},"basename":"gsm226"},"title":"A First Course in Spectral Theory","alttitle":"A First Course in Spectral Theory"},"publishers":[{"name":"American Mathematical Society","location":"Providence, Rhode Island"}],"contributors":{"authors":[{"name":"Milivoje Lukić","bio":"","affiliations":["Rice University, Houston, TX"],"emails":[]}]},"permissions":{"copyrightStatement":"Copyright 2022 American Mathematical Society"},"collection":{"title":"Graduate Studies in Mathematics"}}</script></section>
|
|
3
|
+
<section data-ams-doc="titlepage"><script type="application/json">{"book":{"identifiers":{"AMS":{"publKey":"gsm","volumeId":"lukic","volumeNr":"226"},"crossref":{"doi":"10.1090/gsm/226"},"issn":{},"isbn":{"electronic":"978-1-4704-7191-0","print":"978-1-4704-6656-5","softcover":"978-1-4704-7192-7","epub":"978-1-4704-7661-8"},"loc":{"lccn":"2022028354"},"basename":"gsm226"},"title":"A First Course in Spectral Theory","alttitle":"A First Course in Spectral Theory"},"publishers":[{"name":"American Mathematical Society","location":"Providence, Rhode Island"}],"contributors":{"authors":[{"name":"Milivoje Lukić","bio":"","affiliations":["Rice University, Houston, TX"],"emails":[]}]},"permissions":{"copyrightStatement":"Copyright 2022 American Mathematical Society"},"history":{"published":"2023-01-04"},"collection":{"title":"Graduate Studies in Mathematics","contributors":{}}}</script></section>
|
|
4
4
|
|
|
5
5
|
<nav id="ltxid2" data-ams-doc-level="0" role="doc-toc"><h1><span data-ams-doc="title">Contents</span></h1><ol><li><a data-ams-ref="epub-opening-page" href="#ltxid3"><span data-ams-doc="title">Publisher’s Notice</span></a></li></ol></nav>
|
|
6
6
|
<section data-ams-doc-level="0" data-ams-content-type="publishers-note" data-ams-doc="notes" data-ams-specific-use="epub-opening-page" id="ltxid3"><h1><span data-ams-doc="title">Publisher’s Notice</span></h1>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!DOCTYPE html> <html dir="ltr" lang="en"><head><meta charset="utf-8"><meta content="width=device-width, initial-scale=1" name="viewport"><title>AMS Publication</title></head><body>
|
|
2
|
-
<section data-ams-doc="titlepage"><script type="application/json">{"book":{"identifiers":{"AMS":{},"crossref":{},"issn":{},"isbn":{"electronic":"978-1-4704-7191-0","print":"978-1-4704-6656-5","softcover":"978-1-4704-7192-7","epub":"978-1-4704-7661-8"},"loc":{},"basename":null},"title":"","alttitle":"A First Course in Spectral Theory"},"publishers":[
|
|
2
|
+
<section data-ams-doc="titlepage"><script type="application/json">{"book":{"identifiers":{"AMS":{},"crossref":{},"issn":{},"isbn":{"electronic":"978-1-4704-7191-0","print":"978-1-4704-6656-5","softcover":"978-1-4704-7192-7","epub":"978-1-4704-7661-8"},"loc":{},"basename":null},"title":"","alttitle":"A First Course in Spectral Theory"},"publishers":[],"contributors":{},"permissions":{},"history":{},"collection":{"title":"Graduate Studies in Mathematics","contributors":{}}}</script></section>
|
|
3
3
|
<nav id="ltxid1" data-ams-doc-level="0" role="doc-toc"><h1><span data-ams-doc="title">Contents</span></h1><ol><li><a data-ams-ref="epub-opening-page" href="#ltxid2"><span data-ams-doc="title">Publisher’s Notice</span></a></li><li><a data-ams-ref="chapter" href="#ltxid3"><span data-ams-doc="label">Chapter 1<ams-x>.</ams-x></span> <span data-ams-doc="title">Chapter heading</span></a><ol><li><a data-ams-ref="section" href="#ltxid4"><span data-ams-doc="label"><ams-x>§</ams-x>1<ams-x>.</ams-x></span> <span data-ams-doc="title">Section heading</span></a><ol><li><a data-ams-ref="subsection" href="#ltxid5"><span data-ams-doc="label">1.1<ams-x>.</ams-x></span> <span data-ams-doc="title">Subsection heading</span></a></li></ol></li></ol></li><li><a data-ams-ref="chapter" href="#ltxid8"><span data-ams-doc="label">Appendix A<ams-x>.</ams-x></span> <span data-ams-doc="title">A Numbered Appendix</span></a></li><li><a data-ams-ref="chapter" href="#ltxid9"><span data-ams-doc="title">An Unnumbered Appendix</span></a></li></ol></nav>
|
|
4
4
|
<section data-ams-doc-level="0" data-ams-content-type="publishers-note" data-ams-doc="notes" data-ams-specific-use="epub-opening-page" id="ltxid2"><h1><span data-ams-doc="title">Publisher’s Notice</span></h1>
|
|
5
5
|
|