scholarly-parse 0.2.1 → 0.2.2
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 +4 -0
- package/README.md +2 -2
- package/changelog/0.2.x/0.2.2.md +41 -0
- package/dist/detect.d.ts +2 -2
- package/dist/detect.js +2 -2
- package/dist/formats/html/parse.js +12 -15
- package/dist/formats/html/parse.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/layout.d.ts +10 -1
- package/dist/formats/pdf/layout.d.ts.map +1 -1
- package/dist/formats/pdf/layout.js +266 -31
- package/dist/formats/pdf/layout.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.map +1 -1
- package/dist/formats/pdf/structure.js +6 -3
- package/dist/formats/pdf/structure.js.map +1 -1
- package/dist/formats/tei/parse.js +17 -13
- 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 +37 -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/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 +6 -6
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,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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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;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AAU,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,iCAAiC;AACjC,MAAM,WAAW,MAAM;IACrB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,kFAAkF;IAClF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,IAAI,EAAE,MAAM,CAAC;IACb,8FAA8F;IAC9F,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,0DAA0D;AAC1D,MAAM,WAAW,WAAW;IAC1B
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/model/document.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,o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AAM,CAAC;CAChB;AAED,sCAAsC;AACtC,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,UAAU,GACV,aAAa,GACb,mBAAmB,GACnB,qBAAqB,GACrB,kBAAkB,GAClB,oBAAoB,GACpB,oBAAoB,GACpB,iBAAiB,GACjB,iBAAiB,CAAC;AAEtB,0BAA0B;AAC1B,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,YAAY,CAAC;IACtB,oEAAoE;IACpE,SAAS,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAChD,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B;AAED,mCAAmC;AACnC,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,8EAA8E;IAC9E,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,WAAW,EAAE,WAAW,CAAC;IACzB,mFAAmF;IACnF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wFAAwF;IACxF,MAAM,EAAE,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,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AAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,4DAA4D;AAC5D,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAiC;IAChE,IAAI,CAAC;QACH,OAAO,MAAM,KAAK,EAAE,CAAC;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,IAAI,KAAK,YAAY,gBAAgB;QAAE,MAAM,KAAK,CAAC;IACnD,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACtE,OAAO,MAAM,CAAC,WAAW,EAAE,mCAAmC,MAAM,EAAE,CAAC,CAAC;AAC1E,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,iBAA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AU,GAAG,IAAI,CAqEzE"}
|
package/dist/model/table-grid.js
CHANGED
|
@@ -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
|
|
@@ -54,14 +55,24 @@ export function spanValue(raw) {
|
|
|
54
55
|
return Math.min(declared, MAX_TABLE_COLUMNS);
|
|
55
56
|
}
|
|
56
57
|
/**
|
|
57
|
-
*
|
|
58
|
+
* A `rowspan` attribute value: 0, read as HTML reads a non-negative integer, spans the
|
|
59
|
+
* rest of the row group; anything else is a {@link spanValue}.
|
|
60
|
+
*/
|
|
61
|
+
export function rowspanValue(raw) {
|
|
62
|
+
return Number.parseInt(raw ?? '', 10) === 0 ? 0 : spanValue(raw);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Build the grid from a table's row groups, in the order they are shown, charging the
|
|
66
|
+
* document's `budget`. A rowspan ends with its group. Header rows are head rows plus any
|
|
58
67
|
* leading row made only of header cells; a row the source left short is padded so cells
|
|
59
|
-
* never shift under the wrong column
|
|
60
|
-
*
|
|
68
|
+
* never shift under the wrong column, and a row with no cells only counts among the rows
|
|
69
|
+
* a rowspan covers. Rows are kept in order while the grid, padded to its widest row so
|
|
70
|
+
* far, fits the cells left.
|
|
61
71
|
*/
|
|
62
|
-
export function buildGrid(
|
|
72
|
+
export function buildGrid(groups, budget) {
|
|
63
73
|
const parsed = [];
|
|
64
|
-
|
|
74
|
+
/** Per column, the cell a rowspan carries down into it and the row of its group it ends before. */
|
|
75
|
+
let carried = [];
|
|
65
76
|
let truncated = false;
|
|
66
77
|
/** A spanned cell's text for one more position it covers, while the budget lasts. */
|
|
67
78
|
const copy = (text) => {
|
|
@@ -72,48 +83,55 @@ export function buildGrid(sourceRows, budget) {
|
|
|
72
83
|
budget.copyChars -= text.length;
|
|
73
84
|
return text;
|
|
74
85
|
};
|
|
75
|
-
|
|
86
|
+
/** Whether a rowspan covers column `col` at row `r` of the group. */
|
|
87
|
+
const covered = (col, r) => (carried[col]?.end ?? 0) > r;
|
|
88
|
+
/** Fill `row` with the carried cells from `col` on, up to the first column none covers. */
|
|
89
|
+
const drainCarried = (row, col, r) => {
|
|
76
90
|
let at = col;
|
|
77
91
|
while (at < MAX_TABLE_COLUMNS) {
|
|
78
92
|
const carry = carried[at];
|
|
79
|
-
if (!carry)
|
|
93
|
+
if (!carry || carry.end <= r)
|
|
80
94
|
return at;
|
|
81
95
|
row[at] = copy(carry.value);
|
|
82
|
-
carry.remaining -= 1;
|
|
83
|
-
if (carry.remaining <= 0)
|
|
84
|
-
carried[at] = undefined;
|
|
85
96
|
at += 1;
|
|
86
97
|
}
|
|
87
98
|
return at;
|
|
88
99
|
};
|
|
89
100
|
let width = 0;
|
|
90
|
-
for (const
|
|
91
|
-
|
|
92
|
-
let
|
|
93
|
-
for (const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
build: for (const group of groups) {
|
|
102
|
+
carried = [];
|
|
103
|
+
let r = -1;
|
|
104
|
+
for (const source of group) {
|
|
105
|
+
r += 1;
|
|
106
|
+
// Nothing is carried into a row with no cells: it would be dropped.
|
|
107
|
+
if (source.cells.length === 0)
|
|
108
|
+
continue;
|
|
109
|
+
const row = [];
|
|
110
|
+
let col = 0;
|
|
111
|
+
for (const cell of source.cells) {
|
|
112
|
+
col = drainCarried(row, col, r);
|
|
113
|
+
const span = Math.min(cell.colspan, MAX_TABLE_COLUMNS - col);
|
|
114
|
+
const end = cell.rowspan === 0 ? Number.POSITIVE_INFINITY : r + cell.rowspan;
|
|
115
|
+
for (let i = 0; i < span; i++) {
|
|
116
|
+
row[col] = i === 0 ? cell.text : copy(cell.text);
|
|
117
|
+
if (cell.rowspan !== 1)
|
|
118
|
+
carried[col] = { end, value: cell.text };
|
|
119
|
+
col += 1;
|
|
120
|
+
}
|
|
101
121
|
}
|
|
122
|
+
const rightmost = carried.findLastIndex((_, at) => covered(at, r));
|
|
123
|
+
while (col <= rightmost)
|
|
124
|
+
col = covered(col, r) ? drainCarried(row, col, r) : col + 1;
|
|
125
|
+
const widest = Math.max(width, row.length);
|
|
126
|
+
if ((parsed.length + 1) * widest > budget.cells) {
|
|
127
|
+
truncated = true;
|
|
128
|
+
break build;
|
|
129
|
+
}
|
|
130
|
+
width = widest;
|
|
131
|
+
for (let i = 0; i < row.length; i++)
|
|
132
|
+
row[i] ??= '';
|
|
133
|
+
parsed.push({ cells: row, header: source.inHead || source.cells.every((c) => c.header) });
|
|
102
134
|
}
|
|
103
|
-
const rightmost = carried.findLastIndex(Boolean);
|
|
104
|
-
while (col <= rightmost)
|
|
105
|
-
col = carried[col] ? drainCarried(row, col) : col + 1;
|
|
106
|
-
if (source.cells.length === 0)
|
|
107
|
-
continue;
|
|
108
|
-
const widest = Math.max(width, row.length);
|
|
109
|
-
if ((parsed.length + 1) * widest > budget.cells) {
|
|
110
|
-
truncated = true;
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
width = widest;
|
|
114
|
-
for (let i = 0; i < row.length; i++)
|
|
115
|
-
row[i] ??= '';
|
|
116
|
-
parsed.push({ cells: row, header: source.inHead || source.cells.every((c) => c.header) });
|
|
117
135
|
}
|
|
118
136
|
budget.cells -= parsed.length * width;
|
|
119
137
|
for (const row of parsed)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-grid.js","sourceRoot":"","sources":["../../src/model/table-grid.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"table-grid.js","sourceRoot":"","sources":["../../src/model/table-grid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAErC;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC;AAE7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC;AAUxC,uCAAuC;AACvC,MAAM,UAAU,gBAAgB;IAC9B,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;AACnE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,KAAyB,EAAE,EAAW;IAC9D,OAAO,KAAK,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,KAAK,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;AACtF,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,OAAO,GAAG,IAAI,2GAA2G,CAAC;AAC5H,CAAC;AAwBD,8EAA8E;AAC9E,MAAM,UAAU,SAAS,CAAC,GAA8B;IACtD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IAChD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAA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,KAAK,IAAI,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC;IACtC,KAAK,MAAM,GAAG,IAAI,MAAM;QAAE,OAAO,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK;YAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9E,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,OAAO,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM;QAAE,UAAU,EAAE,CAAC;IAChD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;AACzE,CAAC"}
|
package/dist/parse.d.ts
CHANGED
|
@@ -22,7 +22,8 @@ export interface AutoParseOptions extends ParseOptions {
|
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Parse a document of any supported format. The format comes from the payload itself
|
|
25
|
-
* (see `detect`); a challenge
|
|
25
|
+
* (see `detect`); a challenge, access-denied, or HTTP error page is HTML and fails as
|
|
26
|
+
* `blocked`, and arXiv's page for a paper with no HTML fails as `empty`.
|
|
26
27
|
* PDF needs its bytes: PDF passed as a string fails as `wrong-format`.
|
|
27
28
|
*/
|
|
28
29
|
export declare function parse(input: string | Uint8Array, options?: AutoParseOptions): Promise<ParseResult>;
|
package/dist/parse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAU,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhF,2EAA2E;AAC3E,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,yFAAyF;IACzF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wFAAwF;IACxF,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAU,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhF,2EAA2E;AAC3E,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,yFAAyF;IACzF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wFAAwF;IACxF,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAsB,KAAK,CACzB,KAAK,EAAE,MAAM,GAAG,UAAU,EAC1B,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,WAAW,CAAC,CA6BtB"}
|
package/dist/parse.js
CHANGED
|
@@ -8,7 +8,8 @@ import { detect } from './detect.js';
|
|
|
8
8
|
import { failed } from './model/result.js';
|
|
9
9
|
/**
|
|
10
10
|
* Parse a document of any supported format. The format comes from the payload itself
|
|
11
|
-
* (see `detect`); a challenge
|
|
11
|
+
* (see `detect`); a challenge, access-denied, or HTTP error page is HTML and fails as
|
|
12
|
+
* `blocked`, and arXiv's page for a paper with no HTML fails as `empty`.
|
|
12
13
|
* PDF needs its bytes: PDF passed as a string fails as `wrong-format`.
|
|
13
14
|
*/
|
|
14
15
|
export async function parse(input, options = {}) {
|
package/dist/parse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,MAAM,EAAuC,MAAM,mBAAmB,CAAC;AAuBhF
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,MAAM,EAAuC,MAAM,mBAAmB,CAAC;AAuBhF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CACzB,KAA0B,EAC1B,OAAO,GAAqB,EAAE;IAE9B,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,GAAG,SAAS,EAAE,GAAG,OAAO,CAAC;IACjF,MAAM,MAAM,GAAG,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC;IACpE,MAAM,OAAO,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC;IACxE,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,MAAM;YACT,OAAO,CAAC,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,M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