@amermathsoc/texml-to-html 16.1.0 → 16.1.1

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,13 @@
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
+ ### [16.1.1](https://github.com/AmerMathSoc/texml-to-html/compare/v16.1.0...v16.1.1) (2024-06-03)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **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)
11
+
5
12
  ## [16.1.0](https://github.com/AmerMathSoc/texml-to-html/compare/v16.0.0...v16.1.0) (2024-06-03)
6
13
 
7
14
 
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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amermathsoc/texml-to-html",
3
- "version": "16.1.0",
3
+ "version": "16.1.1",
4
4
  "type": "module",
5
5
  "description": "A NodeJS library for converting AMS-style JATS XML to HTML",
6
6
  "scripts": {
package/test/article.xml CHANGED
@@ -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/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(4);
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