@amermathsoc/texml-to-html 18.4.0 → 18.6.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 CHANGED
@@ -2,6 +2,26 @@
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.6.0](https://github.com/AmerMathSoc/texml-to-html/compare/v18.5.0...v18.6.0) (2025-06-12)
6
+
7
+
8
+ ### Features
9
+
10
+ * **graphic.js:** adjust to new alt-text placement ([1468543](https://github.com/AmerMathSoc/texml-to-html/commit/146854336e3ef3cc6a34a6b70cfb522bd6ceceb2)), closes [#477](https://github.com/AmerMathSoc/texml-to-html/issues/477)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **package:** upgrade linkedom@0.18.10 ([06d48ac](https://github.com/AmerMathSoc/texml-to-html/commit/06d48ac562b9627c3b6b2e55647526ca2af58937))
16
+
17
+ ## [18.5.0](https://github.com/AmerMathSoc/texml-to-html/compare/v18.4.0...v18.5.0) (2025-05-19)
18
+
19
+
20
+ ### Features
21
+
22
+ * **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)
23
+ * **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)
24
+
5
25
  ## [18.4.0](https://github.com/AmerMathSoc/texml-to-html/compare/v18.3.0...v18.4.0) (2025-05-05)
6
26
 
7
27
 
@@ -148,6 +148,15 @@ export function generateBookJson(bookMetaNode) {
148
148
  bookMetaJson.collection.contributors = this.extractContribGroups(collectionMeta);
149
149
  }
150
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
+ }
158
+ }
159
+
151
160
  return JSON.stringify(bookMetaJson);
152
161
  };
153
162
 
@@ -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
  };
@@ -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
- // NOTE We assume alt-text appears only in figures; cf. AmerMathSoc/texml#55
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amermathsoc/texml-to-html",
3
- "version": "18.4.0",
3
+ "version": "18.6.0",
4
4
  "type": "module",
5
5
  "description": "A NodeJS library for converting AMS-style JATS XML to HTML",
6
6
  "scripts": {
@@ -31,11 +31,11 @@
31
31
  },
32
32
  "homepage": "https://github.com/AmerMathSoc/texml-to-html#readme",
33
33
  "devDependencies": {
34
- "c8": "8.0.1",
35
- "commit-and-tag-version": "12.4.1",
36
- "tape": "5.7.2"
34
+ "c8": "10.1.3",
35
+ "commit-and-tag-version": "12.5.1",
36
+ "tape": "5.9.0"
37
37
  },
38
38
  "dependencies": {
39
- "linkedom": "0.16.4"
39
+ "linkedom": "0.18.10"
40
40
  }
41
41
  }
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>
@@ -28,6 +28,11 @@
28
28
  "subtitle": "subtitle",
29
29
  "alttitle": "title"
30
30
  },
