scholarly-parse 0.2.1 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +4 -4
- package/changelog/0.2.x/0.2.2.md +41 -0
- package/changelog/0.2.x/0.2.3.md +36 -0
- package/changelog/0.2.x/0.2.4.md +34 -0
- package/dist/detect.d.ts +2 -2
- package/dist/detect.js +2 -2
- package/dist/formats/html/context.d.ts +4 -1
- package/dist/formats/html/context.d.ts.map +1 -1
- package/dist/formats/html/context.js +8 -3
- package/dist/formats/html/context.js.map +1 -1
- package/dist/formats/html/parse.js +31 -20
- package/dist/formats/html/parse.js.map +1 -1
- package/dist/formats/jats/front.d.ts.map +1 -1
- package/dist/formats/jats/front.js +18 -7
- package/dist/formats/jats/front.js.map +1 -1
- package/dist/formats/jats/references.d.ts.map +1 -1
- package/dist/formats/jats/references.js +43 -13
- package/dist/formats/jats/references.js.map +1 -1
- package/dist/formats/jats/tables.d.ts.map +1 -1
- package/dist/formats/jats/tables.js +19 -10
- package/dist/formats/jats/tables.js.map +1 -1
- package/dist/formats/latexml/parse.d.ts.map +1 -1
- package/dist/formats/latexml/parse.js +4 -3
- package/dist/formats/latexml/parse.js.map +1 -1
- package/dist/formats/pdf/blocks.d.ts +2 -1
- package/dist/formats/pdf/blocks.d.ts.map +1 -1
- package/dist/formats/pdf/blocks.js +82 -19
- package/dist/formats/pdf/blocks.js.map +1 -1
- package/dist/formats/pdf/float-labels.d.ts +13 -0
- package/dist/formats/pdf/float-labels.d.ts.map +1 -0
- package/dist/formats/pdf/float-labels.js +39 -0
- package/dist/formats/pdf/float-labels.js.map +1 -0
- package/dist/formats/pdf/form-text.d.ts +28 -0
- package/dist/formats/pdf/form-text.d.ts.map +1 -0
- package/dist/formats/pdf/form-text.js +101 -0
- package/dist/formats/pdf/form-text.js.map +1 -0
- package/dist/formats/pdf/layout.d.ts +15 -1
- package/dist/formats/pdf/layout.d.ts.map +1 -1
- package/dist/formats/pdf/layout.js +314 -37
- package/dist/formats/pdf/layout.js.map +1 -1
- package/dist/formats/pdf/letter-spacing.d.ts +15 -0
- package/dist/formats/pdf/letter-spacing.d.ts.map +1 -0
- package/dist/formats/pdf/letter-spacing.js +75 -0
- package/dist/formats/pdf/letter-spacing.js.map +1 -0
- package/dist/formats/pdf/lines.d.ts +0 -7
- package/dist/formats/pdf/lines.d.ts.map +1 -1
- package/dist/formats/pdf/lines.js +5 -4
- package/dist/formats/pdf/lines.js.map +1 -1
- package/dist/formats/pdf/load.d.ts.map +1 -1
- package/dist/formats/pdf/load.js +17 -7
- package/dist/formats/pdf/load.js.map +1 -1
- package/dist/formats/pdf/parse.js +3 -2
- package/dist/formats/pdf/parse.js.map +1 -1
- package/dist/formats/pdf/references.js +38 -5
- package/dist/formats/pdf/references.js.map +1 -1
- package/dist/formats/pdf/structure.d.ts +1 -0
- package/dist/formats/pdf/structure.d.ts.map +1 -1
- package/dist/formats/pdf/structure.js +105 -24
- package/dist/formats/pdf/structure.js.map +1 -1
- package/dist/formats/tei/parse.js +30 -15
- package/dist/formats/tei/parse.js.map +1 -1
- package/dist/html/interstitial.d.ts +18 -7
- package/dist/html/interstitial.d.ts.map +1 -1
- package/dist/html/interstitial.js +50 -13
- package/dist/html/interstitial.js.map +1 -1
- package/dist/html/tables.d.ts +6 -3
- package/dist/html/tables.d.ts.map +1 -1
- package/dist/html/tables.js +23 -10
- package/dist/html/tables.js.map +1 -1
- package/dist/model/arxiv.d.ts +11 -3
- package/dist/model/arxiv.d.ts.map +1 -1
- package/dist/model/arxiv.js +17 -3
- package/dist/model/arxiv.js.map +1 -1
- package/dist/model/document.d.ts +8 -2
- package/dist/model/document.d.ts.map +1 -1
- package/dist/model/result.d.ts +11 -8
- package/dist/model/result.d.ts.map +1 -1
- package/dist/model/result.js +30 -2
- package/dist/model/result.js.map +1 -1
- package/dist/model/section-kinds.d.ts.map +1 -1
- package/dist/model/section-kinds.js +4 -2
- package/dist/model/section-kinds.js.map +1 -1
- package/dist/model/table-grid.d.ts +16 -7
- package/dist/model/table-grid.d.ts.map +1 -1
- package/dist/model/table-grid.js +56 -38
- package/dist/model/table-grid.js.map +1 -1
- package/dist/parse.d.ts +2 -1
- package/dist/parse.d.ts.map +1 -1
- package/dist/parse.js +2 -1
- package/dist/parse.js.map +1 -1
- package/dist/render/escape.d.ts +6 -0
- package/dist/render/escape.d.ts.map +1 -1
- package/dist/render/escape.js +10 -4
- package/dist/render/escape.js.map +1 -1
- package/dist/render/inline.d.ts +6 -3
- package/dist/render/inline.d.ts.map +1 -1
- package/dist/render/inline.js +72 -6
- package/dist/render/inline.js.map +1 -1
- package/package.json +13 -11
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Recognizes a page that stands in for the document: a bot-protection
|
|
3
|
-
* challenge, an access-denied page from a CDN,
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* challenge, an access-denied page from a CDN, an HTTP error page, a redirect stub, or
|
|
4
|
+
* arXiv's page for a paper it has no HTML of. Fetchers commonly receive one with a 200,
|
|
5
|
+
* 403, or 404 status, and parsing it as an article would produce a document about "Just a
|
|
6
|
+
* moment...". Only the raw markup is inspected, so no DOM is built.
|
|
6
7
|
* @module src/html/interstitial
|
|
7
8
|
*/
|
|
9
|
+
import type { ParseFailure } from '../model/result.js';
|
|
10
|
+
/** Messages arXiv shows in place of a paper it could not convert. */
|
|
11
|
+
export declare const CONVERSION_FAILED: RegExp;
|
|
12
|
+
/** The failure message for arXiv's page for a paper it has no HTML conversion of. */
|
|
13
|
+
export declare const NO_CONVERSION = "The page reports that no HTML conversion of the paper is available";
|
|
8
14
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* so
|
|
15
|
+
* The failure a page standing in for the document reports, or undefined for a real page.
|
|
16
|
+
* arXiv's page for a paper it has no HTML conversion of is `empty`, as the paper has no
|
|
17
|
+
* such form, and so is its page for an ID with no paper or a withdrawn version; a
|
|
18
|
+
* challenge, access-denied, or HTTP error page, or a redirect stub, is `blocked`. A page
|
|
19
|
+
* carrying scholarly citation metadata or substantial text never
|
|
20
|
+
* stands in, so a bot-protection script loaded by a real article does not trip this;
|
|
21
|
+
* arXiv's phrases count only inside a `<title>` or `<h1>` that holds text and inline
|
|
22
|
+
* markup alone, a status line only as the whole of one.
|
|
12
23
|
*/
|
|
13
|
-
export declare function
|
|
24
|
+
export declare function standInFailure(html: string): ParseFailure | undefined;
|
|
14
25
|
//# sourceMappingURL=interstitial.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interstitial.d.ts","sourceRoot":"","sources":["../../src/html/interstitial.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"interstitial.d.ts","sourceRoot":"","sources":["../../src/html/interstitial.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA+DvD,qEAAqE;AACrE,eAAO,MAAM,iBAAiB,QAC+D,CAAC;AAE9F,qFAAqF;AACrF,eAAO,MAAM,aAAa,uEAAuE,CAAC;AAelG;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAqBrE"}
|
|
@@ -1,10 +1,3 @@
|
|
|
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
1
|
/** Interstitials are small; anything larger is a real page with more than a challenge on it. */
|
|
9
2
|
const MAX_INTERSTITIAL_CHARS = 512 * 1024;
|
|
10
3
|
/** Visible text past which a page carries content of its own, whatever scripts it loads. */
|
|
@@ -43,11 +36,46 @@ const META_TAG = /<meta\b[^<>]*/gi;
|
|
|
43
36
|
/** A refresh tag's `content`: its delay, then the URL it redirects to. */
|
|
44
37
|
const REFRESH_TARGET = /content=["']?\s*\d+\s*;\s*url=\s*['"]?([^'">\s]+)/i;
|
|
45
38
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
39
|
+
* Each `<title>` and `<h1>` holding text and at most 64 inline tags alone (`<h1><span>404</span>
|
|
40
|
+
* Not Found</h1>`), its content in group 2. The content stops at any other tag, and the
|
|
41
|
+
* opening tag at the next `<`, so each try reads no further than the next such tag. The
|
|
42
|
+
* bound keeps a run of inline tags from repeating the group past where JavaScriptCore's
|
|
43
|
+
* regex JIT hands the match to its interpreter, which takes about 50 times as long.
|
|
44
|
+
*/
|
|
45
|
+
const HEADING = /<(title|h1)\b[^<>]*>([^<]*(?:<\/?(?:a|b|code|em|font|i|small|span|strong|u)\b[^<>]*>[^<]*){0,64})<\/\1\s*>/gi;
|
|
46
|
+
/** A heading's text: its inline tags removed, a no-break space read as a space, whitespace collapsed. */
|
|
47
|
+
function headingText(content) {
|
|
48
|
+
return content
|
|
49
|
+
.replace(/<[^<>]*>/g, '')
|
|
50
|
+
.replace(/&(?:nbsp|#160|#xa0);/gi, ' ')
|
|
51
|
+
.replace(/\s+/g, ' ')
|
|
52
|
+
.trim();
|
|
53
|
+
}
|
|
54
|
+
/** Messages arXiv shows in place of a paper it could not convert. */
|
|
55
|
+
export const CONVERSION_FAILED = /No HTML for|HTML is not available|Conversion to HTML had a Fatal error|conversion failed/i;
|
|
56
|
+
/** The failure message for arXiv's page for a paper it has no HTML conversion of. */
|
|
57
|
+
export const NO_CONVERSION = 'The page reports that no HTML conversion of the paper is available';
|
|
58
|
+
/** arXiv's page for an ID it has no paper under, or for a withdrawn version. */
|
|
59
|
+
const NO_PAPER = /^No document for |^This version of .+ has been withdrawn/;
|
|
60
|
+
/**
|
|
61
|
+
* An HTTP status line as a whole heading: a 4xx or 5xx code, after Tomcat's `HTTP Status `
|
|
62
|
+
* or Jetty's `Error ` where those servers write one, and a reason phrase servers send for
|
|
63
|
+
* it (RFC 9110's, and the variants nginx and Apache write, optionally closed by a period),
|
|
64
|
+
* or IIS's ` - ` and a sentence (`404 - File or directory not found.`). A heading such as
|
|
65
|
+
* `500 Years of Printing` is not one, nor is `404 - A Study of Link Rot`, which no period closes.
|
|
66
|
+
*/
|
|
67
|
+
const HTTP_ERROR = /^(?:HTTP Status |Error )?([45]\d\d)(?: - [^<>]{1,78}\.|(?: | – )(?:Bad Request|Unauthorized|Payment Required|Forbidden|Not Found|Method Not Allowed|Not Acceptable|Proxy Authentication Required|Request Time-?out|Conflict|Gone|Length Required|Precondition Failed|(?:Request Entity|Payload|Content) Too Large|(?:Request-)?URI Too (?:Long|Large)|Unsupported Media Type|(?:Requested )?Range Not Satisfiable|Expectation Failed|I['’]m a teapot|Misdirected Request|Unprocessable (?:Entity|Content)|Locked|Failed Dependency|Too Early|Upgrade Required|Precondition Required|Too Many Requests|Request Header (?:Fields|Or Cookie) Too Large|Unavailable For Legal Reasons|Client Closed Request|Internal Server Error|Not Implemented|Bad Gateway|Service (?:Temporarily )?Unavailable|Gateway Time-?out|HTTP Version Not Supported|Variant Also Negotiates|Insufficient Storage|Loop Detected|Not Extended|Network Authentication Required)\.?)$/i;
|
|
68
|
+
/**
|
|
69
|
+
* The failure a page standing in for the document reports, or undefined for a real page.
|
|
70
|
+
* arXiv's page for a paper it has no HTML conversion of is `empty`, as the paper has no
|
|
71
|
+
* such form, and so is its page for an ID with no paper or a withdrawn version; a
|
|
72
|
+
* challenge, access-denied, or HTTP error page, or a redirect stub, is `blocked`. A page
|
|
73
|
+
* carrying scholarly citation metadata or substantial text never
|
|
74
|
+
* stands in, so a bot-protection script loaded by a real article does not trip this;
|
|
75
|
+
* arXiv's phrases count only inside a `<title>` or `<h1>` that holds text and inline
|
|
76
|
+
* markup alone, a status line only as the whole of one.
|
|
49
77
|
*/
|
|
50
|
-
export function
|
|
78
|
+
export function standInFailure(html) {
|
|
51
79
|
if (html.length > MAX_INTERSTITIAL_CHARS)
|
|
52
80
|
return;
|
|
53
81
|
const metaTags = html.match(META_TAG) ?? [];
|
|
@@ -55,12 +83,21 @@ export function interstitialReason(html) {
|
|
|
55
83
|
return;
|
|
56
84
|
if (visibleText(html).length > MAX_INTERSTITIAL_TEXT)
|
|
57
85
|
return;
|
|
86
|
+
const headings = Array.from(html.matchAll(HEADING), (match) => headingText(match[2] ?? ''));
|
|
87
|
+
if (headings.some((heading) => CONVERSION_FAILED.test(heading)))
|
|
88
|
+
return { message: NO_CONVERSION, reason: 'empty' };
|
|
89
|
+
if (headings.some((heading) => NO_PAPER.test(heading)))
|
|
90
|
+
return { message: 'The page reports that arXiv has no such paper or version', reason: 'empty' };
|
|
91
|
+
const blocked = (message) => ({ message, reason: 'blocked' });
|
|
58
92
|
const match = SIGNATURES.find(([pattern]) => pattern.test(html));
|
|
59
93
|
if (match)
|
|
60
|
-
return `The page is ${match[1]}, not the document
|
|
94
|
+
return blocked(`The page is ${match[1]}, not the document`);
|
|
95
|
+
const status = headings.map((heading) => HTTP_ERROR.exec(heading)?.[1]).find(Boolean);
|
|
96
|
+
if (status)
|
|
97
|
+
return blocked(`The page is an HTTP ${status} error page, not the document`);
|
|
61
98
|
const refresh = metaTags.map(redirectTarget).find(Boolean);
|
|
62
99
|
if (refresh)
|
|
63
|
-
return `The page is a redirect stub to ${refresh.replace(/&/g, '&')}, not the document
|
|
100
|
+
return blocked(`The page is a redirect stub to ${refresh.replace(/&/g, '&')}, not the document`);
|
|
64
101
|
return;
|
|
65
102
|
}
|
|
66
103
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interstitial.js","sourceRoot":"","sources":["../../src/html/interstitial.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interstitial.js","sourceRoot":"","sources":["../../src/html/interstitial.ts"],"names":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BAAqB,CAAC,IAAY;IACzC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QACjD,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QAC1C,IAAI,IAAI,CAAC,KAAK,GAAG,MAAM,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,SAAS;QACxD,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,KAAK,IAAI,OAAO,EAAE,IAAI,CAAC,CAAC;QACjD,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAC9C,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACnB,SAAS;QACX,CAAC;QACD,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;QAC5C,MAAM,GAAG,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACrC,CAAC;IACD,OAAO,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC"}
|
package/dist/html/tables.d.ts
CHANGED
|
@@ -7,9 +7,12 @@
|
|
|
7
7
|
import { type Grid, type GridBudget } from '../model/table-grid.js';
|
|
8
8
|
/**
|
|
9
9
|
* Read a table into a grid, charging the document's `budget`; `cellText` renders one
|
|
10
|
-
* cell's content.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* cell's content. Its row groups are each section (`<thead>`, `<tbody>`, `<tfoot>`, or
|
|
11
|
+
* their `ltx_` classes), and each run of rows outside a section, a section nested in
|
|
12
|
+
* another included; footer sections come after the rest, in source order, as HTML shows
|
|
13
|
+
* them. With `boldHeaders`, a cell whose text is entirely bold counts as a header cell,
|
|
14
|
+
* so a leading all-bold row becomes the header: LaTeX tables mark their header row that
|
|
15
|
+
* way, with no `<th>`.
|
|
13
16
|
*/
|
|
14
17
|
export declare function readHtmlTable(table: Element, cellText: (cell: Element) => string, budget: GridBudget, options?: {
|
|
15
18
|
boldHeaders?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../src/html/tables.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAEL,KAAK,IAAI,EACT,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../src/html/tables.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAEL,KAAK,IAAI,EACT,KAAK,UAAU,EAIhB,MAAM,wBAAwB,CAAC;AA4BhC;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM,EACnC,MAAM,EAAE,UAAU,EAClB,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GACtC,IAAI,CAsCN"}
|
package/dist/html/tables.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* text, not to the outer table.
|
|
5
5
|
* @module src/html/tables
|
|
6
6
|
*/
|
|
7
|
-
import { buildGrid, spanValue, } from '../model/table-grid.js';
|
|
7
|
+
import { buildGrid, rowspanValue, spanValue, } from '../model/table-grid.js';
|
|
8
8
|
import { childElements, hasClass, tagOf } from './dom.js';
|
|
9
9
|
const SECTION_TAGS = new Set(['thead', 'tbody', 'tfoot']);
|
|
10
10
|
const SECTION_CLASSES = ['ltx_thead', 'ltx_tbody', 'ltx_tfoot'];
|
|
@@ -18,19 +18,27 @@ function isCell(element) {
|
|
|
18
18
|
function isHead(element) {
|
|
19
19
|
return tagOf(element) === 'thead' || hasClass(element, 'ltx_thead');
|
|
20
20
|
}
|
|
21
|
+
function isFoot(element) {
|
|
22
|
+
return tagOf(element) === 'tfoot' || hasClass(element, 'ltx_tfoot');
|
|
23
|
+
}
|
|
21
24
|
/** A cell whose whole text is bold Markdown (`**Model**`, `**Active** **Params**`). */
|
|
22
25
|
function isBoldText(text) {
|
|
23
26
|
return /^\*\*[^*]+\*\*(?:\s*\*\*[^*]+\*\*)*$/.test(text);
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
26
29
|
* Read a table into a grid, charging the document's `budget`; `cellText` renders one
|
|
27
|
-
* cell's content.
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
+
* cell's content. Its row groups are each section (`<thead>`, `<tbody>`, `<tfoot>`, or
|
|
31
|
+
* their `ltx_` classes), and each run of rows outside a section, a section nested in
|
|
32
|
+
* another included; footer sections come after the rest, in source order, as HTML shows
|
|
33
|
+
* them. With `boldHeaders`, a cell whose text is entirely bold counts as a header cell,
|
|
34
|
+
* so a leading all-bold row becomes the header: LaTeX tables mark their header row that
|
|
35
|
+
* way, with no `<th>`.
|
|
30
36
|
*/
|
|
31
37
|
export function readHtmlTable(table, cellText, budget, options = {}) {
|
|
32
|
-
const
|
|
33
|
-
const
|
|
38
|
+
const groups = [];
|
|
39
|
+
const feet = [];
|
|
40
|
+
const collect = (container, inHead, into) => {
|
|
41
|
+
let rows;
|
|
34
42
|
for (const child of childElements(container)) {
|
|
35
43
|
if (isRow(child)) {
|
|
36
44
|
const cells = childElements(child)
|
|
@@ -41,7 +49,7 @@ export function readHtmlTable(table, cellText, budget, options = {}) {
|
|
|
41
49
|
return {
|
|
42
50
|
colspan: spanValue(cell.getAttribute('colspan')),
|
|
43
51
|
header: markedHeader || (options.boldHeaders === true && (text === '' || isBoldText(text))),
|
|
44
|
-
rowspan:
|
|
52
|
+
rowspan: rowspanValue(cell.getAttribute('rowspan')),
|
|
45
53
|
text,
|
|
46
54
|
};
|
|
47
55
|
});
|
|
@@ -49,15 +57,20 @@ export function readHtmlTable(table, cellText, budget, options = {}) {
|
|
|
49
57
|
if (cells.every((cell) => cell.text === ''))
|
|
50
58
|
for (const cell of cells)
|
|
51
59
|
cell.header = false;
|
|
60
|
+
if (!rows) {
|
|
61
|
+
rows = [];
|
|
62
|
+
into.push(rows);
|
|
63
|
+
}
|
|
52
64
|
rows.push({ cells, inHead });
|
|
53
65
|
}
|
|
54
66
|
else if (SECTION_TAGS.has(tagOf(child)) ||
|
|
55
67
|
SECTION_CLASSES.some((c) => hasClass(child, c))) {
|
|
56
|
-
|
|
68
|
+
rows = undefined;
|
|
69
|
+
collect(child, inHead || isHead(child), isFoot(child) ? feet : into);
|
|
57
70
|
}
|
|
58
71
|
}
|
|
59
72
|
};
|
|
60
|
-
collect(table, false);
|
|
61
|
-
return buildGrid(
|
|
73
|
+
collect(table, false, groups);
|
|
74
|
+
return buildGrid([...groups, ...feet], budget);
|
|
62
75
|
}
|
|
63
76
|
//# sourceMappingURL=tables.js.map
|
package/dist/html/tables.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tables.js","sourceRoot":"","sources":["../../src/html/tables.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,SAAS,
|
|
1
|
+
{"version":3,"file":"tables.js","sourceRoot":"","sources":["../../src/html/tables.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,SAAS,EAGT,YAAY,EAEZ,SAAS,GACV,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE1D,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,C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AC,KAAK,EAAE,CAAC,CAAC,CAAC,EAC/C,CAAC;gBACD,IAAI,GAAG,SAAS,CAAC;gBACjB,OAAO,CAAC,KAAK,EAAE,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IACF,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAC9B,OAAO,SAAS,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC"}
|
package/dist/model/arxiv.d.ts
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* old-style ID may carry (`math.GT/0309136` → `math/0309136`), with any version the
|
|
5
5
|
* source prints kept (`2105.00001v2`). One grammar serves every format: the LaTeXML,
|
|
6
6
|
* HTML, and PDF references read the ID an `arXiv` label, an arxiv.org link, or an
|
|
7
|
-
* old-style form in an entry's text gives, the
|
|
8
|
-
* paper's own ID here, and a field
|
|
9
|
-
*
|
|
7
|
+
* old-style form in an entry's text gives, the JATS and TEI references the ID an arxiv.org
|
|
8
|
+
* link names, the LaTeXML watermark and page URL read the paper's own ID here, and a field
|
|
9
|
+
* the source types as an arXiv ID (JATS `pub-id-type` or `ext-link-type` `arxiv`, TEI
|
|
10
|
+
* `<idno type="arXiv">`, HTML `citation_arxiv_id`) is read here too. An arXiv DataCite
|
|
11
|
+
* DOI (`10.48550/arXiv.2105.00001`) names the ID that fills one still empty.
|
|
10
12
|
* @module src/model/arxiv
|
|
11
13
|
*/
|
|
12
14
|
/**
|
|
@@ -34,6 +36,12 @@ export declare function arxivFromUrl(url: string | undefined): string | undefine
|
|
|
34
36
|
* value from the same field.
|
|
35
37
|
*/
|
|
36
38
|
export declare function normalizeArxiv(value: string | undefined): string | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* The arXiv ID an arXiv DataCite DOI names: what follows `10.48550/arXiv.`, in any case,
|
|
41
|
+
* read as {@link arxivId} reads one (`10.48550/arXiv.2105.00001` → `2105.00001`,
|
|
42
|
+
* `10.48550/arxiv.hep-th/9711200` → `hep-th/9711200`). Any other DOI names none.
|
|
43
|
+
*/
|
|
44
|
+
export declare function arxivFromDoi(doi: string | undefined): string | undefined;
|
|
37
45
|
/**
|
|
38
46
|
* The arXiv ID of the page a LaTeXML render was served at: an arxiv.org or ar5iv
|
|
39
47
|
* `/html/` or `/abs/` URL (`https://ar5iv.labs.arxiv.org/html/math.GT/0309136` →
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arxiv.d.ts","sourceRoot":"","sources":["../../src/model/arxiv.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"arxiv.d.ts","sourceRoot":"","sources":["../../src/model/arxiv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAmFH;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAoBzD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAExE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAG5E;AAKD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAIxE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAE5E;AAUD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQ5D"}
|
package/dist/model/arxiv.js
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* old-style ID may carry (`math.GT/0309136` → `math/0309136`), with any version the
|
|
5
5
|
* source prints kept (`2105.00001v2`). One grammar serves every format: the LaTeXML,
|
|
6
6
|
* HTML, and PDF references read the ID an `arXiv` label, an arxiv.org link, or an
|
|
7
|
-
* old-style form in an entry's text gives, the
|
|
8
|
-
* paper's own ID here, and a field
|
|
9
|
-
*
|
|
7
|
+
* old-style form in an entry's text gives, the JATS and TEI references the ID an arxiv.org
|
|
8
|
+
* link names, the LaTeXML watermark and page URL read the paper's own ID here, and a field
|
|
9
|
+
* the source types as an arXiv ID (JATS `pub-id-type` or `ext-link-type` `arxiv`, TEI
|
|
10
|
+
* `<idno type="arXiv">`, HTML `citation_arxiv_id`) is read here too. An arXiv DataCite
|
|
11
|
+
* DOI (`10.48550/arXiv.2105.00001`) names the ID that fills one still empty.
|
|
10
12
|
* @module src/model/arxiv
|
|
11
13
|
*/
|
|
12
14
|
/**
|
|
@@ -131,6 +133,18 @@ export function normalizeArxiv(value) {
|
|
|
131
133
|
const [, body = ''] = FIELD.exec(value?.trim() ?? '') ?? [];
|
|
132
134
|
return arxivId(body) ?? arxivFromUrl(body);
|
|
133
135
|
}
|
|
136
|
+
/** The prefix of the DataCite DOI arXiv registers for every paper, lowercased. */
|
|
137
|
+
const ARXIV_DOI = '10.48550/arxiv.';
|
|
138
|
+
/**
|
|
139
|
+
* The arXiv ID an arXiv DataCite DOI names: what follows `10.48550/arXiv.`, in any case,
|
|
140
|
+
* read as {@link arxivId} reads one (`10.48550/arXiv.2105.00001` → `2105.00001`,
|
|
141
|
+
* `10.48550/arxiv.hep-th/9711200` → `hep-th/9711200`). Any other DOI names none.
|
|
142
|
+
*/
|
|
143
|
+
export function arxivFromDoi(doi) {
|
|
144
|
+
return doi?.slice(0, ARXIV_DOI.length).toLowerCase() === ARXIV_DOI
|
|
145
|
+
? arxivId(doi.slice(ARXIV_DOI.length))
|
|
146
|
+
: undefined;
|
|
147
|
+
}
|
|
134
148
|
/**
|
|
135
149
|
* The arXiv ID of the page a LaTeXML render was served at: an arxiv.org or ar5iv
|
|
136
150
|
* `/html/` or `/abs/` URL (`https://ar5iv.labs.arxiv.org/html/math.GT/0309136` →
|
package/dist/model/arxiv.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arxiv.js","sourceRoot":"","sources":["../../src/model/arxiv.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"arxiv.js","sourceRoot":"","sources":["../../src/model/arxiv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;GAIG;AACH,MAAM,YAAY,GAAwB,IAAI,GAAG,CAAC;IAChD,UAAU;IACV,UAAU;IACV,UAAU;IACV,QAAQ;IACR,UAAU;IACV,SAAS;IACT,UAAU;IACV,UAAU;IACV,SAAS;IACT,QAAQ;IACR,UAAU;IACV,UAAU;IACV,IAAI;IACJ,OAAO;IACP,UAAU;IACV,OAAO;IACP,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,SAAS;IACT,SAAS;IACT,MAAM;IACN,SAAS;IACT,SAAS;IACT,UAAU;IACV,SAAS;IACT,UAAU;IACV,OAAO;IACP,OAAO;IACP,UAAU;IACV,UAAU;IACV,UAAU;CACX,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAA,4EAA4E,CAAC;AAExG;;;GAGG;AACH,MAAM,QAAQ,GACZ,iGAAiG,CAAC;AAEpG;;;;;GAKG;AACH,MAAM,KAAK,GAAG,2DAA2D,CAAC;AAE1E;;;;;GAKG;AACH,MAAM,OAAO,GAAG,IAAI,MAAM,CACxB,MAAM,CAAC,GAAG,CAAA,yFAAyF,QAAQ,GAAG,EAC9G,IAAI,CACL,CAAC;AAEF,gFAAgF;AAChF,MAAM,OAAO,GAAG,8CAA8C,CAAC;AAE/D,+EAA+E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;AAED,4FAA4F;AAC5F,SAAS,QAAQ,CAAC,GAAuB,EAAE,IAAY;IACrD,MAAM,CAAC,EAAE,IAAI,GAAG,EAAE,EAAE,OAAO,GAAG,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;IACrF,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;QAChD,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QACzD,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,KAAK,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,SAAS,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,CAAC;QAC/C,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,SAAS;QAC/C,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QAC9B,IAAI,EAAE;YAAE,OAAO,EAAE,CAAC;IACpB,CAAC;IACD,OAAO;AACT,CAAC"}
|
package/dist/model/document.d.ts
CHANGED
|
@@ -43,7 +43,9 @@ export interface Author {
|
|
|
43
43
|
export interface Identifiers {
|
|
44
44
|
/**
|
|
45
45
|
* arXiv ID without an `arXiv:` label or an old-style ID's subject class
|
|
46
|
-
* (`math.GT/0309136` → `math/0309136`), version kept when the source prints one.
|
|
46
|
+
* (`math.GT/0309136` → `math/0309136`), version kept when the source prints one. With no
|
|
47
|
+
* ID of its own, the one an arXiv DataCite DOI in `doi` names (`10.48550/arxiv.2105.00001`
|
|
48
|
+
* → `2105.00001`).
|
|
47
49
|
*/
|
|
48
50
|
arxiv?: string;
|
|
49
51
|
/** Lowercased DOI without a resolver prefix. */
|
|
@@ -237,7 +239,11 @@ export interface Reference {
|
|
|
237
239
|
* arXiv ID without the `arXiv:` prefix, version kept when the entry prints one
|
|
238
240
|
* (`2105.00001v2`). LaTeXML, HTML, and PDF references read it from an `arXiv` label, an
|
|
239
241
|
* arxiv.org `/abs/` or `/pdf/` link, or a bare old-style ID, dropping an old-style ID's
|
|
240
|
-
* subject class (`math.GT/0309136` → `math/0309136`).
|
|
242
|
+
* subject class (`math.GT/0309136` → `math/0309136`). JATS and TEI references read it
|
|
243
|
+
* from a typed field (`pub-id-type` or `ext-link-type` `arxiv`, `<idno type="arXiv">`),
|
|
244
|
+
* else an arxiv.org link (`<ext-link>`, `<uri>`, `<ptr target>`). A reference with no ID
|
|
245
|
+
* of its own takes the one an arXiv DataCite DOI in `doi` names
|
|
246
|
+
* (`10.48550/arxiv.hep-th/9711200` → `hep-th/9711200`).
|
|
241
247
|
*/
|
|
242
248
|
arxiv?: string;
|
|
243
249
|
/** Author names as printed. */
|
|
@@ -1 +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,IAAI,EAAE,MAAM,CAAC;CACd;AAED,i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AE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,UAAU,EAAE,SAAS,EAAE,CAAC;CACzB"}
|
package/dist/model/result.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview The value every parser returns. Expected failures (malformed input,
|
|
3
|
-
* the wrong format, an empty body, input over budget) are results, not exceptions;
|
|
4
|
-
* a missing optional peer dependency is a setup error and throws.
|
|
5
|
-
* @module src/model/result
|
|
6
|
-
*/
|
|
7
1
|
import type { ScholarlyDocument } from './document.js';
|
|
8
2
|
/** Why a parse produced no document. */
|
|
9
3
|
export type ParseFailureReason =
|
|
@@ -13,7 +7,10 @@ export type ParseFailureReason =
|
|
|
13
7
|
| 'wrong-format'
|
|
14
8
|
/** Parsed, but carried no article content. */
|
|
15
9
|
| 'empty'
|
|
16
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* A page standing in for the document: a captcha, bot check, or login wall, an
|
|
12
|
+
* access-denied or HTTP error page, or a redirect stub.
|
|
13
|
+
*/
|
|
17
14
|
| 'blocked'
|
|
18
15
|
/** Larger than the configured input budget. */
|
|
19
16
|
| 'too-large';
|
|
@@ -35,7 +32,13 @@ export interface ParseOptions {
|
|
|
35
32
|
/** Reject inputs larger than this many bytes. Defaults vary by format. */
|
|
36
33
|
maxInputBytes?: number;
|
|
37
34
|
}
|
|
38
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Build a successful result. An arXiv ID the article's identifiers or a reference leaves
|
|
37
|
+
* empty is filled from the arXiv DataCite DOI beside it (`10.48550/arXiv.2105.00001` →
|
|
38
|
+
* `2105.00001`), on copies, so the document passed in is never changed: every parser
|
|
39
|
+
* returns through here after setting the IDs its source types, prints, or links, so one
|
|
40
|
+
* of those always wins, and no other field changes.
|
|
41
|
+
*/
|
|
39
42
|
export declare function parsed(document: ScholarlyDocument): ParseResult;
|
|
40
43
|
/** Build a failed result. */
|
|
41
44
|
export declare function failed(reason: ParseFailureReason, message: string): ParseResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/model/result.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/model/result.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,wCAAwC;AACxC,MAAM,MAAM,kBAAkB;AAC5B,mFAAmF;AACjF,WAAW;AACb,8FAA8F;GAC5F,cAAc;AAChB,8CAA8C;GAC5C,OAAO;AACT;;;GAGG;GACD,SAAS;AACX,+CAA+C;GAC7C,WAAW,CAAC;AAEhB,sFAAsF;AACtF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAED,8BAA8B;AAC9B,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,EAAE,iBAAiB,CAAC;IAAC,EAAE,EAAE,IAAI,CAAA;CAAE,GACzC;IAAE,KAAK,EAAE,YAAY,CAAC;IAAC,EAAE,EAAE,KAAK,CAAA;CAAE,CAAC;AAEvC,oCAAoC;AACpC,MAAM,WAAW,YAAY;IAC3B,0EAA0E;IAC1E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,WAAW,CAS/D;AASD,6BAA6B;AAC7B,wBAAgB,MAAM,CAAC,MAAM,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,CAE/E;AAED,mGAAmG;AACnG,qBAAa,gBAAiB,SAAQ,KAAK;CAAG;AAE9C;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,WAAW,GAAG,WAAW,CAM3D;AAED,4DAA4D;AAC5D,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAMxF"}
|
package/dist/model/result.js
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The value every parser returns. Expected failures (malformed input,
|
|
3
|
+
* the wrong format, an empty body, a page standing in for the document, input over
|
|
4
|
+
* budget) are results, not exceptions;
|
|
5
|
+
* a missing optional peer dependency is a setup error and throws.
|
|
6
|
+
* @module src/model/result
|
|
7
|
+
*/
|
|
8
|
+
import { arxivFromDoi } from './arxiv.js';
|
|
9
|
+
/**
|
|
10
|
+
* Build a successful result. An arXiv ID the article's identifiers or a reference leaves
|
|
11
|
+
* empty is filled from the arXiv DataCite DOI beside it (`10.48550/arXiv.2105.00001` →
|
|
12
|
+
* `2105.00001`), on copies, so the document passed in is never changed: every parser
|
|
13
|
+
* returns through here after setting the IDs its source types, prints, or links, so one
|
|
14
|
+
* of those always wins, and no other field changes.
|
|
15
|
+
*/
|
|
2
16
|
export function parsed(document) {
|
|
3
|
-
|
|
17
|
+
const { identifiers } = document.metadata;
|
|
18
|
+
const filled = identifiers && withArxiv(identifiers);
|
|
19
|
+
const references = document.references.map(withArxiv);
|
|
20
|
+
const unchanged = filled === identifiers && references.every((ref, at) => ref === document.references[at]);
|
|
21
|
+
if (unchanged)
|
|
22
|
+
return { document, ok: true };
|
|
23
|
+
const metadata = filled ? { ...document.metadata, identifiers: filled } : document.metadata;
|
|
24
|
+
return { document: { ...document, metadata, references }, ok: true };
|
|
25
|
+
}
|
|
26
|
+
/** `holder`, or a copy with its empty `arxiv` set to the ID an arXiv DOI in `doi` names. */
|
|
27
|
+
function withArxiv(holder) {
|
|
28
|
+
if (holder.arxiv)
|
|
29
|
+
return holder;
|
|
30
|
+
const arxiv = arxivFromDoi(holder.doi);
|
|
31
|
+
return arxiv ? { ...holder, arxiv } : holder;
|
|
4
32
|
}
|
|
5
33
|
/** Build a failed result. */
|
|
6
34
|
export function failed(reason, message) {
|
package/dist/model/result.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/model/result.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/model/result.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAoC1C;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,QAA2B;IAChD,MAAM,EAAE,WAAW,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC;IAC1C,MAAM,MAAM,GAAG,WAAW,IAAI,SAAS,CAAC,WAAW,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACtD,MAAM,SAAS,GACb,MAAM,KAAK,WAAW,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3F,IAAI,SAAS;QAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IAC7C,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,CAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAC5F,OAAO,EAAE,QAAQ,EAAE,EAAE,GAAG,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACvE,CAAC;AAED,4FAA4F;AAC5F,SAAS,SAAS,CAA6C,MAAS;IACtE,IAAI,MAAM,CAAC,KAAK;QAAE,OAAO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/model/section-kinds.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"section-kinds.d.ts","sourceRoot":"","sources":["../../src/model/section-kinds.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAsBjD,uFAAuF;AACvF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAIhF;AAKD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAOpC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const TITLE_KINDS = [
|
|
2
|
-
|
|
2
|
+
// Advanced Science prints `Acknowlegments`.
|
|
3
|
+
[/^acknowle?dg/i, 'acknowledgments'],
|
|
3
4
|
[
|
|
4
5
|
/^(data|code|software)\b[^.]{0,40}\bavailability|^availability of data|^data sharing/i,
|
|
5
6
|
'data-availability',
|
|
@@ -13,7 +14,8 @@ const TITLE_KINDS = [
|
|
|
13
14
|
/^(competing|conflicts? of) interests?|^declaration|declarations?$|^fund(ing|er)|^author contributions|authorship contribution|^ethic(s|al) (statement|approval|declaration)|^ethics$|^compliance with ethic|^(informed )?consent (statement|for publication)|^institutional review board|^disclosure|^statements$/i,
|
|
14
15
|
'declarations',
|
|
15
16
|
],
|
|
16
|
-
|
|
17
|
+
// Wiley lists each author's ORCID iD under its own heading after the body.
|
|
18
|
+
[/^(foot|end)notes$|^notes$|^(disclaimer\/)?publisher[’']?s note|^orcid(?: ids?)?$/i, 'notes'],
|
|
17
19
|
];
|
|
18
20
|
/** The back-matter kind a heading names, or undefined for an ordinary body section. */
|
|
19
21
|
export function kindFromTitle(title) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section-kinds.js","sourceRoot":"","sources":["../../src/model/section-kinds.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,GAA4B;IAC3C,CAAC,
|
|
1
|
+
{"version":3,"file":"section-kinds.js","sourceRoot":"","sources":["../../src/model/section-kinds.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,GAA4B;IAC3C,4CAA4C;IAC5C,CAAC,eAAe,EAAE,iBAAiB,CAAC;IACpC;QACE,sFAAsF;QACtF,mBAAmB;KACpB;IACD;QACE,2FAA2F;QAC3F,UAAU;KACX;IACD,kIAAkI;IAClI;QACE,oTAAoT;QACpT,cAAc;KACf;IACD,2EAA2E;IAC3E,CAAC,mFAAmF,EAAE,OAAO,CAAC;CAC/F,CAAC;AAEF,uFAAuF;AACvF,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAClD,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACnE,CAAC;AAED,oJAAoJ;AACpJ,MAAM,cAAc,GAAG,sCAAsC,CAAC;AAE9D;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAyB,EACzB,KAAyB;IAEzB,MAAM,KAAK,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtE,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1B,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,GAAG,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAC7F,IAAI,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,MAAM;QAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC1E,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,MAAM,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AAClE,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Source table rows → a rectangular grid of cell text with `colspan` and
|
|
3
|
-
* `rowspan` expanded. Every format's table reader maps its markup into
|
|
4
|
-
* lets this build the grid, so span handling is written once.
|
|
3
|
+
* `rowspan` expanded. Every format's table reader maps its markup into row groups of
|
|
4
|
+
* `SourceRow`s and lets this build the grid, so span handling is written once.
|
|
5
5
|
*
|
|
6
6
|
* A cell covering N columns fills N entries and one covering M rows fills its column in
|
|
7
7
|
* the M−1 rows below, repeating its text: the value belongs to each position it covers,
|
|
8
8
|
* and keeping the source cell count would put values under the wrong headers.
|
|
9
|
-
* (pubmed-mcp-server#111)
|
|
9
|
+
* (pubmed-mcp-server#111) As in HTML, a rowspan never reaches past its row group, and a
|
|
10
|
+
* rowspan of 0 covers the rest of the group.
|
|
10
11
|
*
|
|
11
12
|
* The grids of one document draw on one {@link GridBudget}: what the tables of a document
|
|
12
13
|
* may repeat and hold is capped where the grid is built, where a parser can still record
|
|
@@ -57,6 +58,7 @@ export interface Grid {
|
|
|
57
58
|
export interface SourceCell {
|
|
58
59
|
colspan: number;
|
|
59
60
|
header: boolean;
|
|
61
|
+
/** Rows the cell covers, its own included; 0 covers the rest of its row group. */
|
|
60
62
|
rowspan: number;
|
|
61
63
|
text: string;
|
|
62
64
|
}
|
|
@@ -68,10 +70,17 @@ export interface SourceRow {
|
|
|
68
70
|
/** A span attribute value, clamped to the grid; anything unparseable is 1. */
|
|
69
71
|
export declare function spanValue(raw: string | null | undefined): number;
|
|
70
72
|
/**
|
|
71
|
-
*
|
|
73
|
+
* A `rowspan` attribute value: 0, read as HTML reads a non-negative integer, spans the
|
|
74
|
+
* rest of the row group; anything else is a {@link spanValue}.
|
|
75
|
+
*/
|
|
76
|
+
export declare function rowspanValue(raw: string | null | undefined): number;
|
|
77
|
+
/**
|
|
78
|
+
* Build the grid from a table's row groups, in the order they are shown, charging the
|
|
79
|
+
* document's `budget`. A rowspan ends with its group. Header rows are head rows plus any
|
|
72
80
|
* leading row made only of header cells; a row the source left short is padded so cells
|
|
73
|
-
* never shift under the wrong column
|
|
74
|
-
*
|
|
81
|
+
* never shift under the wrong column, and a row with no cells only counts among the rows
|
|
82
|
+
* a rowspan covers. Rows are kept in order while the grid, padded to its widest row so
|
|
83
|
+
* far, fits the cells left.
|
|
75
84
|
*/
|
|
76
|
-
export declare function buildGrid(
|
|
85
|
+
export declare function buildGrid(groups: SourceRow[][], budget: GridBudget): Grid;
|
|
77
86
|
//# sourceMappingURL=table-grid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-grid.d.ts","sourceRoot":"","sources":["../../src/model/table-grid.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"table-grid.d.ts","sourceRoot":"","sources":["../../src/model/table-grid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,UAAY,CAAC;AAE7C;;;;GAIG;AACH,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