@manuscripts/transform 3.0.66 → 3.0.67-LEAN-2023.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.
Files changed (90) hide show
  1. package/dist/cjs/jats/__tests__/citations.js +24 -0
  2. package/dist/cjs/jats/__tests__/create-article-node.test.js +26 -0
  3. package/dist/cjs/jats/__tests__/data/section-categories.js +207 -0
  4. package/dist/cjs/jats/__tests__/files.js +27 -0
  5. package/dist/cjs/jats/__tests__/jats-exporter.test.js +210 -0
  6. package/dist/cjs/jats/__tests__/jats-importer.test.js +501 -0
  7. package/dist/cjs/jats/__tests__/jats-roundtrip.test.js +58 -0
  8. package/dist/cjs/jats/__tests__/utils.js +110 -0
  9. package/dist/cjs/jats/exporter/jats-exporter.js +69 -58
  10. package/dist/cjs/jats/exporter/labels.js +1 -2
  11. package/dist/cjs/jats/importer/jats-dom-parser.js +47 -39
  12. package/dist/cjs/jats/importer/jats-journal-meta-parser.js +13 -13
  13. package/dist/cjs/jats/importer/jats-parser-utils.js +40 -15
  14. package/dist/cjs/jats/importer/jats-transformations.js +13 -21
  15. package/dist/cjs/lib/__tests__/footnotes.test.js +19 -0
  16. package/dist/cjs/lib/credit-roles.js +76 -0
  17. package/dist/cjs/lib/utils.js +19 -4
  18. package/dist/cjs/schema/__tests__/groups.test.js +56 -0
  19. package/dist/cjs/schema/__tests__/migration.test.js +33 -0
  20. package/dist/cjs/schema/marks.js +14 -2
  21. package/dist/cjs/schema/migration/migration-scripts/1.2.5.js +7 -1
  22. package/dist/cjs/schema/migration/migration-scripts/2.3.22.js +4 -1
  23. package/dist/cjs/schema/migration/migration-scripts/3.0.12.js +5 -3
  24. package/dist/cjs/schema/migration/migration-scripts/3.0.21.js +7 -1
  25. package/dist/cjs/schema/migration/migration-scripts/3.0.30.js +4 -3
  26. package/dist/cjs/schema/migration/migration-scripts/3.0.31.js +5 -2
  27. package/dist/cjs/schema/migration/migration-scripts/3.0.41.js +7 -1
  28. package/dist/cjs/schema/migration/migration-scripts/3.0.55.js +8 -1
  29. package/dist/cjs/schema/nodes/bibliography_item.js +0 -1
  30. package/dist/cjs/schema/nodes/box_element.js +4 -1
  31. package/dist/cjs/schema/nodes/citation.js +1 -2
  32. package/dist/cjs/schema/nodes/contributor.js +1 -0
  33. package/dist/cjs/schema/nodes/cross_reference.js +1 -2
  34. package/dist/cjs/schema/nodes/inline_footnote.js +1 -2
  35. package/dist/cjs/schema/nodes/table.js +12 -3
  36. package/dist/cjs/schema/nodes/text.js +6 -2
  37. package/dist/cjs/version.js +1 -1
  38. package/dist/es/jats/__tests__/citations.js +21 -0
  39. package/dist/es/jats/__tests__/create-article-node.test.js +24 -0
  40. package/dist/es/jats/__tests__/data/section-categories.js +204 -0
  41. package/dist/es/jats/__tests__/files.js +19 -0
  42. package/dist/es/jats/__tests__/jats-exporter.test.js +208 -0
  43. package/dist/es/jats/__tests__/jats-importer.test.js +499 -0
  44. package/dist/es/jats/__tests__/jats-roundtrip.test.js +56 -0
  45. package/dist/es/jats/__tests__/utils.js +102 -0
  46. package/dist/es/jats/exporter/jats-exporter.js +69 -58
  47. package/dist/es/jats/exporter/labels.js +1 -2
  48. package/dist/es/jats/importer/jats-dom-parser.js +48 -40
  49. package/dist/es/jats/importer/jats-journal-meta-parser.js +13 -13
  50. package/dist/es/jats/importer/jats-parser-utils.js +40 -15
  51. package/dist/es/jats/importer/jats-transformations.js +13 -21
  52. package/dist/es/lib/__tests__/footnotes.test.js +17 -0
  53. package/dist/es/lib/credit-roles.js +73 -0
  54. package/dist/es/lib/utils.js +17 -3
  55. package/dist/es/schema/__tests__/groups.test.js +54 -0
  56. package/dist/es/schema/__tests__/migration.test.js +8 -0
  57. package/dist/es/schema/marks.js +14 -2
  58. package/dist/es/schema/migration/migration-scripts/1.2.5.js +7 -1
  59. package/dist/es/schema/migration/migration-scripts/2.3.22.js +4 -1
  60. package/dist/es/schema/migration/migration-scripts/3.0.12.js +5 -3
  61. package/dist/es/schema/migration/migration-scripts/3.0.21.js +7 -1
  62. package/dist/es/schema/migration/migration-scripts/3.0.30.js +4 -3
  63. package/dist/es/schema/migration/migration-scripts/3.0.31.js +5 -2
  64. package/dist/es/schema/migration/migration-scripts/3.0.41.js +7 -1
  65. package/dist/es/schema/migration/migration-scripts/3.0.55.js +8 -1
  66. package/dist/es/schema/nodes/bibliography_item.js +0 -1
  67. package/dist/es/schema/nodes/box_element.js +4 -1
  68. package/dist/es/schema/nodes/citation.js +1 -2
  69. package/dist/es/schema/nodes/contributor.js +1 -0
  70. package/dist/es/schema/nodes/cross_reference.js +1 -2
  71. package/dist/es/schema/nodes/inline_footnote.js +1 -2
  72. package/dist/es/schema/nodes/table.js +12 -3
  73. package/dist/es/schema/nodes/text.js +6 -2
  74. package/dist/es/version.js +1 -1
  75. package/dist/types/jats/__tests__/citations.d.ts +21 -0
  76. package/dist/types/jats/__tests__/create-article-node.test.d.ts +16 -0
  77. package/dist/types/jats/__tests__/data/section-categories.d.ts +17 -0
  78. package/dist/types/jats/__tests__/files.d.ts +17 -0
  79. package/dist/types/jats/__tests__/jats-exporter.test.d.ts +16 -0
  80. package/dist/types/jats/__tests__/jats-importer.test.d.ts +16 -0
  81. package/dist/types/jats/__tests__/jats-roundtrip.test.d.ts +16 -0
  82. package/dist/types/jats/__tests__/utils.d.ts +32 -0
  83. package/dist/types/lib/__tests__/footnotes.test.d.ts +1 -0
  84. package/dist/types/lib/credit-roles.d.ts +32 -0
  85. package/dist/types/lib/utils.d.ts +2 -1
  86. package/dist/types/schema/__tests__/groups.test.d.ts +16 -0
  87. package/dist/types/schema/__tests__/migration.test.d.ts +1 -0
  88. package/dist/types/schema/nodes/contributor.d.ts +6 -0
  89. package/dist/types/version.d.ts +1 -1
  90. package/package.json +48 -47
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2024 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.DEFAULT_CSL_OPTIONS = exports.csl = exports.defaultLocale = void 0;
19
+ exports.defaultLocale = '<?xml version="1.0" encoding="utf-8"?><locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0" xml:lang="en-US"><info><translator><name>Andrew Dunning</name></translator><translator><name>Sebastian Karcher</name></translator><translator><name>Rintze M. Zelle</name></translator><translator><name>Denis Meier</name></translator><translator><name>Brenton M. Wiernik</name></translator><rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights><updated>2015-10-10T23:31:02+00:00</updated></info><style-options punctuation-in-quote="true"/><date form="text"><date-part name="month" suffix=" "/><date-part name="day" suffix=", "/><date-part name="year"/></date><date form="numeric"><date-part name="month" form="numeric-leading-zeros" suffix="/"/><date-part name="day" form="numeric-leading-zeros" suffix="/"/><date-part name="year"/></date><terms><term name="advance-online-publication">advance online publication</term><term name="album">album</term><term name="audio-recording">audio recording</term><term name="film">film</term><term name="henceforth">henceforth</term><term name="loc-cit">loc. cit.</term><!-- like ibid., the abbreviated form is the regular form --><term name="no-place">no place</term><term name="no-place" form="short">n.p.</term><term name="no-publisher">no publisher</term><!-- sine nomine --><term name="no-publisher" form="short">n.p.</term><term name="on">on</term><term name="op-cit">op. cit.</term><!-- like ibid., the abbreviated form is the regular form --><term name="original-work-published">original work published</term><term name="personal-communication">personal communication</term><term name="podcast">podcast</term><term name="podcast-episode">podcast episode</term><term name="preprint">preprint</term><term name="radio-broadcast">radio broadcast</term><term name="radio-series">radio series</term><term name="radio-series-episode">radio series episode</term><term name="special-issue">special issue</term><term name="special-section">special section</term><term name="television-broadcast">television broadcast</term><term name="television-series">television series</term><term name="television-series-episode">television series episode</term><term name="video">video</term><term name="working-paper">working paper</term><term name="accessed">accessed</term><term name="and">and</term><term name="and others">and others</term><term name="anonymous">anonymous</term><term name="anonymous" form="short">anon.</term><term name="at">at</term><term name="available at">available at</term><term name="by">by</term><term name="circa">circa</term><term name="circa" form="short">c.</term><term name="cited">cited</term><term name="edition"><single>edition</single><multiple>editions</multiple></term><term name="edition" form="short">ed.</term><term name="et-al">et al.</term><term name="forthcoming">forthcoming</term><term name="from">from</term><term name="ibid">ibid.</term><term name="in">in</term><term name="in press">in press</term><term name="internet">internet</term><term name="letter">letter</term><term name="no date">no date</term><term name="no date" form="short">n.d.</term><term name="online">online</term><term name="presented at">presented at the</term><term name="reference"><single>reference</single><multiple>references</multiple></term><term name="reference" form="short"><single>ref.</single><multiple>refs.</multiple></term><term name="retrieved">retrieved</term><term name="scale">scale</term><term name="version">version</term><!-- LONG ITEM TYPE FORMS --><term name="article">preprint</term><term name="article-journal">journal article</term><term name="article-magazine">magazine article</term><term name="article-newspaper">newspaper article</term><term name="bill">bill</term><!-- book is in the list of locator terms --><term name="broadcast">broadcast</term><!-- chapter is in the list of locator terms --><term name="classic">classic</term><term name="collection">collection</term><term name="dataset">dataset</term><term name="document">document</term><term name="entry">entry</term><term name="entry-dictionary">dictionary entry</term><term name="entry-encyclopedia">encyclopedia entry</term><term name="event">event</term><!-- figure is in the list of locator terms --><term name="graphic">graphic</term><term name="hearing">hearing</term><term name="interview">interview</term><term name="legal_case">legal case</term><term name="legislation">legislation</term><term name="manuscript">manuscript</term><term name="map">map</term><term name="motion_picture">video recording</term><term name="musical_score">musical score</term><term name="pamphlet">pamphlet</term><term name="paper-conference">conference paper</term><term name="patent">patent</term><term name="performance">performance</term><term name="periodical">periodical</term><term name="personal_communication">personal communication</term><term name="post">post</term><term name="post-weblog">blog post</term><term name="regulation">regulation</term><term name="report">report</term><term name="review">review</term><term name="review-book">book review</term><term name="software">software</term><term name="song">audio recording</term><term name="speech">presentation</term><term name="standard">standard</term><term name="thesis">thesis</term><term name="treaty">treaty</term><term name="webpage">webpage</term><!-- SHORT ITEM TYPE FORMS --><term name="article-journal" form="short">journal art.</term><term name="article-magazine" form="short">mag. art.</term><term name="article-newspaper" form="short">newspaper art.</term><!-- book is in the list of locator terms --><!-- chapter is in the list of locator terms --><term name="document" form="short">doc.</term><!-- figure is in the list of locator terms --><term name="graphic" form="short">graph.</term><term name="interview" form="short">interv.</term><term name="manuscript" form="short">MS</term><term name="motion_picture" form="short">video rec.</term><term name="report" form="short">rep.</term><term name="review" form="short">rev.</term><term name="review-book" form="short">bk. rev.</term><term name="song" form="short">audio rec.</term><!-- HISTORICAL ERA TERMS --><term name="ad">AD</term><term name="bc">BC</term><term name="bce">BCE</term><term name="ce">CE</term><!-- PUNCTUATION --><term name="open-quote">“</term><term name="close-quote">”</term><term name="open-inner-quote">‘</term><term name="close-inner-quote">’</term><term name="page-range-delimiter">–</term><term name="colon">:</term><term name="comma">,</term><term name="semicolon">;</term><!-- ORDINALS --><term name="ordinal">th</term><term name="ordinal-01">st</term><term name="ordinal-02">nd</term><term name="ordinal-03">rd</term><term name="ordinal-11">th</term><term name="ordinal-12">th</term><term name="ordinal-13">th</term><!-- LONG ORDINALS --><term name="long-ordinal-01">first</term><term name="long-ordinal-02">second</term><term name="long-ordinal-03">third</term><term name="long-ordinal-04">fourth</term><term name="long-ordinal-05">fifth</term><term name="long-ordinal-06">sixth</term><term name="long-ordinal-07">seventh</term><term name="long-ordinal-08">eighth</term><term name="long-ordinal-09">ninth</term><term name="long-ordinal-10">tenth</term><!-- LONG LOCATOR FORMS --><term name="act"><single>act</single><multiple>acts</multiple></term><term name="appendix"><single>appendix</single><multiple>appendices</multiple></term><term name="article-locator"><single>article</single><multiple>articles</multiple></term><term name="canon"><single>canon</single><multiple>canons</multiple></term><term name="elocation"><single>location</single><multiple>locations</multiple></term><term name="equation"><single>equation</single><multiple>equations</multiple></term><term name="rule"><single>rule</single><multiple>rules</multiple></term><term name="scene"><single>scene</single><multiple>scenes</multiple></term><term name="table"><single>table</single><multiple>tables</multiple></term><term name="utils"><!-- generally blank --><single></single><multiple></multiple></term><term name="title-locator"><single>title</single><multiple>titles</multiple></term><term name="book"><single>book</single><multiple>books</multiple></term><term name="chapter"><single>chapter</single><multiple>chapters</multiple></term><term name="column"><single>column</single><multiple>columns</multiple></term><term name="figure"><single>figure</single><multiple>figures</multiple></term><term name="folio"><single>folio</single><multiple>folios</multiple></term><term name="issue"><single>number</single><multiple>numbers</multiple></term><term name="line"><single>line</single><multiple>lines</multiple></term><term name="note"><single>note</single><multiple>notes</multiple></term><term name="opus"><single>opus</single><multiple>opera</multiple></term><term name="page"><single>page</single><multiple>pages</multiple></term><term name="number-of-pages"><single>page</single><multiple>pages</multiple></term><term name="paragraph"><single>paragraph</single><multiple>paragraphs</multiple></term><term name="part"><single>part</single><multiple>parts</multiple></term><term name="section"><single>section</single><multiple>sections</multiple></term><term name="sub-verbo"><single>sub verbo</single><multiple>sub verbis</multiple></term><term name="verse"><single>verse</single><multiple>verses</multiple></term><term name="volume"><single>volume</single><multiple>volumes</multiple></term><!-- SHORT LOCATOR FORMS --><term name="appendix" form="short"><single>app.</single><multiple>apps.</multiple></term><term name="article-locator" form="short"><single>art.</single><multiple>arts.</multiple></term><term name="elocation" form="short"><single>loc.</single><multiple>locs.</multiple></term><term name="equation" form="short"><single>eq.</single><multiple>eqs.</multiple></term><term name="rule" form="short"><single>r.</single><multiple>rr.</multiple></term><term name="scene" form="short"><single>sc.</single><multiple>scs.</multiple></term><term name="table" form="short"><single>tbl.</single><multiple>tbls.</multiple></term><term name="utils" form="short"><!-- generally blank --><single></single><multiple></multiple></term><term name="title-locator" form="short"><single>tit.</single><multiple>tits.</multiple></term><term name="book" form="short"><single>bk.</single><multiple>bks.</multiple></term><term name="chapter" form="short"><single>chap.</single><multiple>chaps.</multiple></term><term name="column" form="short"><single>col.</single><multiple>cols.</multiple></term><term name="figure" form="short"><single>fig.</single><multiple>figs.</multiple></term><term name="folio" form="short"><single>fol.</single><multiple>fols.</multiple></term><term name="issue" form="short"><single>no.</single><multiple>nos.</multiple></term><term name="line" form="short"><single>l.</single><multiple>ll.</multiple></term><term name="note" form="short"><single>n.</single><multiple>nn.</multiple></term><term name="opus" form="short"><single>op.</single><multiple>opp.</multiple></term><term name="page" form="short"><single>p.</single><multiple>pp.</multiple></term><term name="number-of-pages" form="short"><single>p.</single><multiple>pp.</multiple></term><term name="paragraph" form="short"><single>para.</single><multiple>paras.</multiple></term><term name="part" form="short"><single>pt.</single><multiple>pts.</multiple></term><term name="section" form="short"><single>sec.</single><multiple>secs.</multiple></term><term name="sub-verbo" form="short"><single>s.v.</single><multiple>s.vv.</multiple></term><term name="verse" form="short"><single>v.</single><multiple>vv.</multiple></term><term name="volume" form="short"><single>vol.</single><multiple>vols.</multiple></term><!-- SYMBOL LOCATOR FORMS --><term name="paragraph" form="symbol"><single>¶</single><multiple>¶¶</multiple></term><term name="section" form="symbol"><single>§</single><multiple>§§</multiple></term><!-- LONG ROLE FORMS --><term name="chair"><single>chair</single><multiple>chairs</multiple></term><term name="compiler"><single>compiler</single><multiple>compilers</multiple></term><term name="contributor"><single>contributor</single><multiple>contributors</multiple></term><term name="curator"><single>curator</single><multiple>curators</multiple></term><term name="executive-producer"><single>executive producer</single><multiple>executive producers</multiple></term><term name="guest"><single>guest</single><multiple>guests</multiple></term><term name="host"><single>host</single><multiple>hosts</multiple></term><term name="narrator"><single>narrator</single><multiple>narrators</multiple></term><term name="organizer"><single>organizer</single><multiple>organizers</multiple></term><term name="performer"><single>performer</single><multiple>performers</multiple></term><term name="producer"><single>producer</single><multiple>producers</multiple></term><term name="script-writer"><single>writer</single><multiple>writers</multiple></term><term name="series-creator"><single>series creator</single><multiple>series creators</multiple></term><term name="director"><single>director</single><multiple>directors</multiple></term><term name="editor"><single>editor</single><multiple>editors</multiple></term><term name="editorial-director"><single>editor</single><multiple>editors</multiple></term><term name="illustrator"><single>illustrator</single><multiple>illustrators</multiple></term><term name="translator"><single>translator</single><multiple>translators</multiple></term><term name="editortranslator"><single>editor &amp; translator</single><multiple>editors &amp; translators</multiple></term><!-- SHORT ROLE FORMS --><term name="compiler" form="short"><single>comp.</single><multiple>comps.</multiple></term><term name="contributor" form="short"><single>contrib.</single><multiple>contribs.</multiple></term><term name="curator" form="short"><single>cur.</single><multiple>curs.</multiple></term><term name="executive-producer" form="short"><single>exec. prod.</single><multiple>exec. prods.</multiple></term><term name="narrator" form="short"><single>narr.</single><multiple>narrs.</multiple></term><term name="organizer" form="short"><single>org.</single><multiple>orgs.</multiple></term><term name="performer" form="short"><single>perf.</single><multiple>perfs.</multiple></term><term name="producer" form="short"><single>prod.</single><multiple>prods.</multiple></term><term name="script-writer" form="short"><single>writ.</single><multiple>writs.</multiple></term><term name="series-creator" form="short"><single>cre.</single><multiple>cres.</multiple></term><term name="director" form="short"><single>dir.</single><multiple>dirs.</multiple></term><term name="editor" form="short"><single>ed.</single><multiple>eds.</multiple></term><term name="editorial-director" form="short"><single>ed.</single><multiple>eds.</multiple></term><term name="illustrator" form="short"><single>ill.</single><multiple>ills.</multiple></term><term name="translator" form="short"><single>tran.</single><multiple>trans.</multiple></term><term name="editortranslator" form="short"><single>ed. &amp; tran.</single><multiple>eds. &amp; trans.</multiple></term><!-- VERB ROLE FORMS --><term name="chair" form="verb">chaired by</term><term name="compiler" form="verb">compiled by</term><term name="contributor" form="verb">with</term><term name="curator" form="verb">curated by</term><term name="executive-producer" form="verb">executive produced by</term><term name="guest" form="verb">with guest</term><term name="host" form="verb">hosted by</term><term name="narrator" form="verb">narrated by</term><term name="organizer" form="verb">organized by</term><term name="performer" form="verb">performed by</term><term name="producer" form="verb">produced by</term><term name="script-writer" form="verb">written by</term><term name="series-creator" form="verb">created by</term><term name="container-author" form="verb">by</term><term name="director" form="verb">directed by</term><term name="editor" form="verb">edited by</term><term name="editorial-director" form="verb">edited by</term><term name="illustrator" form="verb">illustrated by</term><term name="interviewer" form="verb">interview by</term><term name="recipient" form="verb">to</term><term name="reviewed-author" form="verb">by</term><term name="translator" form="verb">translated by</term><term name="editortranslator" form="verb">edited &amp; translated by</term><!-- SHORT VERB ROLE FORMS --><term name="compiler" form="verb-short">comp. by</term><term name="contributor" form="verb-short">w.</term><term name="curator" form="verb-short">cur. by</term><term name="executive-producer" form="verb-short">exec. prod. by</term><term name="guest" form="verb-short">w. guest</term><term name="host" form="verb-short">hosted by</term><term name="narrator" form="verb-short">narr. by</term><term name="organizer" form="verb-short">org. by</term><term name="performer" form="verb-short">perf. by</term><term name="producer" form="verb-short">prod. by</term><term name="script-writer" form="verb-short">writ. by</term><term name="series-creator" form="verb-short">cre. by</term><term name="director" form="verb-short">dir. by</term><term name="editor" form="verb-short">ed. by</term><term name="editorial-director" form="verb-short">ed. by</term><term name="illustrator" form="verb-short">illus. by</term><term name="translator" form="verb-short">trans. by</term><term name="editortranslator" form="verb-short">ed. &amp; trans. by</term><!-- LONG MONTH FORMS --><term name="month-01">January</term><term name="month-02">February</term><term name="month-03">March</term><term name="month-04">April</term><term name="month-05">May</term><term name="month-06">June</term><term name="month-07">July</term><term name="month-08">August</term><term name="month-09">September</term><term name="month-10">October</term><term name="month-11">November</term><term name="month-12">December</term><!-- SHORT MONTH FORMS --><term name="month-01" form="short">Jan.</term><term name="month-02" form="short">Feb.</term><term name="month-03" form="short">Mar.</term><term name="month-04" form="short">Apr.</term><term name="month-05" form="short">May</term><term name="month-06" form="short">Jun.</term><term name="month-07" form="short">Jul.</term><term name="month-08" form="short">Aug.</term><term name="month-09" form="short">Sep.</term><term name="month-10" form="short">Oct.</term><term name="month-11" form="short">Nov.</term><term name="month-12" form="short">Dec.</term><!-- SEASONS --><term name="season-01">Spring</term><term name="season-02">Summer</term><term name="season-03">Autumn</term><term name="season-04">Winter</term></terms></locale>';
20
+ exports.csl = `<?xml version="1.0" encoding="utf-8"?><style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" default-locale="en-US" page-range-format="expanded"> <info> <title>American Medical Association</title> <title-short>AMA</title-short> <id>http://www.zotero.org/styles/american-medical-association</id> <link href="http://www.zotero.org/styles/american-medical-association" rel="self"/> <link href="https://westlibrary.txwes.edu/sites/default/files/pdf/AMACitationStyle.pdf" rel="documentation"/> <author> <name>Julian Onions</name> <email>julian.onions@gmail.com</email> </author> <contributor> <name>Christian Pietsch</name> <uri>http://purl.org/net/pietsch</uri> </contributor> <contributor> <name>Daniel W Chan</name> <email>danwchan@protonmail.com</email> </contributor> <category citation-format="numeric"/> <category field="medicine"/> <summary>The American Medical Association style as used in JAMA.</summary> <updated>2019-03-07T04:35:47+00:00</updated> <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights> </info> <locale xml:lang="en"> <terms> <term name="page-range-delimiter">-</term> </terms> </locale> <macro name="editor"> <names variable="editor"> <name name-as-sort-order="all" sort-separator=" " initialize-with="" delimiter=", " delimiter-precedes-last="always"/> <label form="short" prefix=", "/> </names> </macro> <macro name="author"> <group suffix="."> <names variable="author"> <name name-as-sort-order="all" sort-separator=" " initialize-with="" delimiter=", " delimiter-precedes-last="always"/> <label form="short" prefix=", "/> <substitute> <names variable="editor"/> <text macro="title"/> </substitute> </names> </group> </macro> <macro name="access"> <choose> <if type="article-newspaper" match="none"> <choose> <if variable="DOI"> <text value="doi:"/> <text variable="DOI"/> </if> <else-if variable="URL"> <group delimiter=". " suffix="."> <text variable="URL"/> <choose> <if type="webpage"> <date variable="issued" prefix="Published " form="text"/> </if> </choose> <group> <text term="accessed" text-case="capitalize-first" suffix=" "/> <date variable="accessed"> <date-part name="month" suffix=" "/> <date-part name="day" suffix=", "/> <date-part name="year"/> </date> </group> </group> </else-if> </choose> </if> </choose> </macro> <macro name="title"> <choose> <if type="bill book graphic legal_case legislation motion_picture report song" match="any"> <text variable="title" font-style="italic" text-case="title"/> </if> <else> <text variable="title"/> </else> </choose> </macro> <macro name="publisher"> <group delimiter=": "> <text variable="publisher-place"/> <text variable="publisher"/> </group> </macro> <macro name="edition"> <choose> <if is-numeric="edition"> <group delimiter=" "> <number variable="edition" form="ordinal"/> <text term="edition" form="short"/> </group> </if> <else> <text variable="edition" suffix="."/> </else> </choose> </macro> <citation collapse="citation-number"> <sort> <key variable="citation-number"/> </sort> <layout delimiter="," vertical-align="sup"> <text variable="citation-number"/> <group prefix="(" suffix=")"> <label variable="locator" form="short" strip-periods="true"/> <text variable="locator"/> </group> </layout> </citation> <bibliography hanging-indent="false" et-al-min="7" et-al-use-first="3" second-field-align="flush"> <layout> <text variable="citation-number" suffix=". "/> <text macro="author"/> <text macro="title" prefix=" " suffix="."/> <choose> <if type="bill book graphic legislation motion_picture report song" match="any"> <group suffix="." prefix=" " delimiter=" "> <group delimiter=" "> <text term="volume" form="short" text-case="capitalize-first" strip-periods="true"/> <text variable="volume" suffix="."/> </group> <text macro="edition"/> <text macro="editor" prefix="(" suffix=")"/> </group> <text macro="publisher" prefix=" "/> <group suffix="." prefix="; "> <date variable="issued"> <date-part name="year"/> </date> <text variable="page" prefix=":"/> </group> </if> <else-if type="chapter paper-conference entry-dictionary entry-encyclopedia" match="any"> <group prefix=" " delimiter=" "> <text term="in" text-case="capitalize-first" suffix=":"/> <text macro="editor"/> <text variable="container-title" font-style="italic" suffix="." text-case="title"/> <group delimiter=" "> <text term="volume" form="short" text-case="capitalize-first" strip-periods="true"/> <text variable="volume" suffix="."/> </group> <text macro="edition"/> <text variable="collection-title" suffix="."/> <group suffix="."> <text macro="publisher"/> <group suffix="." prefix="; "> <date variable="issued"> <date-part name="year"/> </date> <text variable="page" prefix=":"/> </group> </group> </group> </else-if> <else-if type="article-newspaper"> <text variable="container-title" font-style="italic" prefix=" " suffix=". "/> <choose> <if variable="URL"> <group delimiter=". " suffix="."> <text variable="URL"/> <group prefix="Published "> <date variable="issued"> <date-part name="month" suffix=" "/> <date-part name="day" suffix=", "/> <date-part name="year"/> </date> </group> <group> <text term="accessed" text-case="capitalize-first" suffix=" "/> <date variable="accessed"> <date-part name="month" suffix=" "/> <date-part name="day" suffix=", "/> <date-part name="year"/> </date> </group> </group> </if> <else> <group delimiter=":" suffix="."> <group> <date variable="issued"> <date-part name="month" suffix=" "/> <date-part name="day" suffix=", "/> <date-part name="year"/> </date> </group> <text variable="page"/> </group> </else> </choose> </else-if> <else-if type="legal_case"> <group suffix="," prefix=" " delimiter=" "> <text macro="editor" prefix="(" suffix=")"/> </group> <group prefix=" " delimiter=" "> <text variable="container-title"/> <text variable="volume"/> </group> <text variable="page" prefix=", " suffix=" "/> <group prefix="(" suffix=")." delimiter=" "> <text variable="authority"/> <date variable="issued"> <date-part name="year"/> </date> </group> </else-if> <else-if type="webpage"> <text variable="container-title" prefix=" " suffix="."/> </else-if> <else-if type="speech"> <group prefix=" " suffix=":"> <choose> <if variable="genre"> <text variable="genre" suffix=" "/> <text term="presented at"/> </if> <else> <text term="presented at" text-case="capitalize-first"/> </else> </choose> </group> <group delimiter="; " prefix=" " suffix="."> <text variable="event"/> <group> <date delimiter=" " variable="issued"> <date-part name="month"/> <date-part name="day" suffix=","/> <date-part name="year"/> </date> </group> <text variable="event-place"/> </group> </else-if> <else> <text macro="editor" prefix=" " suffix="."/> <group prefix=" " suffix="."> <text variable="container-title" font-style="italic" form="short" strip-periods="true" suffix="."/> <group delimiter=";" prefix=" "> <choose> <if variable="issue volume" match="any"> <date variable="issued"> <date-part name="year"/> </date> </if> <else> <date variable="issued"> <date-part name="month" suffix=" "/> <date-part name="year"/> </date> </else> </choose> <group> <text variable="volume"/> <text variable="issue" prefix="(" suffix=")"/> </group> </group> <text variable="page" prefix=":"/> </group> </else> </choose> <text prefix=" " macro="access"/> </layout> </bibliography></style>`;
21
+ exports.DEFAULT_CSL_OPTIONS = {
22
+ style: exports.csl,
23
+ locale: exports.defaultLocale,
24
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2024 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const create_article_node_1 = require("../importer/create-article-node");
19
+ const utils_1 = require("./utils");
20
+ describe('Create empty document', () => {
21
+ it('should create an empty document', () => {
22
+ const doc = (0, create_article_node_1.createArticleNode)({ id: 'manuscript:123' });
23
+ (0, utils_1.changeIDs)(doc);
24
+ expect(doc).toMatchSnapshot();
25
+ });
26
+ });
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2024 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.sectionCategories = void 0;
19
+ exports.sectionCategories = [
20
+ {
21
+ id: 'abstract',
22
+ titles: ['Abstract'],
23
+ synonyms: [''],
24
+ group: 'abstracts',
25
+ isUnique: true,
26
+ },
27
+ {
28
+ id: 'abstract-graphical',
29
+ titles: ['Graphical Abstract'],
30
+ synonyms: [''],
31
+ group: 'abstracts-graphic',
32
+ isUnique: true,
33
+ },
34
+ {
35
+ id: 'abstract-key-image',
36
+ titles: ['Key Image'],
37
+ synonyms: [''],
38
+ group: 'abstracts-graphic',
39
+ isUnique: true,
40
+ },
41
+ {
42
+ id: 'abstract-short',
43
+ titles: ['Short'],
44
+ synonyms: [''],
45
+ group: 'abstracts',
46
+ isUnique: true,
47
+ },
48
+ {
49
+ id: 'abstract-teaser',
50
+ titles: ['Abstract Teaser'],
51
+ synonyms: [''],
52
+ isUnique: true,
53
+ group: 'abstracts',
54
+ },
55
+ {
56
+ id: 'abstract-toc',
57
+ titles: ['Table of contents'],
58
+ synonyms: [''],
59
+ group: 'abstracts',
60
+ isUnique: true,
61
+ },
62
+ {
63
+ id: 'acknowledgements',
64
+ synonyms: ['acknowledgements', 'acknowledgments'],
65
+ titles: ['Acknowledgements'],
66
+ group: 'backmatter',
67
+ isUnique: true,
68
+ },
69
+ {
70
+ id: 'appendices',
71
+ titles: ['Appendices'],
72
+ synonyms: ['appendices'],
73
+ isUnique: false,
74
+ },
75
+ {
76
+ id: 'availability',
77
+ titles: ['Availability'],
78
+ synonyms: ['availability', 'data-availability', 'data availability'],
79
+ group: 'backmatter',
80
+ isUnique: true,
81
+ },
82
+ {
83
+ id: 'coi-statement',
84
+ synonyms: [
85
+ 'coi-statement',
86
+ 'competing-interests',
87
+ 'conflict',
88
+ 'conflict of interest',
89
+ 'competing interests',
90
+ ],
91
+ titles: ['COI Statement', 'Competing Interests'],
92
+ group: 'backmatter',
93
+ isUnique: true,
94
+ },
95
+ {
96
+ id: 'con',
97
+ synonyms: ['con'],
98
+ titles: ['Contributed-by information'],
99
+ group: 'backmatter',
100
+ isUnique: true,
101
+ },
102
+ {
103
+ id: 'conclusions',
104
+ synonyms: ['conclusions'],
105
+ titles: ['Conclusions'],
106
+ group: 'body',
107
+ isUnique: false,
108
+ },
109
+ {
110
+ id: 'deceased',
111
+ titles: ['Deceased'],
112
+ synonyms: ['deceased'],
113
+ isUnique: false,
114
+ },
115
+ {
116
+ id: 'discussion',
117
+ synonyms: ['discussion'],
118
+ titles: ['Discussion'],
119
+ group: 'body',
120
+ isUnique: false,
121
+ },
122
+ {
123
+ id: 'equal',
124
+ titles: ['Equal'],
125
+ synonyms: ['equal'],
126
+ isUnique: false,
127
+ },
128
+ {
129
+ id: 'ethics-statement',
130
+ synonyms: ['ethics-statement'],
131
+ titles: ['Ethics Statement'],
132
+ group: 'backmatter',
133
+ isUnique: true,
134
+ },
135
+ {
136
+ id: 'financial-disclosure',
137
+ synonyms: ['financial-disclosure', 'funding information'],
138
+ titles: ['Financial Disclosure'],
139
+ group: 'backmatter',
140
+ isUnique: true,
141
+ },
142
+ {
143
+ id: 'intro',
144
+ synonyms: ['intro', 'introduction'],
145
+ titles: ['Introduction'],
146
+ group: 'body',
147
+ isUnique: false,
148
+ },
149
+ {
150
+ id: 'methods',
151
+ synonyms: [
152
+ 'materials',
153
+ 'methods',
154
+ 'materials and methods',
155
+ 'materials & methods',
156
+ ],
157
+ titles: ['Materials & Methods'],
158
+ group: 'body',
159
+ isUnique: false,
160
+ },
161
+ {
162
+ id: 'present-address',
163
+ titles: ['Present Address'],
164
+ synonyms: ['present-address'],
165
+ isUnique: false,
166
+ },
167
+ {
168
+ id: 'presented-at',
169
+ titles: ['Presented at'],
170
+ synonyms: ['presented-at'],
171
+ isUnique: false,
172
+ },
173
+ {
174
+ id: 'previously-at',
175
+ titles: ['Previously at'],
176
+ synonyms: ['previously-at'],
177
+ isUnique: false,
178
+ },
179
+ {
180
+ id: 'results',
181
+ synonyms: ['results'],
182
+ titles: ['Results'],
183
+ group: 'body',
184
+ isUnique: false,
185
+ },
186
+ {
187
+ id: 'review',
188
+ titles: ['Review'],
189
+ synonyms: [],
190
+ group: 'body',
191
+ isUnique: false,
192
+ },
193
+ {
194
+ id: 'supplementary-material',
195
+ synonyms: ['supplementary-material'],
196
+ titles: ['Supplementary Material'],
197
+ group: 'backmatter',
198
+ isUnique: true,
199
+ },
200
+ {
201
+ id: 'supported-by',
202
+ synonyms: ['supported-by'],
203
+ titles: ['Supported By'],
204
+ group: 'backmatter',
205
+ isUnique: true,
206
+ },
207
+ ];
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2020 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.readAndParseFixture = exports.readFixture = void 0;
22
+ const fs_1 = __importDefault(require("fs"));
23
+ const path_1 = require("path");
24
+ const readFixture = (filename) => fs_1.default.promises.readFile((0, path_1.join)(__dirname, '/__fixtures__/', filename), 'utf-8');
25
+ exports.readFixture = readFixture;
26
+ const readAndParseFixture = async (filename) => new DOMParser().parseFromString(await (0, exports.readFixture)(filename), 'application/xml');
27
+ exports.readAndParseFixture = readAndParseFixture;
@@ -0,0 +1,210 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2019 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const libxmljs2_1 = require("libxmljs2");
19
+ const jats_exporter_1 = require("../exporter/jats-exporter");
20
+ const parse_jats_article_1 = require("../importer/parse-jats-article");
21
+ const citations_1 = require("./citations");
22
+ const section_categories_1 = require("./data/section-categories");
23
+ const files_1 = require("./files");
24
+ const parseXMLWithDTD = (data) => (0, libxmljs2_1.parseXml)(data, {
25
+ dtdload: true,
26
+ dtdvalid: true,
27
+ nonet: true,
28
+ });
29
+ describe('JATS exporter', () => {
30
+ test('export latest version', async () => {
31
+ const transformer = new jats_exporter_1.JATSExporter();
32
+ const input = await (0, files_1.readAndParseFixture)('jats-example-full.xml');
33
+ const { node, journal } = (0, parse_jats_article_1.parseJATSArticle)(input, section_categories_1.sectionCategories);
34
+ const result = await transformer.serializeToJATS(node, {
35
+ csl: citations_1.DEFAULT_CSL_OPTIONS,
36
+ journal,
37
+ });
38
+ expect(result).toMatchSnapshot('jats-export');
39
+ });
40
+ test('export v1.1', async () => {
41
+ const transformer = new jats_exporter_1.JATSExporter();
42
+ const input = await (0, files_1.readAndParseFixture)('jats-example-full.xml');
43
+ const { node, journal } = (0, parse_jats_article_1.parseJATSArticle)(input, section_categories_1.sectionCategories);
44
+ const result = await transformer.serializeToJATS(node, {
45
+ csl: citations_1.DEFAULT_CSL_OPTIONS,
46
+ journal,
47
+ version: '1.1',
48
+ });
49
+ expect(result).toMatchSnapshot('jats-export-1.1');
50
+ });
51
+ test('export unknown version', async () => {
52
+ const transformer = new jats_exporter_1.JATSExporter();
53
+ const input = await (0, files_1.readAndParseFixture)('jats-example-full.xml');
54
+ const { node, journal } = (0, parse_jats_article_1.parseJATSArticle)(input, section_categories_1.sectionCategories);
55
+ await expect(async () => {
56
+ await transformer.serializeToJATS(node, {
57
+ csl: citations_1.DEFAULT_CSL_OPTIONS,
58
+ journal,
59
+ version: '1.0',
60
+ });
61
+ }).rejects.toThrow(Error);
62
+ });
63
+ test('export table-wrap-foot', async () => {
64
+ const transformer = new jats_exporter_1.JATSExporter();
65
+ const input = await (0, files_1.readAndParseFixture)('jats-tables-example.xml');
66
+ const { node, journal } = (0, parse_jats_article_1.parseJATSArticle)(input, section_categories_1.sectionCategories);
67
+ const xml = await transformer.serializeToJATS(node, {
68
+ csl: citations_1.DEFAULT_CSL_OPTIONS,
69
+ journal,
70
+ });
71
+ const resultDoc = parseXMLWithDTD(xml);
72
+ const tableWrapFoot = resultDoc.get('//table-wrap/table-wrap-foot');
73
+ const paragraph = resultDoc.get('//table-wrap/table-wrap-foot/p');
74
+ expect(paragraph).not.toBeUndefined();
75
+ expect(tableWrapFoot).not.toBeUndefined();
76
+ });
77
+ test('add journal ID', async () => {
78
+ const transformer = new jats_exporter_1.JATSExporter();
79
+ const input = await (0, files_1.readAndParseFixture)('jats-example-full.xml');
80
+ const { node, journal } = (0, parse_jats_article_1.parseJATSArticle)(input, section_categories_1.sectionCategories);
81
+ const xml = await transformer.serializeToJATS(node, {
82
+ csl: citations_1.DEFAULT_CSL_OPTIONS,
83
+ journal,
84
+ });
85
+ expect(xml).toMatchSnapshot('jats-export-submitted');
86
+ });
87
+ test('journal metadata', async () => {
88
+ const transformer = new jats_exporter_1.JATSExporter();
89
+ const input = await (0, files_1.readAndParseFixture)('jats-import.xml');
90
+ const { node, journal } = (0, parse_jats_article_1.parseJATSArticle)(input, section_categories_1.sectionCategories);
91
+ const xml = await transformer.serializeToJATS(node, {
92
+ csl: citations_1.DEFAULT_CSL_OPTIONS,
93
+ journal,
94
+ });
95
+ const output = parseXMLWithDTD(xml);
96
+ expect(output.errors).toHaveLength(0);
97
+ expect(output.get('//journal-title').text()).toBe('Brain and Behavior');
98
+ expect(output.get('//issn').text()).toBe('2162-3279');
99
+ });
100
+ test('DTD validation', async () => {
101
+ const transformer = new jats_exporter_1.JATSExporter();
102
+ const input = await (0, files_1.readAndParseFixture)('jats-import.xml');
103
+ const { node, journal } = (0, parse_jats_article_1.parseJATSArticle)(input, section_categories_1.sectionCategories);
104
+ const xml = await transformer.serializeToJATS(node, {
105
+ csl: citations_1.DEFAULT_CSL_OPTIONS,
106
+ journal,
107
+ });
108
+ const { errors } = parseXMLWithDTD(xml);
109
+ expect(errors).toHaveLength(0);
110
+ });
111
+ test('DTD validation: article with title markup and citations', async () => {
112
+ const transformer = new jats_exporter_1.JATSExporter();
113
+ const input = await (0, files_1.readAndParseFixture)('jats-document.xml');
114
+ const { node, journal } = (0, parse_jats_article_1.parseJATSArticle)(input, section_categories_1.sectionCategories);
115
+ const xml = await transformer.serializeToJATS(node, {
116
+ csl: citations_1.DEFAULT_CSL_OPTIONS,
117
+ journal,
118
+ });
119
+ const { errors } = parseXMLWithDTD(xml);
120
+ expect(errors).toHaveLength(0);
121
+ });
122
+ test('Export link', async () => {
123
+ const transformer = new jats_exporter_1.JATSExporter();
124
+ const input = await (0, files_1.readAndParseFixture)('jats-import.xml');
125
+ const { node, journal } = (0, parse_jats_article_1.parseJATSArticle)(input, section_categories_1.sectionCategories);
126
+ const xml = await transformer.serializeToJATS(node, {
127
+ csl: citations_1.DEFAULT_CSL_OPTIONS,
128
+ journal,
129
+ });
130
+ const output = parseXMLWithDTD(xml);
131
+ const link = output.get('//ext-link[@ext-link-type="uri"]');
132
+ expect(link).not.toBeNull();
133
+ expect(link.text()).toBe('https//orcid.org/0000-0003-2217-5904');
134
+ const attrs = {};
135
+ for (const attr of link.attrs()) {
136
+ attrs[attr.name()] = attr.value();
137
+ }
138
+ expect(attrs.href).toBe('https://orcid.org/0000-0003-2217-5904');
139
+ expect(attrs['ext-link-type']).toBe('uri');
140
+ });
141
+ test('Markup in citations', async () => {
142
+ const transformer = new jats_exporter_1.JATSExporter();
143
+ const input = await (0, files_1.readAndParseFixture)('jats-import.xml');
144
+ const { node, journal } = (0, parse_jats_article_1.parseJATSArticle)(input, section_categories_1.sectionCategories);
145
+ const xml = await transformer.serializeToJATS(node, {
146
+ csl: citations_1.DEFAULT_CSL_OPTIONS,
147
+ journal,
148
+ });
149
+ const output = parseXMLWithDTD(xml);
150
+ const refs = output.find('//xref[@ref-type="bibr"]');
151
+ expect(refs).toHaveLength(17);
152
+ expect(refs[0].child(0).type()).toBe('text');
153
+ expect(refs[0].text()).toBe('1,2');
154
+ expect(refs[1].child(0).type()).toBe('text');
155
+ expect(refs[1].text()).toBe('3');
156
+ });
157
+ test('DTD validation for MathML representation', async () => {
158
+ const transformer = new jats_exporter_1.JATSExporter();
159
+ const input = await (0, files_1.readAndParseFixture)('jats-example-doc.xml');
160
+ const { node, journal } = (0, parse_jats_article_1.parseJATSArticle)(input, section_categories_1.sectionCategories);
161
+ const xml = await transformer.serializeToJATS(node, {
162
+ csl: citations_1.DEFAULT_CSL_OPTIONS,
163
+ journal,
164
+ });
165
+ const { errors } = parseXMLWithDTD(xml);
166
+ expect(errors).toHaveLength(0);
167
+ });
168
+ test('export with supplement', async () => {
169
+ const transformer = new jats_exporter_1.JATSExporter();
170
+ const input = await (0, files_1.readAndParseFixture)('jats-import.xml');
171
+ const { node, journal } = (0, parse_jats_article_1.parseJATSArticle)(input, section_categories_1.sectionCategories);
172
+ const xml = await transformer.serializeToJATS(node, {
173
+ csl: citations_1.DEFAULT_CSL_OPTIONS,
174
+ journal,
175
+ });
176
+ const resultDoc = parseXMLWithDTD(xml);
177
+ const supplementaryMaterial = resultDoc.get('//supplementary-material');
178
+ if (!supplementaryMaterial) {
179
+ throw new Error('No supplementary material found');
180
+ }
181
+ const textContent = supplementaryMaterial.text().trim();
182
+ const mimeTypeAttr = supplementaryMaterial.attr('mimetype');
183
+ const mimeSubtypeAttr = supplementaryMaterial.attr('mime-subtype');
184
+ const hrefAttr = supplementaryMaterial.attr('href');
185
+ expect(textContent).toBe('final manuscript-hum-huili-dbh-suicide-20200707_figures (9)');
186
+ expect(mimeTypeAttr?.value()).toBe('application');
187
+ expect(mimeSubtypeAttr?.value()).toBe('vnd.openxmlformats-officedocument.wordprocessingml.document');
188
+ expect(hrefAttr?.value()).toBe('attachment:7d9d686b-5488-44a5-a1c5-46351e7f9312');
189
+ });
190
+ test('export footnotes', async () => {
191
+ const transformer = new jats_exporter_1.JATSExporter();
192
+ const input = await (0, files_1.readAndParseFixture)('jats-fn-group.xml');
193
+ const { node, journal } = (0, parse_jats_article_1.parseJATSArticle)(input, section_categories_1.sectionCategories);
194
+ const xml = await transformer.serializeToJATS(node, {
195
+ csl: citations_1.DEFAULT_CSL_OPTIONS,
196
+ journal,
197
+ });
198
+ const footnoteCategories = [
199
+ 'con',
200
+ 'deceased',
201
+ 'equal',
202
+ 'financial-disclosure',
203
+ ];
204
+ const resultDoc = parseXMLWithDTD(xml);
205
+ for (const category of footnoteCategories) {
206
+ const fn = resultDoc.get(`/article/back/fn-group/fn[@fn-type="${category}"]`);
207
+ expect(fn).not.toBeUndefined();
208
+ }
209
+ });
210
+ });