31
+ "issue": {
32
+ "number": "issue",
33
+ "note": "issue note",
34
+ "date": "2025-01-01"
35
+ },
31
36
  "publishers": [
32
37
  {
33
38
  "name": "name1",
@@ -102,24 +102,24 @@
102
102
  <copyright-year>2020</copyright-year>
103
103
  <copyright-holder>American Mathematical Society</copyright-holder>
104
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>
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
123
  </book-meta>
124
124
  <front-matter>
125
125
  <toc id="toc">
@@ -24,7 +24,7 @@ const jsonSnapshot = require('./book-meta-snapshot.json');
24
24
  const jsonSnapshot2 = require('./book--metadata-meta-snapshot.json');
25
25
 
26
26
  tape('Template: book-meta', async function (t) {
27
- t.plan(3);
27
+ t.plan(8);
28
28
 
29
29
  const document = book;
30
30
  const titlepage = document.querySelector('section[data-ams-doc="titlepage"]');
@@ -40,4 +40,11 @@ tape('Template: book-meta', async function (t) {
40
40
  const jsonData2 = JSON.parse(jsonScript2.textContent);
41
41
 
42
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');
49
+ t.ok(abstractWrapper.querySelector(':scope > [data-ams-doc="funding-group"]'), 'wrapper for abstract contains funding statement');
43
50
  });
@@ -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">
@@ -1,6 +1,15 @@
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","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>
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>
4
13
 
5
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>
6
15
 
@@ -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>AMS Publication</title></head><body><section data-ams-doc="article">
2
2
  <p>hello, world</p>
3
3
  <p>
4
- <a href="https://math.mit.edu/~drew/rk6.html#foo?x&5">TEXT</a>
4
+ <a href="https://math.mit.edu/~drew/rk6.html#foo?x&amp;5">TEXT</a>
5
5
  </p>
6
6
  </section></body></html>
@@ -33,11 +33,11 @@
33
33
 
34
34
  <section id="ltxid3" data-ams-doc="section" data-ams-doc-level="1">
35
35
  <p>
36
- <a href="https://www.ams.org/%A}#B&C_D~E$F^G{H\I">https://www.ams.org/%A}#B&amp;C_D~E$F^G{H\I</a>
36
+ <a href="https://www.ams.org/%A}#B&amp;C_D~E$F^G{H\I">https://www.ams.org/%A}#B&amp;C_D~E$F^G{H\I</a>
37
37
  </p>
38
- <p>1: <a href="https://www.ams.org/%A}#B&C_D~E$F^G{H\I">link text</a></p>
39
- <p>2: <a href="https://www.ams.org/%A#B&C_D~E$F^G{H\I">https://www.ams.org/%A#B&amp;C_D~E$F^G{H\I</a></p>
40
- <p>3: <a href="https://www.ams.org/%A#B&C_D~E$F^G{H\I">First piece Second piece</a></p>
38
+ <p>1: <a href="https://www.ams.org/%A}#B&amp;C_D~E$F^G{H\I">link text</a></p>
39
+ <p>2: <a href="https://www.ams.org/%A#B&amp;C_D~E$F^G{H\I">https://www.ams.org/%A#B&amp;C_D~E$F^G{H\I</a></p>
40
+ <p>3: <a href="https://www.ams.org/%A#B&amp;C_D~E$F^G{H\I">First piece Second piece</a></p>
41
41
  </section>
42
42
 
43
43
  </section></body></html>
@@ -32,10 +32,10 @@
32
32
  }</script><h1>url (hyperref)</h1></section>
33
33
 
34
34
  <section id="ltxid3" data-ams-doc="section" data-ams-doc-level="1">
35
- <p>1: <a href="https://www.ams.org/%A#B&C_D~E$F^G{H}\I">https://www.ams.org/%A#B&amp;C_D~E$F^G{H}\I</a></p>
36
- <p>2: <a href="https://www.ams.org/%A#B&C_D~E$F^G{H}\I">https://www.ams.org/%A#B&amp;C_D~E$F^G{H}\I</a></p>
37
- <p>3: <a href="https://www.ams.org/%A#B&C_D~E$F^G{H}\I">https://www.ams.org/%A#B&amp;C_D~E$F^G{H}\I</a></p>
38
- <p>4: <a href="https://www.ams.org/%A#B&C_D~E$F^G{H}\I">https://www.ams.org/%A#B&amp;C_D~E$F^G{H}\I</a></p>
35
+ <p>1: <a href="https://www.ams.org/%A#B&amp;C_D~E$F^G{H}\I">https://www.ams.org/%A#B&amp;C_D~E$F^G{H}\I</a></p>
36
+ <p>2: <a href="https://www.ams.org/%A#B&amp;C_D~E$F^G{H}\I">https://www.ams.org/%A#B&amp;C_D~E$F^G{H}\I</a></p>
37
+ <p>3: <a href="https://www.ams.org/%A#B&amp;C_D~E$F^G{H}\I">https://www.ams.org/%A#B&amp;C_D~E$F^G{H}\I</a></p>
38
+ <p>4: <a href="https://www.ams.org/%A#B&amp;C_D~E$F^G{H}\I">https://www.ams.org/%A#B&amp;C_D~E$F^G{H}\I</a></p>
39
39
  </section>
40
40
 
41
41
  </section></body></html>