scholarly-parse 0.1.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 (238) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +201 -0
  3. package/README.md +118 -0
  4. package/changelog/0.1.x/0.1.0.md +17 -0
  5. package/changelog/template.md +150 -0
  6. package/dist/detect.d.ts +11 -0
  7. package/dist/detect.d.ts.map +1 -0
  8. package/dist/detect.js +51 -0
  9. package/dist/detect.js.map +1 -0
  10. package/dist/formats/html/blocks.d.ts +29 -0
  11. package/dist/formats/html/blocks.d.ts.map +1 -0
  12. package/dist/formats/html/blocks.js +527 -0
  13. package/dist/formats/html/blocks.js.map +1 -0
  14. package/dist/formats/html/context.d.ts +19 -0
  15. package/dist/formats/html/context.d.ts.map +1 -0
  16. package/dist/formats/html/context.js +122 -0
  17. package/dist/formats/html/context.js.map +1 -0
  18. package/dist/formats/html/index.d.ts +7 -0
  19. package/dist/formats/html/index.d.ts.map +1 -0
  20. package/dist/formats/html/index.js +7 -0
  21. package/dist/formats/html/index.js.map +1 -0
  22. package/dist/formats/html/inline.d.ts +26 -0
  23. package/dist/formats/html/inline.d.ts.map +1 -0
  24. package/dist/formats/html/inline.js +253 -0
  25. package/dist/formats/html/inline.js.map +1 -0
  26. package/dist/formats/html/metadata.d.ts +30 -0
  27. package/dist/formats/html/metadata.d.ts.map +1 -0
  28. package/dist/formats/html/metadata.js +212 -0
  29. package/dist/formats/html/metadata.js.map +1 -0
  30. package/dist/formats/html/parse.d.ts +17 -0
  31. package/dist/formats/html/parse.d.ts.map +1 -0
  32. package/dist/formats/html/parse.js +405 -0
  33. package/dist/formats/html/parse.js.map +1 -0
  34. package/dist/formats/html/references.d.ts +12 -0
  35. package/dist/formats/html/references.d.ts.map +1 -0
  36. package/dist/formats/html/references.js +123 -0
  37. package/dist/formats/html/references.js.map +1 -0
  38. package/dist/formats/jats/blocks.d.ts +52 -0
  39. package/dist/formats/jats/blocks.d.ts.map +1 -0
  40. package/dist/formats/jats/blocks.js +614 -0
  41. package/dist/formats/jats/blocks.js.map +1 -0
  42. package/dist/formats/jats/context.d.ts +17 -0
  43. package/dist/formats/jats/context.d.ts.map +1 -0
  44. package/dist/formats/jats/context.js +2 -0
  45. package/dist/formats/jats/context.js.map +1 -0
  46. package/dist/formats/jats/fragment.d.ts +7 -0
  47. package/dist/formats/jats/fragment.d.ts.map +1 -0
  48. package/dist/formats/jats/fragment.js +42 -0
  49. package/dist/formats/jats/fragment.js.map +1 -0
  50. package/dist/formats/jats/front.d.ts +25 -0
  51. package/dist/formats/jats/front.d.ts.map +1 -0
  52. package/dist/formats/jats/front.js +380 -0
  53. package/dist/formats/jats/front.js.map +1 -0
  54. package/dist/formats/jats/index.d.ts +8 -0
  55. package/dist/formats/jats/index.d.ts.map +1 -0
  56. package/dist/formats/jats/index.js +8 -0
  57. package/dist/formats/jats/index.js.map +1 -0
  58. package/dist/formats/jats/inline.d.ts +24 -0
  59. package/dist/formats/jats/inline.d.ts.map +1 -0
  60. package/dist/formats/jats/inline.js +274 -0
  61. package/dist/formats/jats/inline.js.map +1 -0
  62. package/dist/formats/jats/parse.d.ts +9 -0
  63. package/dist/formats/jats/parse.d.ts.map +1 -0
  64. package/dist/formats/jats/parse.js +247 -0
  65. package/dist/formats/jats/parse.js.map +1 -0
  66. package/dist/formats/jats/references.d.ts +25 -0
  67. package/dist/formats/jats/references.d.ts.map +1 -0
  68. package/dist/formats/jats/references.js +406 -0
  69. package/dist/formats/jats/references.js.map +1 -0
  70. package/dist/formats/jats/tables.d.ts +18 -0
  71. package/dist/formats/jats/tables.d.ts.map +1 -0
  72. package/dist/formats/jats/tables.js +105 -0
  73. package/dist/formats/jats/tables.js.map +1 -0
  74. package/dist/formats/jats/text.d.ts +23 -0
  75. package/dist/formats/jats/text.d.ts.map +1 -0
  76. package/dist/formats/jats/text.js +114 -0
  77. package/dist/formats/jats/text.js.map +1 -0
  78. package/dist/formats/latexml/blocks.d.ts +13 -0
  79. package/dist/formats/latexml/blocks.d.ts.map +1 -0
  80. package/dist/formats/latexml/blocks.js +454 -0
  81. package/dist/formats/latexml/blocks.js.map +1 -0
  82. package/dist/formats/latexml/context.d.ts +19 -0
  83. package/dist/formats/latexml/context.d.ts.map +1 -0
  84. package/dist/formats/latexml/context.js +18 -0
  85. package/dist/formats/latexml/context.js.map +1 -0
  86. package/dist/formats/latexml/index.d.ts +7 -0
  87. package/dist/formats/latexml/index.d.ts.map +1 -0
  88. package/dist/formats/latexml/index.js +7 -0
  89. package/dist/formats/latexml/index.js.map +1 -0
  90. package/dist/formats/latexml/inline.d.ts +16 -0
  91. package/dist/formats/latexml/inline.d.ts.map +1 -0
  92. package/dist/formats/latexml/inline.js +113 -0
  93. package/dist/formats/latexml/inline.js.map +1 -0
  94. package/dist/formats/latexml/parse.d.ts +16 -0
  95. package/dist/formats/latexml/parse.d.ts.map +1 -0
  96. package/dist/formats/latexml/parse.js +405 -0
  97. package/dist/formats/latexml/parse.js.map +1 -0
  98. package/dist/formats/pdf/blocks.d.ts +14 -0
  99. package/dist/formats/pdf/blocks.d.ts.map +1 -0
  100. package/dist/formats/pdf/blocks.js +203 -0
  101. package/dist/formats/pdf/blocks.js.map +1 -0
  102. package/dist/formats/pdf/index.d.ts +7 -0
  103. package/dist/formats/pdf/index.d.ts.map +1 -0
  104. package/dist/formats/pdf/index.js +7 -0
  105. package/dist/formats/pdf/index.js.map +1 -0
  106. package/dist/formats/pdf/inline.d.ts +8 -0
  107. package/dist/formats/pdf/inline.d.ts.map +1 -0
  108. package/dist/formats/pdf/inline.js +91 -0
  109. package/dist/formats/pdf/inline.js.map +1 -0
  110. package/dist/formats/pdf/layout.d.ts +33 -0
  111. package/dist/formats/pdf/layout.d.ts.map +1 -0
  112. package/dist/formats/pdf/layout.js +358 -0
  113. package/dist/formats/pdf/layout.js.map +1 -0
  114. package/dist/formats/pdf/lines.d.ts +40 -0
  115. package/dist/formats/pdf/lines.d.ts.map +1 -0
  116. package/dist/formats/pdf/lines.js +104 -0
  117. package/dist/formats/pdf/lines.js.map +1 -0
  118. package/dist/formats/pdf/load.d.ts +43 -0
  119. package/dist/formats/pdf/load.d.ts.map +1 -0
  120. package/dist/formats/pdf/load.js +126 -0
  121. package/dist/formats/pdf/load.js.map +1 -0
  122. package/dist/formats/pdf/parse.d.ts +9 -0
  123. package/dist/formats/pdf/parse.d.ts.map +1 -0
  124. package/dist/formats/pdf/parse.js +126 -0
  125. package/dist/formats/pdf/parse.js.map +1 -0
  126. package/dist/formats/pdf/references.d.ts +14 -0
  127. package/dist/formats/pdf/references.d.ts.map +1 -0
  128. package/dist/formats/pdf/references.js +104 -0
  129. package/dist/formats/pdf/references.js.map +1 -0
  130. package/dist/formats/pdf/structure.d.ts +29 -0
  131. package/dist/formats/pdf/structure.d.ts.map +1 -0
  132. package/dist/formats/pdf/structure.js +533 -0
  133. package/dist/formats/pdf/structure.js.map +1 -0
  134. package/dist/formats/tei/index.d.ts +7 -0
  135. package/dist/formats/tei/index.d.ts.map +1 -0
  136. package/dist/formats/tei/index.js +7 -0
  137. package/dist/formats/tei/index.js.map +1 -0
  138. package/dist/formats/tei/inline.d.ts +24 -0
  139. package/dist/formats/tei/inline.d.ts.map +1 -0
  140. package/dist/formats/tei/inline.js +107 -0
  141. package/dist/formats/tei/inline.js.map +1 -0
  142. package/dist/formats/tei/parse.d.ts +4 -0
  143. package/dist/formats/tei/parse.d.ts.map +1 -0
  144. package/dist/formats/tei/parse.js +560 -0
  145. package/dist/formats/tei/parse.js.map +1 -0
  146. package/dist/html/dom.d.ts +35 -0
  147. package/dist/html/dom.d.ts.map +1 -0
  148. package/dist/html/dom.js +70 -0
  149. package/dist/html/dom.js.map +1 -0
  150. package/dist/html/interstitial.d.ts +14 -0
  151. package/dist/html/interstitial.d.ts.map +1 -0
  152. package/dist/html/interstitial.js +67 -0
  153. package/dist/html/interstitial.js.map +1 -0
  154. package/dist/html/tables.d.ts +12 -0
  155. package/dist/html/tables.d.ts.map +1 -0
  156. package/dist/html/tables.js +62 -0
  157. package/dist/html/tables.js.map +1 -0
  158. package/dist/index.d.ts +12 -0
  159. package/dist/index.d.ts.map +1 -0
  160. package/dist/index.js +12 -0
  161. package/dist/index.js.map +1 -0
  162. package/dist/model/diagnostics.d.ts +15 -0
  163. package/dist/model/diagnostics.d.ts.map +1 -0
  164. package/dist/model/diagnostics.js +37 -0
  165. package/dist/model/diagnostics.js.map +1 -0
  166. package/dist/model/document.d.ts +289 -0
  167. package/dist/model/document.d.ts.map +1 -0
  168. package/dist/model/document.js +13 -0
  169. package/dist/model/document.js.map +1 -0
  170. package/dist/model/extremes.d.ts +11 -0
  171. package/dist/model/extremes.d.ts.map +1 -0
  172. package/dist/model/extremes.js +23 -0
  173. package/dist/model/extremes.js.map +1 -0
  174. package/dist/model/index.d.ts +8 -0
  175. package/dist/model/index.d.ts.map +1 -0
  176. package/dist/model/index.js +2 -0
  177. package/dist/model/index.js.map +1 -0
  178. package/dist/model/input.d.ts +14 -0
  179. package/dist/model/input.d.ts.map +1 -0
  180. package/dist/model/input.js +47 -0
  181. package/dist/model/input.js.map +1 -0
  182. package/dist/model/result.d.ts +53 -0
  183. package/dist/model/result.d.ts.map +1 -0
  184. package/dist/model/result.js +40 -0
  185. package/dist/model/result.js.map +1 -0
  186. package/dist/model/section-ids.d.ts +8 -0
  187. package/dist/model/section-ids.d.ts.map +1 -0
  188. package/dist/model/section-ids.js +28 -0
  189. package/dist/model/section-ids.js.map +1 -0
  190. package/dist/model/section-kinds.d.ts +19 -0
  191. package/dist/model/section-kinds.d.ts.map +1 -0
  192. package/dist/model/section-kinds.js +42 -0
  193. package/dist/model/section-kinds.js.map +1 -0
  194. package/dist/model/table-grid.d.ts +40 -0
  195. package/dist/model/table-grid.d.ts.map +1 -0
  196. package/dist/model/table-grid.js +79 -0
  197. package/dist/model/table-grid.js.map +1 -0
  198. package/dist/parse.d.ts +18 -0
  199. package/dist/parse.d.ts.map +1 -0
  200. package/dist/parse.js +35 -0
  201. package/dist/parse.js.map +1 -0
  202. package/dist/render/escape.d.ts +53 -0
  203. package/dist/render/escape.d.ts.map +1 -0
  204. package/dist/render/escape.js +94 -0
  205. package/dist/render/escape.js.map +1 -0
  206. package/dist/render/index.d.ts +8 -0
  207. package/dist/render/index.d.ts.map +1 -0
  208. package/dist/render/index.js +8 -0
  209. package/dist/render/index.js.map +1 -0
  210. package/dist/render/inline.d.ts +39 -0
  211. package/dist/render/inline.d.ts.map +1 -0
  212. package/dist/render/inline.js +87 -0
  213. package/dist/render/inline.js.map +1 -0
  214. package/dist/render/markdown.d.ts +35 -0
  215. package/dist/render/markdown.d.ts.map +1 -0
  216. package/dist/render/markdown.js +279 -0
  217. package/dist/render/markdown.js.map +1 -0
  218. package/dist/render/sections.d.ts +25 -0
  219. package/dist/render/sections.d.ts.map +1 -0
  220. package/dist/render/sections.js +45 -0
  221. package/dist/render/sections.js.map +1 -0
  222. package/dist/render/text.d.ts +13 -0
  223. package/dist/render/text.d.ts.map +1 -0
  224. package/dist/render/text.js +66 -0
  225. package/dist/render/text.js.map +1 -0
  226. package/dist/xml/mathml.d.ts +24 -0
  227. package/dist/xml/mathml.d.ts.map +1 -0
  228. package/dist/xml/mathml.js +201 -0
  229. package/dist/xml/mathml.js.map +1 -0
  230. package/dist/xml/ordered.d.ts +49 -0
  231. package/dist/xml/ordered.d.ts.map +1 -0
  232. package/dist/xml/ordered.js +151 -0
  233. package/dist/xml/ordered.js.map +1 -0
  234. package/dist/xml/well-formed.d.ts +15 -0
  235. package/dist/xml/well-formed.d.ts.map +1 -0
  236. package/dist/xml/well-formed.js +120 -0
  237. package/dist/xml/well-formed.js.map +1 -0
  238. package/package.json +137 -0
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @fileoverview HTML → DOM through the optional `linkedom` peer, loaded on first use,
3
+ * and the node helpers the HTML-based parsers walk it with. `linkedom` runs on Bun,
4
+ * Node, and Workers without a browser.
5
+ * @module src/html/dom
6
+ */
7
+ import { MissingPeerError } from '../model/result.js';
8
+ let linkedom;
9
+ /**
10
+ * Parse HTML into a document. Throws when `linkedom` is not installed — a setup error,
11
+ * not a property of the input.
12
+ *
13
+ * `linkedom` splits text at every entity (`&lt;bos&gt;` arrives as `<`, `bos`, `>`), and
14
+ * a lone `<` escapes as plain text that the next node then turns into a tag. Merging
15
+ * adjacent text nodes lets escaping see each run whole.
16
+ */
17
+ export async function loadDocument(html) {
18
+ linkedom ??= import('linkedom').catch((error) => {
19
+ linkedom = undefined;
20
+ throw new MissingPeerError('Install "linkedom" to parse HTML: bun add linkedom', {
21
+ cause: error,
22
+ });
23
+ });
24
+ const { document } = (await linkedom).parseHTML(html);
25
+ document.documentElement?.normalize();
26
+ return document;
27
+ }
28
+ export const ELEMENT_NODE = 1;
29
+ export const TEXT_NODE = 3;
30
+ export const COMMENT_NODE = 8;
31
+ /** True for an element node. */
32
+ export function isElement(node) {
33
+ return node.nodeType === ELEMENT_NODE;
34
+ }
35
+ /** Lowercase tag name. */
36
+ export function tagOf(element) {
37
+ return element.tagName.toLowerCase();
38
+ }
39
+ /** True when the element carries the class. */
40
+ export function hasClass(element, name) {
41
+ return element.classList.contains(name);
42
+ }
43
+ /** Child nodes as an array. */
44
+ export function childNodes(node) {
45
+ return Array.from(node.childNodes);
46
+ }
47
+ /** Child elements as an array. */
48
+ export function childElements(element) {
49
+ return Array.from(element.children);
50
+ }
51
+ /** First child element matching the predicate. */
52
+ export function childWhere(element, test) {
53
+ return childElements(element).find(test);
54
+ }
55
+ /** Text content with whitespace collapsed. */
56
+ export function textOfElement(element) {
57
+ return (element?.textContent ?? '').replace(/\s+/g, ' ').trim();
58
+ }
59
+ /** Resolve a URL against a base; unchanged when there is no base or it does not parse. */
60
+ export function resolveUrl(url, base) {
61
+ if (!base)
62
+ return url;
63
+ try {
64
+ return new URL(url, base).href;
65
+ }
66
+ catch {
67
+ return url;
68
+ }
69
+ }
70
+ //# sourceMappingURL=dom.js.map
@@ -0,0 +1 @@
1
+ {"version":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AAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACrC,CAAC;AAED,kCAAkC;AAClC,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AACtC,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,UAAU,CACxB,OAAgB,EAChB,IAAiC;IAEjC,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3C,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,aAAa,CAAC,OAAmC;IAC/D,OAAO,CAAC,OAAO,EAAE,WAAW,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAClE,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,UAAU,CAAC,GAAW,EAAE,IAAwB;IAC9D,IAAI,CAAC,IAAI;QAAE,OAAO,GAAG,CAAC;IACtB,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @fileoverview Recognizes a page that stands in for the document: a bot-protection
3
+ * challenge, an access-denied page from a CDN, or a redirect stub. Fetchers commonly
4
+ * receive one with a 200 or 403 status, and parsing it as an article would produce a
5
+ * document about "Just a moment...". Only the raw markup is inspected, so no DOM is built.
6
+ * @module src/html/interstitial
7
+ */
8
+ /**
9
+ * Describes the interstitial `html` is, or returns undefined for a real page. A page
10
+ * carrying scholarly citation metadata or substantial text is never an interstitial,
11
+ * so a bot-protection script loaded by a real article does not trip this.
12
+ */
13
+ export declare function interstitialReason(html: string): string | undefined;
14
+ //# sourceMappingURL=interstitial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interstitial.d.ts","sourceRoot":"","sources":["../../src/html/interstitial.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAsCH;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUnE"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @fileoverview Recognizes a page that stands in for the document: a bot-protection
3
+ * challenge, an access-denied page from a CDN, or a redirect stub. Fetchers commonly
4
+ * receive one with a 200 or 403 status, and parsing it as an article would produce a
5
+ * document about "Just a moment...". Only the raw markup is inspected, so no DOM is built.
6
+ * @module src/html/interstitial
7
+ */
8
+ /** Interstitials are small; anything larger is a real page with more than a challenge on it. */
9
+ const MAX_INTERSTITIAL_CHARS = 512 * 1024;
10
+ /** Visible text past which a page carries content of its own, whatever scripts it loads. */
11
+ const MAX_INTERSTITIAL_TEXT = 3000;
12
+ /** Signatures of challenge and block pages, each with the name it is reported as. */
13
+ const SIGNATURES = [
14
+ [
15
+ /<title>\s*Just a moment\.\.\.\s*<\/title>|challenges\.cloudflare\.com|_cf_chl_opt|cf-browser-verification|Enable JavaScript and cookies to continue|Checking if the site connection is secure/i,
16
+ 'a Cloudflare challenge page',
17
+ ],
18
+ [/<title>\s*Attention Required! \| Cloudflare/i, 'a Cloudflare block page'],
19
+ [/captcha-delivery\.com/i, 'a DataDome challenge page'],
20
+ [/_Incapsula_Resource|Incapsula incident ID/i, 'an Imperva challenge page'],
21
+ [/distil_r_captcha/i, 'a Distil Networks challenge page'],
22
+ [/id=["']px-captcha["']/i, 'a HUMAN (PerimeterX) challenge page'],
23
+ [/AwsWafIntegration|awswaf\.com/i, 'an AWS WAF challenge page'],
24
+ [/<title>\s*Radware Bot Manager|perfdrive\.com\/aperture/i, 'a Radware challenge page'],
25
+ [/errors\.edgesuite\.net|<title>\s*Access Denied\s*<\/title>/i, 'an access-denied page'],
26
+ [/<title>\s*Client Challenge\s*<\/title>/i, 'a bot-protection challenge page'],
27
+ [/Vercel Security Checkpoint/i, 'a Vercel security checkpoint'],
28
+ [/Sucuri WebSite Firewall/i, 'a Sucuri firewall page'],
29
+ [
30
+ /<title>\s*(?:Making sure you(?:'|&#39;|’)re not a bot|Checking your browser)/i,
31
+ 'a bot-check page',
32
+ ],
33
+ [
34
+ /\b(?:verify (?:that )?you are (?:a )?human|are you a robot|unusual traffic from your (?:computer|network))\b/i,
35
+ 'a bot-check page',
36
+ ],
37
+ ];
38
+ const META_REFRESH = /<meta[^>]+http-equiv=["']?refresh["']?[^>]*content=["']?\s*\d+\s*;\s*url=\s*['"]?([^'">\s]+)/i;
39
+ /**
40
+ * Describes the interstitial `html` is, or returns undefined for a real page. A page
41
+ * carrying scholarly citation metadata or substantial text is never an interstitial,
42
+ * so a bot-protection script loaded by a real article does not trip this.
43
+ */
44
+ export function interstitialReason(html) {
45
+ if (html.length > MAX_INTERSTITIAL_CHARS)
46
+ return;
47
+ if (/<meta[^>]+name=["']citation_title["']/i.test(html))
48
+ return;
49
+ if (visibleText(html).length > MAX_INTERSTITIAL_TEXT)
50
+ return;
51
+ const match = SIGNATURES.find(([pattern]) => pattern.test(html));
52
+ if (match)
53
+ return `The page is ${match[1]}, not the document`;
54
+ const refresh = META_REFRESH.exec(html)?.[1];
55
+ if (refresh)
56
+ return `The page is a redirect stub to ${refresh.replace(/&amp;/g, '&')}, not the document`;
57
+ return;
58
+ }
59
+ /** Text a reader would see: scripts, styles, and tags removed, whitespace collapsed. */
60
+ function visibleText(html) {
61
+ return html
62
+ .replace(/<(script|style|noscript|template)\b[\s\S]*?<\/\1\s*>/gi, ' ')
63
+ .replace(/<[^>]*>/g, ' ')
64
+ .replace(/\s+/g, ' ')
65
+ .trim();
66
+ }
67
+ //# sourceMappingURL=interstitial.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interstitial.js","sourceRoot":"","sources":["../../src/html/interstitial.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gGAAgG;AAChG,MAAM,sBA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OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7C,IAAI,OAAO;QACT,OAAO,kCAAkC,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,oBAAoB,CAAC;IAC9F,OAAO;AACT,CAAC;AAED,wFAAwF;AACxF,SAAS,WAAW,CAAC,IAAY;IAC/B,OAAO,IAAI;SACR,OAAO,CAAC,wDAAwD,EAAE,GAAG,CAAC;SACtE,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;SACxB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Read a table into a grid; `cellText` renders one cell's content. With `boldHeaders`,
3
+ * a cell whose text is entirely bold counts as a header cell, so a leading all-bold row
4
+ * becomes the header: LaTeX tables mark their header row that way, with no `<th>`.
5
+ */
6
+ export declare function readHtmlTable(table: Element, cellText: (cell: Element) => string, options?: {
7
+ boldHeaders?: boolean;
8
+ }): {
9
+ headerRows: number;
10
+ rows: string[][];
11
+ };
12
+ //# sourceMappingURL=tables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../src/html/tables.ts"],"names":[],"mappings":"AA8BA;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM,EACnC,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GACtC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAA;CAAE,CA+B1C"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @fileoverview An HTML table — `<table>` markup, or LaTeXML's `<span>`-based tabular —
3
+ * read into the shared grid. Rows of a table nested inside a cell belong to that cell's
4
+ * text, not to the outer table.
5
+ * @module src/html/tables
6
+ */
7
+ import { buildGrid, spanValue } from '../model/table-grid.js';
8
+ import { childElements, hasClass, tagOf } from './dom.js';
9
+ const SECTION_TAGS = new Set(['thead', 'tbody', 'tfoot']);
10
+ const SECTION_CLASSES = ['ltx_thead', 'ltx_tbody', 'ltx_tfoot'];
11
+ function isRow(element) {
12
+ return tagOf(element) === 'tr' || hasClass(element, 'ltx_tr');
13
+ }
14
+ function isCell(element) {
15
+ const tag = tagOf(element);
16
+ return tag === 'td' || tag === 'th' || hasClass(element, 'ltx_td');
17
+ }
18
+ function isHead(element) {
19
+ return tagOf(element) === 'thead' || hasClass(element, 'ltx_thead');
20
+ }
21
+ /** A cell whose whole text is bold Markdown (`**Model**`, `**Active** **Params**`). */
22
+ function isBoldText(text) {
23
+ return /^\*\*[^*]+\*\*(?:\s*\*\*[^*]+\*\*)*$/.test(text);
24
+ }
25
+ /**
26
+ * Read a table into a grid; `cellText` renders one cell's content. With `boldHeaders`,
27
+ * a cell whose text is entirely bold counts as a header cell, so a leading all-bold row
28
+ * becomes the header: LaTeX tables mark their header row that way, with no `<th>`.
29
+ */
30
+ export function readHtmlTable(table, cellText, options = {}) {
31
+ const rows = [];
32
+ const collect = (container, inHead) => {
33
+ for (const child of childElements(container)) {
34
+ if (isRow(child)) {
35
+ const cells = childElements(child)
36
+ .filter(isCell)
37
+ .map((cell) => {
38
+ const text = cellText(cell);
39
+ const markedHeader = tagOf(cell) === 'th' || hasClass(cell, 'ltx_th');
40
+ return {
41
+ colspan: spanValue(cell.getAttribute('colspan')),
42
+ header: markedHeader || (options.boldHeaders === true && (text === '' || isBoldText(text))),
43
+ rowspan: spanValue(cell.getAttribute('rowspan')),
44
+ text,
45
+ };
46
+ });
47
+ // An all-empty row is not a header, however its cells are marked.
48
+ if (cells.every((cell) => cell.text === ''))
49
+ for (const cell of cells)
50
+ cell.header = false;
51
+ rows.push({ cells, inHead });
52
+ }
53
+ else if (SECTION_TAGS.has(tagOf(child)) ||
54
+ SECTION_CLASSES.some((c) => hasClass(child, c))) {
55
+ collect(child, inHead || isHead(child));
56
+ }
57
+ }
58
+ };
59
+ collect(table, false);
60
+ return buildGrid(rows);
61
+ }
62
+ //# sourceMappingURL=tables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tables.js","sourceRoot":"","sources":["../../src/html/tables.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAkB,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE1D,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAC1D,MAAM,eAAe,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;AAEhE,SAAS,KAAK,CAAC,OAAgB;IAC7B,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,MAAM,CAAC,OAAgB;IAC9B,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,OAAO,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,IAAI,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,MAAM,CAAC,OAAgB;IAC9B,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AACtE,CAAC;AAED,uFAAuF;AACvF,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,sCAAsC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAc,EACd,QAAmC,EACn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;gBAC9B,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAC/C,CAAC;gBACD,OAAO,CAAC,KAAK,EAAE,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IACF,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACtB,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @fileoverview Package root: the document model, format detection, `parse` for any
3
+ * format, and renderers. Format parsers also live on subpaths (`scholarly-parse/jats`,
4
+ * `/tei`, `/latexml`, `/html`, `/pdf`); `parse` loads them on first use, so an
5
+ * application only ever loads the parsers it uses.
6
+ * @module src/index
7
+ */
8
+ export { detect } from './detect.js';
9
+ export * from './model/index.js';
10
+ export { type AutoParseOptions, parse } from './parse.js';
11
+ export * from './render/index.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC1D,cAAc,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @fileoverview Package root: the document model, format detection, `parse` for any
3
+ * format, and renderers. Format parsers also live on subpaths (`scholarly-parse/jats`,
4
+ * `/tei`, `/latexml`, `/html`, `/pdf`); `parse` loads them on first use, so an
5
+ * application only ever loads the parsers it uses.
6
+ * @module src/index
7
+ */
8
+ export { detect } from './detect.js';
9
+ export * from './model/index.js';
10
+ export { parse } from './parse.js';
11
+ export * from './render/index.js';
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAyB,KAAK,EAAE,MAAM,YAAY,CAAC;AAC1D,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @fileoverview Collects warnings and unhandled-element counts while a parser walks a
3
+ * document, then freezes them into the `Diagnostics` a document reports. Internal to
4
+ * the parsers; not part of the public API.
5
+ * @module src/model/diagnostics
6
+ */
7
+ import type { Diagnostics, ParseQuality, ParseWarningCode } from './document.js';
8
+ /** A diagnostics collector bound to one parse. */
9
+ export interface DiagnosticsCollector {
10
+ finish(quality: ParseQuality): Diagnostics;
11
+ unhandled(element: string): void;
12
+ warn(code: ParseWarningCode, message: string, where?: string): void;
13
+ }
14
+ export declare function createDiagnostics(): DiagnosticsCollector;
15
+ //# sourceMappingURL=diagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/model/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAgB,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE/F,kDAAkD;AAClD,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,OAAO,EAAE,YAAY,GAAG,WAAW,CAAC;IAC3C,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,IAAI,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrE;AAKD,wBAAgB,iBAAiB,IAAI,oBAAoB,CAkCxD"}
@@ -0,0 +1,37 @@
1
+ /** Most warnings of one code a document reports; the rest are counted in the last one. */
2
+ const MAX_WARNINGS_PER_CODE = 20;
3
+ export function createDiagnostics() {
4
+ const warnings = [];
5
+ const perCode = new Map();
6
+ const unhandled = new Map();
7
+ return {
8
+ finish(quality) {
9
+ for (const [code, count] of perCode) {
10
+ if (count > MAX_WARNINGS_PER_CODE) {
11
+ warnings.push({
12
+ code,
13
+ message: `${count - MAX_WARNINGS_PER_CODE} more "${code}" warnings not listed`,
14
+ });
15
+ }
16
+ }
17
+ return {
18
+ quality,
19
+ unhandled: [...unhandled]
20
+ .map(([element, count]) => ({ count, element }))
21
+ .sort((a, b) => b.count - a.count || a.element.localeCompare(b.element)),
22
+ warnings,
23
+ };
24
+ },
25
+ unhandled(element) {
26
+ unhandled.set(element, (unhandled.get(element) ?? 0) + 1);
27
+ },
28
+ warn(code, message, where) {
29
+ const count = (perCode.get(code) ?? 0) + 1;
30
+ perCode.set(code, count);
31
+ if (count <= MAX_WARNINGS_PER_CODE) {
32
+ warnings.push(where === undefined ? { code, message } : { code, message, where });
33
+ }
34
+ },
35
+ };
36
+ }
37
+ //# sourceMappingURL=diagnostics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../../src/model/diagnostics.ts"],"names":[],"mappings":"AAeA,0FAA0F;AAC1F,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAEjC,MAAM,UAAU,iBAAiB;IAC/B,MAAM,QAAQ,GAAmB,EAAE,CAAC;IACpC,MAAM,OAAO,GAAG,IAAI,GAAG,EAA4B,CAAC;IACpD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE5C,OAAO;QACL,MAAM,CAAC,OAAO;YACZ,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,OAAO,EAAE,CAAC;gBACpC,IAAI,KAAK,GAAG,qBAAqB,EAAE,CAAC;oBAClC,QAAQ,CAAC,IAAI,CAAC;wBACZ,IAAI;wBACJ,OAAO,EAAE,GAAG,KAAK,GAAG,qBAAqB,UAAU,IAAI,uBAAuB;qBAC/E,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YACD,OAAO;gBACL,OAAO;gBACP,SAAS,EAAE,CAAC,GAAG,SAAS,CAAC;qBACtB,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;qBAC/C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;gBAC1E,QAAQ;aACT,CAAC;QACJ,CAAC;QACD,SAAS,CAAC,OAAO;YACf,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5D,CAAC;QACD,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK;YACvB,MAAM,KAAK,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YAC3C,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACzB,IAAI,KAAK,IAAI,qBAAqB,EAAE,CAAC;gBACnC,QAAQ,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;YACpF,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,289 @@
1
+ /**
2
+ * @fileoverview The document model every format parser produces. One shape for a
3
+ * scholarly article regardless of source: front matter, a section tree of typed
4
+ * blocks, references, and diagnostics describing how much structure was recovered.
5
+ *
6
+ * Inline text (paragraph bodies, titles, captions, list items, reference text) is
7
+ * CommonMark with GFM extensions: emphasis, `$…$` inline math where the source
8
+ * carries TeX, links, and citation markers as printed in the source. Block-level
9
+ * structure is typed, so renderers never re-parse Markdown to find a table.
10
+ * @module src/model/document
11
+ */
12
+ /** The source format a document was parsed from. */
13
+ export type SourceFormat = 'jats' | 'tei' | 'latexml' | 'html' | 'pdf';
14
+ /**
15
+ * How much structure the parser recovered.
16
+ * - `structured` — sections and blocks read from semantic markup (JATS, TEI, LaTeXML).
17
+ * - `partial` — structure inferred from presentation (headings in HTML, font sizes in PDF).
18
+ * - `flat` — text only; no reliable section boundaries.
19
+ */
20
+ export type ParseQuality = 'structured' | 'partial' | 'flat';
21
+ /** A date as precise as the source states it. */
22
+ export interface PartialDate {
23
+ day?: number;
24
+ month?: number;
25
+ year: number;
26
+ }
27
+ /** A contributor to the work. */
28
+ export interface Author {
29
+ /** Indices into {@link DocumentMetadata.affiliations}. */
30
+ affiliations?: number[];
31
+ /** Set for a group author (a consortium or working group) instead of a person. */
32
+ collective?: string;
33
+ corresponding?: boolean;
34
+ email?: string;
35
+ family?: string;
36
+ given?: string;
37
+ /** Display name as the source prints it, or `given family` when only parts are given. */
38
+ name: string;
39
+ /** Bare ORCID iD, e.g. `0000-0002-1825-0097`. */
40
+ orcid?: string;
41
+ }
42
+ /** Identifiers the source carries for the work itself. */
43
+ export interface Identifiers {
44
+ /** arXiv ID without the `arXiv:` prefix, version suffix kept when present. */
45
+ arxiv?: string;
46
+ /** Lowercased DOI without a resolver prefix. */
47
+ doi?: string;
48
+ /** Publisher-assigned identifiers keyed by the source's own type label. */
49
+ other?: Record<string, string>;
50
+ /** PMC ID with the `PMC` prefix. */
51
+ pmcid?: string;
52
+ pmid?: string;
53
+ }
54
+ /** Journal or venue details. */
55
+ export interface Venue {
56
+ /** Electronic article locator (JATS `<elocation-id>`). */
57
+ elocationId?: string;
58
+ issn?: string;
59
+ issue?: string;
60
+ pages?: string;
61
+ publisher?: string;
62
+ title?: string;
63
+ volume?: string;
64
+ }
65
+ /** The license the source declares for the work, passed through verbatim. */
66
+ export interface License {
67
+ /** License statement text as printed. */
68
+ text?: string;
69
+ /** License URL, e.g. `https://creativecommons.org/licenses/by/4.0/`. */
70
+ url?: string;
71
+ }
72
+ /**
73
+ * A work the source declares this one related to: the article a correction corrects,
74
+ * the notice retracting it, a commentary on it, its preprint.
75
+ */
76
+ export interface RelatedWork {
77
+ /** Lowercased DOI without a resolver prefix. */
78
+ doi?: string;
79
+ /** PMC ID with the `PMC` prefix. */
80
+ pmcid?: string;
81
+ pmid?: string;
82
+ /**
83
+ * The relation as the source names it, e.g. JATS `@related-article-type`
84
+ * (`corrected-article`, `retraction-forward`, `commentary`, `preprint`).
85
+ */
86
+ relation: string;
87
+ /** The source's sentence about the work, else its title, as inline Markdown. */
88
+ text?: string;
89
+ url?: string;
90
+ }
91
+ /** Bibliographic front matter. Every field is optional because sources vary. */
92
+ export interface DocumentMetadata {
93
+ affiliations?: string[];
94
+ /** Article type as the source labels it (JATS `@article-type`, e.g. `research-article`). */
95
+ articleType?: string;
96
+ authors?: Author[];
97
+ identifiers?: Identifiers;
98
+ keywords?: string[];
99
+ /** BCP 47 language tag when the source declares one. */
100
+ language?: string;
101
+ license?: License;
102
+ published?: PartialDate;
103
+ related?: RelatedWork[];
104
+ subtitle?: string;
105
+ title?: string;
106
+ venue?: Venue;
107
+ }
108
+ /**
109
+ * What an abstract is for. A graphical or plain-language abstract never stands in
110
+ * for the main one; renderers pick `main` first.
111
+ */
112
+ export type AbstractKind = 'main' | 'graphical' | 'plain-language' | 'teaser' | 'translated' | 'other';
113
+ /** One abstract. Structured abstracts (Background / Methods / …) carry titled sections. */
114
+ export interface Abstract {
115
+ kind: AbstractKind;
116
+ /** BCP 47 language tag when the abstract declares one (usual for `translated`). */
117
+ language?: string;
118
+ sections: Section[];
119
+ /** Heading the source gives the abstract, when it differs from "Abstract". */
120
+ title?: string;
121
+ }
122
+ /** Where a section sits in the article. */
123
+ export type SectionKind = 'body' | 'appendix' | 'acknowledgments' | 'declarations' | 'data-availability' | 'notes'
124
+ /** A document embedded in the article, such as a peer-review report or author response. */
125
+ | 'sub-article';
126
+ /** A section and its subsections, in reading order. */
127
+ export interface Section {
128
+ blocks: Block[];
129
+ /** Stable within the document: the source's own ID when present, else derived from the path. */
130
+ id: string;
131
+ kind: SectionKind;
132
+ /** Printed number or letter, e.g. `2.1` or `A`. */
133
+ label?: string;
134
+ sections: Section[];
135
+ title?: string;
136
+ }
137
+ /** A paragraph of inline Markdown. */
138
+ export interface ParagraphBlock {
139
+ text: string;
140
+ type: 'paragraph';
141
+ }
142
+ /**
143
+ * A list. Each item holds its own blocks, so lists nest. A definition list is an
144
+ * unordered list whose items open with the term in bold.
145
+ */
146
+ export interface ListBlock {
147
+ items: Block[][];
148
+ ordered: boolean;
149
+ title?: string;
150
+ type: 'list';
151
+ }
152
+ /** Why a table has no rows. The table is still reported with its label and caption. */
153
+ export type TableUnextractableReason = 'graphic-only' | 'cals-tgroup' | 'no-rows';
154
+ /**
155
+ * A table. Rows are cell text by grid column with `colspan`/`rowspan` expanded, so a
156
+ * well-formed table is rectangular.
157
+ */
158
+ export interface TableBlock {
159
+ caption?: string;
160
+ footnotes?: string[];
161
+ /** Leading rows of {@link rows} that are header rows. */
162
+ headerRows: number;
163
+ id?: string;
164
+ label?: string;
165
+ rows: string[][];
166
+ type: 'table';
167
+ /** Set only when {@link rows} is empty. */
168
+ unextractable?: TableUnextractableReason;
169
+ }
170
+ /** A figure. The image itself is referenced, never embedded. */
171
+ export interface FigureBlock {
172
+ /** Image description the source provides for accessibility. */
173
+ alt?: string;
174
+ caption?: string;
175
+ /** Image reference exactly as the source gives it; may be relative to the source document. */
176
+ href?: string;
177
+ id?: string;
178
+ label?: string;
179
+ type: 'figure';
180
+ }
181
+ /** A display formula. */
182
+ export interface FormulaBlock {
183
+ /** The image a formula is published as when the source has no TeX, MathML, or text for it. */
184
+ href?: string;
185
+ id?: string;
186
+ label?: string;
187
+ /**
188
+ * The formula in TeX notation, without math delimiters: the document's own TeX when
189
+ * it carries some, else converted from MathML.
190
+ */
191
+ tex?: string;
192
+ /** Plain text of the formula, set only when no TeX could be produced. */
193
+ text?: string;
194
+ type: 'formula';
195
+ }
196
+ /** Preformatted text: code, algorithm listings, sequence data. */
197
+ export interface CodeBlock {
198
+ language?: string;
199
+ text: string;
200
+ type: 'code';
201
+ }
202
+ /** A block quotation. */
203
+ export interface QuoteBlock {
204
+ blocks: Block[];
205
+ type: 'quote';
206
+ }
207
+ /**
208
+ * A boxed or sidebar element with its own content (JATS `<boxed-text>`), or a
209
+ * labeled statement such as a theorem or proof. Boxes can hold sections of their own.
210
+ */
211
+ export interface BoxBlock {
212
+ blocks: Block[];
213
+ id?: string;
214
+ label?: string;
215
+ sections: Section[];
216
+ title?: string;
217
+ type: 'box';
218
+ }
219
+ /** A supplementary file referenced from the article. */
220
+ export interface SupplementBlock {
221
+ caption?: string;
222
+ href?: string;
223
+ id?: string;
224
+ label?: string;
225
+ type: 'supplement';
226
+ }
227
+ /** Every block type. Switch on `type`. */
228
+ export type Block = ParagraphBlock | ListBlock | TableBlock | FigureBlock | FormulaBlock | CodeBlock | QuoteBlock | BoxBlock | SupplementBlock;
229
+ /** One entry in the reference list. */
230
+ export interface Reference {
231
+ arxiv?: string;
232
+ /** Author names as printed. */
233
+ authors?: string[];
234
+ doi?: string;
235
+ id?: string;
236
+ /** Printed label without brackets or a trailing period: `12` for `[12]` or `12.`. */
237
+ label?: string;
238
+ pmcid?: string;
239
+ pmid?: string;
240
+ /** Journal, book, or proceedings title. */
241
+ source?: string;
242
+ /** The full citation as inline Markdown. Always present. */
243
+ text: string;
244
+ title?: string;
245
+ url?: string;
246
+ year?: string;
247
+ }
248
+ /** A footnote. */
249
+ export interface Footnote {
250
+ id?: string;
251
+ label?: string;
252
+ text: string;
253
+ }
254
+ /** A condition worth reporting that did not stop the parse. */
255
+ export interface ParseWarning {
256
+ code: ParseWarningCode;
257
+ message: string;
258
+ /** Where in the source it occurred: an element path, section ID, or page number. */
259
+ where?: string;
260
+ }
261
+ /** Machine-readable warning codes. */
262
+ export type ParseWarningCode = 'no-body' | 'no-title' | 'no-abstract' | 'unhandled-element' | 'table-unextractable' | 'math-without-tex' | 'structure-inferred' | 'text-layer-missing' | 'truncated-input' | 'unmapped-glyphs';
263
+ /** How the parse went. */
264
+ export interface Diagnostics {
265
+ quality: ParseQuality;
266
+ /** Source elements with no handler, and how often each occurred. */
267
+ unhandled: {
268
+ count: number;
269
+ element: string;
270
+ }[];
271
+ warnings: ParseWarning[];
272
+ }
273
+ /** A parsed scholarly document. */
274
+ export interface ScholarlyDocument {
275
+ abstracts: Abstract[];
276
+ /** Back-matter sections: appendices, acknowledgments, declarations, notes. */
277
+ back: Section[];
278
+ body: Section[];
279
+ diagnostics: Diagnostics;
280
+ /** Source-specific origin, e.g. `pmc`, `europepmc`, `grobid`, `arxiv`, `ar5iv`. */
281
+ flavor?: string;
282
+ /** Figures and tables the source places outside any section (JATS `<floats-group>`). */
283
+ floats: Block[];
284
+ footnotes: Footnote[];
285
+ format: SourceFormat;
286
+ metadata: DocumentMetadata;
287
+ references: Reference[];
288
+ }
289
+ //# sourceMappingURL=document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/model/document.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,oDAAoD;AACpD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,CAAC;AAE7D,iDAAiD;AACjD,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,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