@amermathsoc/texml-to-html 15.1.1 → 15.2.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,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
+ ## [15.2.0](https://github.com/AmerMathSoc/texml-to-html/compare/v15.1.1...v15.2.0) (2024-03-29)
6
+
7
+
8
+ ### Features
9
+
10
+ * **formula.js:** mapAttributes() but from tex-math ([3e1f603](https://github.com/AmerMathSoc/texml-to-html/commit/3e1f603032d278fccc138bd20c2eda746a8f32e2)), closes [#441](https://github.com/AmerMathSoc/texml-to-html/issues/441)
11
+
5
12
  ### [15.1.1](https://github.com/AmerMathSoc/texml-to-html/compare/v15.1.0...v15.1.1) (2023-12-13)
6
13
 
7
14
 
@@ -14,6 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
+ import mapAttributes from '../helpers/mapAttributes.js';
18
+
17
19
  /**
18
20
  * inline-formula and disp-formula element
19
21
  * @param {HTMLElement} htmlParentNode
@@ -38,12 +40,11 @@ export default function (htmlParentNode, xmlnode) {
38
40
  const span = this.createNode('span', '', {
39
41
  'data-ams-doc': `math ${mathMode}`
40
42
  });
43
+ mapAttributes(span, xmlnode.querySelector('tex-math'));
41
44
  htmlParentNode.appendChild(span);
42
45
  const hasLinkedTag = xmlnode.querySelector('target tag');
43
46
  const tagContainer = `<span hidden data-ams-doc="tags"></span>`; //NOTE we store copies of tags for easier re-use downstream (cf. tags.js) except for text equations
44
47
  if (hasLinkedTag) span.insertAdjacentHTML('afterbegin', tagContainer)
45
- if (mathMode === 'block' && xmlnode.querySelector('tex-math[has-qed-box]'))
46
- span.setAttribute('data-ams-qed-box', 'true');
47
48
  this.passThrough(span, xmlnode);
48
49
  // NOTE we (sometimes?) get extra whitespace from childnodes; needs test
49
50
  const text = span.innerHTML;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amermathsoc/texml-to-html",
3
- "version": "15.1.1",
3
+ "version": "15.2.0",
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
@@ -384,7 +384,7 @@
384
384
  <tex-math><text>Te#t </text><xref ref-type="fn" rid="fnid1">1</xref><fn id="fnid"><label>1</label><p><xref ref-type="fn" rid="fnid1">1</xref></p></fn><xref ref-type="other" rid="otherid1"></xref></tex-math>
385
385
  </inline-formula>
386
386
  </p>
387
- <disp-formula><tex-math has-qed-box="true"><xref ref-type="fn" rid="fnid2">2</xref><fn id="fnid2"><label/></fn><text>Start<xref ref-type="other" rid="otherid2">$</xref>End</text></tex-math></disp-formula>
387
+ <disp-formula><tex-math has-qed-box="true" specific-use="special"><xref ref-type="fn" rid="fnid2">2</xref><fn id="fnid2"><label/></fn><text>Start<xref ref-type="other" rid="otherid2">$</xref>End</text></tex-math></disp-formula>
388
388
  <disp-formula>
389
389
  <tex-math>
390
390
  <text><roman>roman#</roman> <sc>sc$</sc> <italic>italic_</italic> <bold>bold$</bold> <sans-serif>sans-serif&amp;</sans-serif> <monospace>monospace</monospace> <ext-link xlink:href="https://ext~">ext-link~</ext-link> inside text</text>
@@ -18,7 +18,7 @@ import { article } from './helper.js';
18
18
  import tape from 'tape';
19
19
 
20
20
  tape('inline-formula, disp-formula, tex-math', async function (t) {
21
- t.plan(18);
21
+ t.plan(19);
22
22
  const document = article;
23
23
  const inlineformula = document.querySelector(
24
24
  '#equations [data-ams-doc="math inline"]'
@@ -55,6 +55,11 @@ tape('inline-formula, disp-formula, tex-math', async function (t) {
55
55
  'true',
56
56
  'has-qed-box'
57
57
  );
58
+ t.equal(
59
+ displayformula.getAttribute('data-ams-specific-use'),
60
+ 'special',
61
+ 'disp-formula gets attributes from tex-math mapped'
62
+ );
58
63
  t.ok(
59
64
  displayformula.innerHTML.includes('\\xhref[fn]{#fnid2}{{}^{2}}'),
60
65
  'tex-math/xref@ref-type="fn"'