@amermathsoc/texml-to-html 16.1.0 → 17.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 +18 -0
- package/README.md +7 -0
- package/lib/hacks.js +1 -1
- package/lib/helpers/extractContribGroups.js +4 -4
- package/package.json +1 -1
- package/test/article--alttitle.xml +3 -3
- package/test/article.xml +4 -2
- package/test/book.xml +4 -4
- package/test/element-sec-meta.js +1 -1
- package/test/hacks.js +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [17.0.0](https://github.com/AmerMathSoc/texml-to-html/compare/v16.1.1...v17.0.0) (2024-06-07)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
* Expects role instead author-comment
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* adjust to texml renaming author-comment to role ([c46822b](https://github.com/AmerMathSoc/texml-to-html/commit/c46822b9e6cbd96de1893c8e138f3f14df48492c)), closes [#449](https://github.com/AmerMathSoc/texml-to-html/issues/449)
|
|
15
|
+
|
|
16
|
+
### [16.1.1](https://github.com/AmerMathSoc/texml-to-html/compare/v16.1.0...v16.1.1) (2024-06-03)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* **hacks.js:** treat custom elements like phrasing content ([ab7c158](https://github.com/AmerMathSoc/texml-to-html/commit/ab7c1583a635f095de6dc9c3315ceb4c3a50d63e)), closes [#447](https://github.com/AmerMathSoc/texml-to-html/issues/447)
|
|
22
|
+
|
|
5
23
|
## [16.1.0](https://github.com/AmerMathSoc/texml-to-html/compare/v16.0.0...v16.1.0) (2024-06-03)
|
|
6
24
|
|
|
7
25
|
|
package/README.md
CHANGED
|
@@ -46,6 +46,11 @@ Some elements in texml's XML output have the same name (and purpose) as in HTML.
|
|
|
46
46
|
- tr
|
|
47
47
|
- td
|
|
48
48
|
|
|
49
|
+
The following custom tag names are preserved:
|
|
50
|
+
|
|
51
|
+
- cite-group (wrapper around citations)
|
|
52
|
+
- cite-detail (wrapper for optional argument of `\cite`)
|
|
53
|
+
|
|
49
54
|
### preseved attributes
|
|
50
55
|
|
|
51
56
|
Some attributes in texml's XML output have the same name (and purpose) in HTML.
|
|
@@ -132,6 +137,7 @@ Beyond HTML element and attributes, texml-to-html stores data in custom `data-*`
|
|
|
132
137
|
- {@ref-type} [expected: bibr, fn, disp-formula, sec, fig, table, algorithm, list, statement]
|
|
133
138
|
- notrid
|
|
134
139
|
- fn-return [added in ams-html output]
|
|
140
|
+
- `toc-entry@specific-use` [expected: section, chapter, etc.]
|
|
135
141
|
- data-ams-doc-level
|
|
136
142
|
- [0-9]
|
|
137
143
|
- data-ams-content-type
|
|
@@ -240,6 +246,7 @@ The following provide a list from the reverse point of view.
|
|
|
240
246
|
- notes => section with data-ams-doc="notes"
|
|
241
247
|
- @notes-type => @data-ams-content-type (and role=dedication for dedications)
|
|
242
248
|
- use cases: dedication (articles), article and section notes (NOTI only), drm notice & epub note (books)
|
|
249
|
+
- toc-entry@specific-use => data-ams-ref
|
|
243
250
|
- attributes
|
|
244
251
|
- @disp-level => data-ams-doc-level [data-ams-doc-level is also added to some elements that lack disp-level]
|
|
245
252
|
- @content-type => data-ams-content-type
|
package/lib/hacks.js
CHANGED
|
@@ -23,7 +23,7 @@ const phrasingContentTags = ['abbr', 'audio', 'b', 'bdo', 'br', 'button', 'canva
|
|
|
23
23
|
*/
|
|
24
24
|
const sanitizeParagraph = node => {
|
|
25
25
|
const childrenArray = [...node.children];
|
|
26
|
-
const maybeBadChild = childrenArray.find(child => !phrasingContentTags.includes(child.tagName.toLowerCase()));
|
|
26
|
+
const maybeBadChild = childrenArray.find(child => (!child.tagName.includes('-') && !phrasingContentTags.includes(child.tagName.toLowerCase()))); // check for content that is not phrasing conetnt and not a custom element name.
|
|
27
27
|
if (!maybeBadChild) return;
|
|
28
28
|
console.log(`Info: texml-to-html: fixing non-phrasing in paragraph, cf. texml#104, near ID ${node.closest('[id]')?.getAttribute('id')}`)
|
|
29
29
|
const remainingChildren = childrenArray.slice(childrenArray.indexOf(maybeBadChild)).reverse();
|
|
@@ -75,14 +75,14 @@ export function extractContribGroups(articleMetaNode) {
|
|
|
75
75
|
contributor.orcid = contrib.querySelector('contrib-id[contrib-id-type="orcid"]')?.textContent;
|
|
76
76
|
|
|
77
77
|
contributor.uri = contrib.querySelector('uri')?.textContent;
|
|
78
|
-
//
|
|
79
|
-
const
|
|
80
|
-
if (index === 0 &&
|
|
78
|
+
// role (NOTE: child of contrib-group but it's easier if we copy it to each contributor)
|
|
79
|
+
const role = contrib.parentNode.querySelector('role')?.textContent;
|
|
80
|
+
if (index === 0 && role) contributor.byline = role;
|
|
81
81
|
contributorsArray.push(contributor);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
const extractContribGroup = function (contributors, contribGroup) {
|
|
85
|
-
contributors[contribGroup.getAttribute('content-type')] ??= []; // NOTE: jams410 has 2 contrib-groups with content-type=contributors (but different
|
|
85
|
+
contributors[contribGroup.getAttribute('content-type')] ??= []; // NOTE: jams410 has 2 contrib-groups with content-type=contributors (but different roles); cf. #408
|
|
86
86
|
contribGroup.querySelectorAll('contrib').forEach(extractContrib.bind(this, contributors[contribGroup.getAttribute('content-type')]));
|
|
87
87
|
};
|
|
88
88
|
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<bio>Some biographical info with <email>email</email></bio>
|
|
19
19
|
</contrib>
|
|
20
20
|
<aff id="aff">aff</aff>
|
|
21
|
-
<
|
|
21
|
+
<role>comment</role>
|
|
22
22
|
</contrib-group>
|
|
23
23
|
<contrib-group content-type="contribBs">
|
|
24
24
|
<contrib contrib-type="contribB">
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
</contrib>
|
|
37
37
|
<aff id="aff1" specific-use="current">Aff1</aff>
|
|
38
38
|
<aff id="aff2">Aff2</aff>
|
|
39
|
-
<
|
|
39
|
+
<role>comment</role>
|
|
40
40
|
</contrib-group>
|
|
41
41
|
<funding-group>
|
|
42
42
|
<funding-statement/>
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
</contrib>
|
|
119
119
|
</contrib-group>
|
|
120
120
|
<contrib-group content-type="contributors">
|
|
121
|
-
<
|
|
121
|
+
<role>with</role>
|
|
122
122
|
<contrib contrib-type="contributor">
|
|
123
123
|
<string-name>Author 2</string-name>
|
|
124
124
|
<bio>Author 2 Bio</bio>
|
package/test/article.xml
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
<uri>uri</uri>
|
|
48
48
|
</contrib>
|
|
49
49
|
<aff id="aff">aff</aff>
|
|
50
|
-
<
|
|
50
|
+
<role>comment</role>
|
|
51
51
|
</contrib-group>
|
|
52
52
|
<contrib-group content-type="contribBs">
|
|
53
53
|
<contrib contrib-type="contribB">
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
</contrib>
|
|
67
67
|
<aff id="aff1" specific-use="current">Aff1</aff>
|
|
68
68
|
<aff id="aff2">Aff2</aff>
|
|
69
|
-
<
|
|
69
|
+
<role>comment</role>
|
|
70
70
|
</contrib-group>
|
|
71
71
|
<funding-group>
|
|
72
72
|
<funding-statement>Funding 1</funding-statement>
|
|
@@ -422,7 +422,9 @@
|
|
|
422
422
|
</sec>
|
|
423
423
|
<!-- citegroup, cite-detail-->
|
|
424
424
|
<sec disp-level="1" id="citegroup" specific-use="section">
|
|
425
|
+
<p>
|
|
425
426
|
<cite-group><x>[</x><xref ref-type="bibr" rid="bibr-AEG0" specific-use="cite">AEG08<cite-detail><x>, </x>Section 5</cite-detail></xref><x>; </x><xref ref-type="bibr" rid="bibr-AEG0" specific-use="cite">AEG08</xref><x>]</x></cite-group>
|
|
427
|
+
</p>
|
|
426
428
|
</sec>
|
|
427
429
|
|
|
428
430
|
<!-- alt-title -->
|
package/test/book.xml
CHANGED
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
<uri>uri</uri>
|
|
52
52
|
</contrib>
|
|
53
53
|
<aff id="aff1">aff</aff>
|
|
54
|
-
<
|
|
54
|
+
<role>comment</role>
|
|
55
55
|
</contrib-group>
|
|
56
56
|
<contrib-group content-type="contrib-group-type2">
|
|
57
57
|
<contrib contrib-type="contrib-type2">
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
</contrib>
|
|
63
63
|
</contrib-group>
|
|
64
64
|
<contrib-group content-type="contrib-group-type3">
|
|
65
|
-
<
|
|
65
|
+
<role>comment</role>
|
|
66
66
|
<contrib contrib-type="contrib-type3">
|
|
67
67
|
<name name-style="given-only">
|
|
68
68
|
<given-names>should be ignored</given-names>
|
|
@@ -218,9 +218,9 @@
|
|
|
218
218
|
<sec-meta>
|
|
219
219
|
<contrib-group>
|
|
220
220
|
<!-- NOTE: this contrib-group example is for MCL 1, 14 only; intentionally broken via #254 -->
|
|
221
|
-
<
|
|
221
|
+
<role>
|
|
222
222
|
comment
|
|
223
|
-
</
|
|
223
|
+
</role>
|
|
224
224
|
</contrib-group>
|
|
225
225
|
<abstract>
|
|
226
226
|
<title>Abstract</title>
|
package/test/element-sec-meta.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { article, articleAlttitle, book } from './helper.js';
|
|
18
18
|
import tape from 'tape';
|
|
19
19
|
|
|
20
|
-
tape('Template: sec-meta => contrib-group,
|
|
20
|
+
tape('Template: sec-meta => contrib-group, role, abstract/title', async function (t) {
|
|
21
21
|
t.plan(10);
|
|
22
22
|
|
|
23
23
|
const document = book;
|
package/test/hacks.js
CHANGED
|
@@ -19,7 +19,7 @@ import tape from 'tape';
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
tape('Hacks', async function (t) {
|
|
22
|
-
t.plan(
|
|
22
|
+
t.plan(5);
|
|
23
23
|
const document = article;
|
|
24
24
|
|
|
25
25
|
// moved from test/element-def-list-def-item-def-term.js (for the old def-list.js hack of "move DL after its P parent")
|
|
@@ -33,5 +33,9 @@ tape('Hacks', async function (t) {
|
|
|
33
33
|
t.equal(firstDT.innerHTML, '1', 'DLs moved out of paragraph appear in the correct oder');
|
|
34
34
|
|
|
35
35
|
t.equal(document.querySelectorAll('#hacks > p').length, 1, 'If paragraph is empty after postprocessing, it is removed.')
|
|
36
|
+
|
|
37
|
+
console.log(article.querySelector('cite-group').parentNode.outerHTML)
|
|
38
|
+
|
|
39
|
+
t.equal(document.querySelector('cite-group').parentNode.tagName, 'P', 'Custom elements remain in paragraph');
|
|
36
40
|
});
|
|
37
41
|
|