@amermathsoc/texml-to-html 18.2.0 → 18.4.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 +16 -0
- package/README.md +1 -0
- package/lib/elements/abstract.js +1 -0
- package/lib/elements/book-meta-json.js +18 -3
- package/package.json +1 -1
- package/test/article--alttitle.xml +1 -1
- package/test/book--metadata-meta-snapshot.json +97 -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-abstract-title.js +5 -2
- package/test/element-book-meta.js +9 -3
- package/test/helper.js +2 -0
- package/test/helpers/generateByline.js +87 -0
- package/test/snapshots/article--alttitle.html +1 -1
- package/test/snapshots/book--metadata.html +16 -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,22 @@
|
|
|
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.4.0](https://github.com/AmerMathSoc/texml-to-html/compare/v18.3.0...v18.4.0) (2025-05-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **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)
|
|
11
|
+
* **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)
|
|
12
|
+
* **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)
|
|
13
|
+
|
|
14
|
+
## [18.3.0](https://github.com/AmerMathSoc/texml-to-html/compare/v18.2.0...v18.3.0) (2025-02-24)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **abstract.js:** support lang attribute ([4f27f2a](https://github.com/AmerMathSoc/texml-to-html/commit/4f27f2a1f87951e4020ec3add9087b6806162f5e)), closes [#474](https://github.com/AmerMathSoc/texml-to-html/issues/474)
|
|
20
|
+
|
|
5
21
|
## [18.2.0](https://github.com/AmerMathSoc/texml-to-html/compare/v18.1.0...v18.2.0) (2025-02-05)
|
|
6
22
|
|
|
7
23
|
|
package/README.md
CHANGED
package/lib/elements/abstract.js
CHANGED
|
@@ -29,6 +29,7 @@ export default function (htmlParentNode, xmlnode) {
|
|
|
29
29
|
role: 'doc-abstract'
|
|
30
30
|
});
|
|
31
31
|
mapAttributes(section, xmlnode);
|
|
32
|
+
if (xmlnode.getAttribute('xml:lang')) section.setAttribute('lang', xmlnode.getAttribute('xml:lang')); // NOTE: after AmerMathSoc/texml#192, we may want a more general solution (e.g., mapAttributes())
|
|
32
33
|
htmlParentNode.appendChild(section);
|
|
33
34
|
this.createHeading(section, xmlnode);
|
|
34
35
|
this.passThrough(section, xmlnode);
|
|
@@ -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,7 @@ 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);
|
|
134
149
|
}
|
|
135
150
|
|
|
136
151
|
return JSON.stringify(bookMetaJson);
|
package/package.json
CHANGED
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
</history>
|
|
85
85
|
<article-id pub-id-type="doi">doi</article-id>
|
|
86
86
|
<article-id pub-id-type="pii">pii</article-id>
|
|
87
|
-
<abstract/>
|
|
87
|
+
<abstract xml:lang="fr"/>
|
|
88
88
|
</article-meta>
|
|
89
89
|
<journal-meta>
|
|
90
90
|
<journal-id journal-id-type="publisher">journalId</journal-id>
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
"publishers": [
|
|
32
|
+
{
|
|
33
|
+
"name": "name1",
|
|
34
|
+
"location": "loc"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "name2"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"contributors": {
|
|
41
|
+
"authors": [
|
|
42
|
+
{
|
|
43
|
+
"name": "Given Sur Jr.",
|
|
44
|
+
"bio": "",
|
|
45
|
+
"affiliations": [
|
|
46
|
+
"aff"
|
|
47
|
+
],
|
|
48
|
+
"emails": [
|
|
49
|
+
"email"
|
|
50
|
+
],
|
|
51
|
+
"mrauth": "mrauthid",
|
|
52
|
+
"orcid": "orcidid",
|
|
53
|
+
"uri": "uri",
|
|
54
|
+
"byline": "comment"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"contrib-group-type2": [
|
|
58
|
+
{
|
|
59
|
+
"name": "Given Sur",
|
|
60
|
+
"bio": "",
|
|
61
|
+
"affiliations": [],
|
|
62
|
+
"emails": []
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"contrib-group-type3": [
|
|
66
|
+
{
|
|
67
|
+
"name": "String Name",
|
|
68
|
+
"bio": "",
|
|
69
|
+
"affiliations": [],
|
|
70
|
+
"emails": [],
|
|
71
|
+
"byline": "comment"
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"permissions": {
|
|
76
|
+
"copyrightStatement": "Copyright 2020 American Mathematical Society"
|
|
77
|
+
},
|
|
78
|
+
"history": {
|
|
79
|
+
"published": "2025-01-14",
|
|
80
|
+
"rev-recd": [],
|
|
81
|
+
"issue": "2025-01-01"
|
|
82
|
+
},
|
|
83
|
+
"collection": {
|
|
84
|
+
"title": "Collection Title",
|
|
85
|
+
"subseries": "subseriesName",
|
|
86
|
+
"contributors": {
|
|
87
|
+
"editors": [
|
|
88
|
+
{
|
|
89
|
+
"name": "An Editor",
|
|
90
|
+
"bio": "",
|
|
91
|
+
"affiliations": [],
|
|
92
|
+
"emails": []
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -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>
|
|
@@ -14,14 +14,17 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { article } from './helper.js';
|
|
17
|
+
import { article, articleAlttitle } from './helper.js';
|
|
18
18
|
import tape from 'tape';
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
tape('abstract, abstract/title', async function(t) {
|
|
22
|
-
t.plan(
|
|
22
|
+
t.plan(4);
|
|
23
23
|
const document = article;
|
|
24
24
|
const abstract = document.querySelector('section[data-ams-doc-level="1"][role="doc-abstract"]');
|
|
25
25
|
t.ok(abstract, 'Abstract as Section with data-ams-doc-level 1, role doc-abstract');
|
|
26
26
|
t.ok(abstract.querySelector('h2'), 'Abstract title as h2');
|
|
27
|
+
t.notOk(abstract.hasAttribute('lang'), 'abstract without lang')
|
|
28
|
+
const document2 = articleAlttitle;
|
|
29
|
+
t.equal(document2.querySelector('[role="doc-abstract"]').getAttribute('lang'), 'fr', 'Abstract with lang')
|
|
27
30
|
});
|
|
@@ -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(3);
|
|
27
28
|
|
|
28
29
|
const document = book;
|
|
29
30
|
const titlepage = document.querySelector('section[data-ams-doc="titlepage"]');
|
|
@@ -32,6 +33,11 @@ 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');
|
|
37
43
|
});
|
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
|
+
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
]
|
|
93
93
|
},
|
|
94
94
|
"keywords": []
|
|
95
|
-
}</script><header><h1>article-title</h1><p data-ams-doc="subtitle">article-subtitle</p></header><section data-ams-content-type="article" data-ams-doc="notes"></section><section role="doc-abstract" data-ams-doc-level="1"></section><ul data-ams-doc="keywords"></ul><div data-ams-doc="funding-group">
|
|
95
|
+
}</script><header><h1>article-title</h1><p data-ams-doc="subtitle">article-subtitle</p></header><section data-ams-content-type="article" data-ams-doc="notes"></section><section lang="fr" role="doc-abstract" data-ams-doc-level="1"></section><ul data-ams-doc="keywords"></ul><div data-ams-doc="funding-group">
|
|
96
96
|
<p></p>
|
|
97
97
|
</div></section>
|
|
98
98
|
|
|
@@ -0,0 +1,16 @@
|
|
|
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":[]}]}}}</script></section>
|
|
4
|
+
|
|
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></ol></nav>
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
<section role="doc-chapter" id="chapter2" data-ams-doc="chapter" data-ams-doc-level="0"><h1><span data-ams-doc="title">Title</span></h1>
|
|
11
|
+
|
|
12
|
+
</section>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
</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
|
|