@retorquere/bibtex-parser 10.0.1 → 10.0.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/dist/types/crossref.d.ts +2 -0
- package/dist/types/crossref.d.ts.map +1 -0
- package/dist/types/fields.d.ts +3 -0
- package/dist/types/fields.d.ts.map +1 -0
- package/dist/types/index.d.ts +191 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/jabref.d.ts +58 -0
- package/dist/types/jabref.d.ts.map +1 -0
- package/dist/types/merge.d.ts +2 -0
- package/dist/types/merge.d.ts.map +1 -0
- package/dist/types/prepositions.d.ts +3 -0
- package/dist/types/prepositions.d.ts.map +1 -0
- package/dist/types/sentence-case.d.ts +9 -0
- package/dist/types/sentence-case.d.ts.map +1 -0
- package/dist/types/tokenizer.d.ts +13 -0
- package/dist/types/tokenizer.d.ts.map +1 -0
- package/dist/types/verbatim.d.ts +66 -0
- package/dist/types/verbatim.d.ts.map +1 -0
- package/dist/types/yield.d.ts +2 -0
- package/dist/types/yield.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crossref.d.ts","sourceRoot":"","sources":["../../crossref.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAiLlE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../fields.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAq+NnC,CAAA;AAEV,eAAO,MAAM,UAAU,EAAE,MAAM,EAmBrB,CAAA"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import type { Node } from '@unified-latex/unified-latex-types';
|
|
2
|
+
import * as JabRef from './jabref.js';
|
|
3
|
+
import * as bibtex from './verbatim.js';
|
|
4
|
+
export type { JabRefMetadata } from './jabref.js';
|
|
5
|
+
export type { ParseError } from './verbatim.js';
|
|
6
|
+
export { toSentenceCase } from './sentence-case.js';
|
|
7
|
+
export { tokenize } from './tokenizer.js';
|
|
8
|
+
export type { Token } from './tokenizer.js';
|
|
9
|
+
type CreatorFields = {
|
|
10
|
+
author?: Creator[];
|
|
11
|
+
bookauthor?: Creator[];
|
|
12
|
+
collaborator?: Creator[];
|
|
13
|
+
commentator?: Creator[];
|
|
14
|
+
director?: Creator[];
|
|
15
|
+
editor?: Creator[];
|
|
16
|
+
editora?: Creator[];
|
|
17
|
+
editorb?: Creator[];
|
|
18
|
+
editors?: Creator[];
|
|
19
|
+
holder?: Creator[];
|
|
20
|
+
scriptwriter?: Creator[];
|
|
21
|
+
translator?: Creator[];
|
|
22
|
+
};
|
|
23
|
+
type ArrayFields = {
|
|
24
|
+
keywords?: string[];
|
|
25
|
+
institution?: string[];
|
|
26
|
+
publisher?: string[];
|
|
27
|
+
origpublisher?: string[];
|
|
28
|
+
organization?: string[];
|
|
29
|
+
location?: string[];
|
|
30
|
+
origlocation?: string[];
|
|
31
|
+
};
|
|
32
|
+
type TypedFields = CreatorFields & ArrayFields;
|
|
33
|
+
type Fields = TypedFields & Omit<Record<string, string>, keyof TypedFields>;
|
|
34
|
+
export type Entry = {
|
|
35
|
+
type: string;
|
|
36
|
+
key: string;
|
|
37
|
+
fields: Fields;
|
|
38
|
+
mode: Record<string, ParseMode>;
|
|
39
|
+
crossref?: Record<string, Record<string, string>>;
|
|
40
|
+
input: string;
|
|
41
|
+
};
|
|
42
|
+
export interface Library {
|
|
43
|
+
/**
|
|
44
|
+
* errors found while parsing
|
|
45
|
+
*/
|
|
46
|
+
errors: bibtex.ParseError[];
|
|
47
|
+
/**
|
|
48
|
+
* entries in the order in which they are found, omitting those which could not be parsed.
|
|
49
|
+
*/
|
|
50
|
+
entries: Entry[];
|
|
51
|
+
/**
|
|
52
|
+
* `@comment`s found in the bibtex file.
|
|
53
|
+
*/
|
|
54
|
+
comments: string[];
|
|
55
|
+
/**
|
|
56
|
+
* `@string`s found in the bibtex file.
|
|
57
|
+
*/
|
|
58
|
+
strings: Record<string, string>;
|
|
59
|
+
/**
|
|
60
|
+
* `@preamble` declarations found in the bibtex file
|
|
61
|
+
*/
|
|
62
|
+
preamble: string[];
|
|
63
|
+
/**
|
|
64
|
+
* jabref metadata (such as groups information) found in the bibtex file
|
|
65
|
+
*/
|
|
66
|
+
jabref: JabRef.JabRefMetadata;
|
|
67
|
+
}
|
|
68
|
+
export interface Options {
|
|
69
|
+
/**
|
|
70
|
+
* Bib(La)TeX handles entries that are in English differently from emtries in other languages. For English-like entries,
|
|
71
|
+
* it expects titles in title-case. Words within braces are recognized as "case-protected" and their original casing is preserved during
|
|
72
|
+
* rendering. For non-English entries, the casing as entered in the entries is rendered as entered. Other reference managers, such as
|
|
73
|
+
* Zotero, expect all titles to be in sentence-case. In this parser you can specify which `langid` values mark an entry to be English so
|
|
74
|
+
* that it can convert those titles to sentence-case, and to carry over case-protection. If no `langid` is present an entry is
|
|
75
|
+
* assumed to be English by bib(la)tex, and the parser follows that convention. Note that sentence-casing uses heuristics and
|
|
76
|
+
* does not employ any kind of natural language processing, so you should always inspect the results. If you offer your own list
|
|
77
|
+
* of english-langids here, do not forget to include the empty string, stands for "`langid` absent". Default languages to sentenceCase
|
|
78
|
+
* are the empty string, plus:
|
|
79
|
+
*
|
|
80
|
+
* - american
|
|
81
|
+
* - british
|
|
82
|
+
* - canadian
|
|
83
|
+
* - english
|
|
84
|
+
* - australian
|
|
85
|
+
* - newzealand
|
|
86
|
+
* - usenglish
|
|
87
|
+
* - ukenglish
|
|
88
|
+
* - en
|
|
89
|
+
* - eng
|
|
90
|
+
* - en-au
|
|
91
|
+
* - en-bz
|
|
92
|
+
* - en-ca
|
|
93
|
+
* - en-cb
|
|
94
|
+
* - en-gb
|
|
95
|
+
* - en-ie
|
|
96
|
+
* - en-jm
|
|
97
|
+
* - en-nz
|
|
98
|
+
* - en-ph
|
|
99
|
+
* - en-tt
|
|
100
|
+
* - en-us
|
|
101
|
+
* - en-za
|
|
102
|
+
* - en-zw
|
|
103
|
+
*
|
|
104
|
+
* If you pass an empty array, or `false`, no sentence casing will be applied (even when there's no language field).
|
|
105
|
+
*/
|
|
106
|
+
english?: string[] | boolean;
|
|
107
|
+
/**
|
|
108
|
+
* By default, `langid` and `hyphenation` are used to determine whether an entry is English, but some sources (ab)use the `language` field
|
|
109
|
+
* for this. If you turn on this option, this field will also be taken into account as a source for `langid`.
|
|
110
|
+
*/
|
|
111
|
+
languageAsLangid?: boolean;
|
|
112
|
+
sentenceCase?: false | {
|
|
113
|
+
/**
|
|
114
|
+
* Some bibtex files will have English titles in sentence case, or all-uppercase. If this is on, and there is a field that would
|
|
115
|
+
* normally have sentence-casing applied in which there are all-lowercase words that are not prepositions (where `X` is either
|
|
116
|
+
* lower or upper) than mixed-case, it is assumed that you want them this way, and no sentence-casing will be applied to that field
|
|
117
|
+
*/
|
|
118
|
+
guess?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Retain Capitalised words in sub-sentences after colons. Given the input title "Structured Interviewing For OCB: Construct Validity,
|
|
121
|
+
* Faking, And The Effects Of Question Type":
|
|
122
|
+
* - when `true`, sentence-cases to "Structured interviewing for OCB: Construct validity, faking, and the effects of question type"
|
|
123
|
+
* - when `false`, sentence-cases to "Structured interviewing for OCB: construct validity, faking, and the effects of question type"
|
|
124
|
+
*/
|
|
125
|
+
subSentence?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* If you have sentence-casing on, you can independently choose whether quoted titles within a title are preserved as-is (true)
|
|
128
|
+
* or also sentence-cased (false).
|
|
129
|
+
*/
|
|
130
|
+
preserveQuoted?: boolean;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* translate braced parts of English-entry titles into a case-protected counterpart; Default == true == as-needed.
|
|
134
|
+
* In as-needed mode the parser will assume that words that have capitals in them imply "nocase" behavior in the consuming application. If you don't want this, turn this option on, and you'll get
|
|
135
|
+
* case protection exactly as the input has it
|
|
136
|
+
*/
|
|
137
|
+
caseProtection?: 'as-needed' | 'strict' | boolean;
|
|
138
|
+
/**
|
|
139
|
+
* By default, when a TeX command is encountered which the parser does not know about, the parser will throw an error. You can pass a function here to return the appropriate text output for the command.
|
|
140
|
+
*/
|
|
141
|
+
unsupported?: 'ignore' | unsupportedHandler;
|
|
142
|
+
/**
|
|
143
|
+
* Some fields such as `url` are parsed in what is called "verbatim mode" where pretty much everything except braces is treated as regular text, not TeX commands. You can change the default list here if you want,
|
|
144
|
+
* for example to help parse Mendeley `file` fields, which against spec are not in verbatim mode.
|
|
145
|
+
*/
|
|
146
|
+
verbatimFields?: (string | RegExp)[];
|
|
147
|
+
/**
|
|
148
|
+
* In the past many bibtex entries would just always wrap a field in double braces, likely because whomever was writing them couldn't figure out the case meddling rules (and who could
|
|
149
|
+
* blame them). Fields listed here will either have one outer layer of braces treated as case-preserve, or have the outer braced be ignored completely, if this is detected.
|
|
150
|
+
*/
|
|
151
|
+
removeOuterBraces?: string[];
|
|
152
|
+
/**
|
|
153
|
+
* Specify parsing mode for specific fields
|
|
154
|
+
*/
|
|
155
|
+
fieldMode?: Record<string, ParseMode>;
|
|
156
|
+
/**
|
|
157
|
+
* If this flag is set entries will be returned without conversion of LaTeX to unicode equivalents.
|
|
158
|
+
*/
|
|
159
|
+
raw?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* You can pass in an existing `@string` dictionary
|
|
162
|
+
*/
|
|
163
|
+
strings?: Record<string, string> | string;
|
|
164
|
+
/**
|
|
165
|
+
* Apply crossref inheritance
|
|
166
|
+
*/
|
|
167
|
+
applyCrossRef?: boolean;
|
|
168
|
+
}
|
|
169
|
+
export interface Creator {
|
|
170
|
+
name?: string;
|
|
171
|
+
lastName?: string;
|
|
172
|
+
firstName?: string;
|
|
173
|
+
prefix?: string;
|
|
174
|
+
suffix?: string;
|
|
175
|
+
initial?: string;
|
|
176
|
+
useprefix?: boolean;
|
|
177
|
+
juniorcomma?: boolean;
|
|
178
|
+
}
|
|
179
|
+
export declare const FieldMode: {
|
|
180
|
+
creatorlist: string[];
|
|
181
|
+
title: string[];
|
|
182
|
+
verbatim: (string | RegExp)[];
|
|
183
|
+
richtext: string[];
|
|
184
|
+
literallist: string[];
|
|
185
|
+
};
|
|
186
|
+
type ParseMode = keyof typeof FieldMode | 'literal' | 'verbatimlist';
|
|
187
|
+
export declare const English: string[];
|
|
188
|
+
type unsupportedHandler = (node: Node, tex: string, entry: Entry) => string;
|
|
189
|
+
export declare function parse(input: string, options?: Options): Library;
|
|
190
|
+
export declare function parseAsync(input: string, options?: Options): Promise<Library>;
|
|
191
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAuC,IAAI,EAA8B,MAAM,oCAAoC,CAAA;AAM/H,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAGnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,YAAY,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AA2B3C,KAAK,aAAa,GAAG;IACnB,MAAM,CAAC,EAAE,OAAO,EAAE,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,EAAE,CAAA;IACtB,YAAY,CAAC,EAAE,OAAO,EAAE,CAAA;IACxB,WAAW,CAAC,EAAE,OAAO,EAAE,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,EA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,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,eAAO,MAAM,SAAS;;;;;;CA0DrB,CAAA;AAED,KAAK,SAAS,GAAG,MAAM,OAAO,SAAS,GAAG,SAAS,GAAG,cAAc,CAAA;AAEpE,eAAO,MAAM,OAAO,UA0BnB,CAAA;AA2ED,KAAK,kBAAkB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,MAAM,CAAA;AA6gC3E,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,OAAY,GAAG,OAAO,CAGnE;AAED,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,OAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAGvF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A JabRef group.
|
|
3
|
+
*/
|
|
4
|
+
export interface Group {
|
|
5
|
+
/**
|
|
6
|
+
* the group name
|
|
7
|
+
*/
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* The citation keys which are specified to belong to this group, after intersection calculation has been applied
|
|
11
|
+
*/
|
|
12
|
+
entries: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Sub-groups under this group
|
|
15
|
+
*/
|
|
16
|
+
groups: Group[];
|
|
17
|
+
}
|
|
18
|
+
export interface JabRefMetadata {
|
|
19
|
+
/**
|
|
20
|
+
* The root groups. You can find the nested groups in their `groups` property
|
|
21
|
+
*/
|
|
22
|
+
root: Group[];
|
|
23
|
+
/**
|
|
24
|
+
* JabRef since 3.8 has changed their groups format. Entries have a `groups` field which has the names of the groups they belong to -- this name does not have to be unique in the groups hierarchy so if you
|
|
25
|
+
* have multiple groups with the same name, it's not well-defined where the entries should end up. This property gives you the for each group name the first time the group showed up in the hierarchy. Note that
|
|
26
|
+
* keys from the entries themselves have *not* yet been added to the [[Group]]s. You need to combine this yourself as you're parsing the entries.
|
|
27
|
+
*/
|
|
28
|
+
groups: {
|
|
29
|
+
[key: string]: Group;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The base path for file paths
|
|
33
|
+
*/
|
|
34
|
+
fileDirectory?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The JabRef metadata format version
|
|
37
|
+
*/
|
|
38
|
+
groupsversion?: number;
|
|
39
|
+
/**
|
|
40
|
+
* The JabRef metadata database type
|
|
41
|
+
*/
|
|
42
|
+
databaseType?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Import the JabRef groups from the `@string` comments in which they were stored. You would typically pass the comments parsed by [[bibtex.parse]] in here.
|
|
46
|
+
*
|
|
47
|
+
* JabRef knows several group types, and this parser parses most, but not all of them:
|
|
48
|
+
*
|
|
49
|
+
* * independent group: the keys listed in the group are the entries that are considered to belong to it
|
|
50
|
+
* * intersection: the keys listed in the group are considered to belong to the group if they're also in the parent group
|
|
51
|
+
* * union: the keys listed in the group are considered to belong to the group, and also the keys that are in the parent group
|
|
52
|
+
* * query: not supported by this parser
|
|
53
|
+
*/
|
|
54
|
+
export declare function parse(comments: string[]): {
|
|
55
|
+
comments: string[];
|
|
56
|
+
jabref: JabRefMetadata;
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=jabref.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jabref.d.ts","sourceRoot":"","sources":["../../jabref.ts"],"names":[],"mappings":"AAuBA;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAA;IAEjB;;OAEG;IACH,MAAM,EAAE,KAAK,EAAE,CAAA;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,IAAI,EAAE,KAAK,EAAE,CAAA;IAEb;;;;OAIG;IACH,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAA;KAAE,CAAA;IAEhC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,cAAc,CAAA;CAAE,CAqFxF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../merge.ts"],"names":[],"mappings":"AAEA,wBAAgB,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAEnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepositions.d.ts","sourceRoot":"","sources":["../../prepositions.ts"],"names":[],"mappings":";AAAA,wBAuFC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type Options = {
|
|
2
|
+
preserveQuoted?: boolean;
|
|
3
|
+
subSentenceCapitalization?: boolean;
|
|
4
|
+
markup?: RegExp;
|
|
5
|
+
nocase?: RegExp;
|
|
6
|
+
guess?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function toSentenceCase(title: string, options?: Options): string;
|
|
9
|
+
//# sourceMappingURL=sentence-case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentence-case.d.ts","sourceRoot":"","sources":["../../sentence-case.ts"],"names":[],"mappings":"AAyDA,MAAM,MAAM,OAAO,GAAG;IACpB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,yBAAyB,CAAC,EAAE,OAAO,CAAA;IACnC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,OAAY,GAAG,MAAM,CAiE3E"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type Token = {
|
|
2
|
+
type: 'word' | 'domain' | 'whitespace';
|
|
3
|
+
subtype: '' | 'preposition' | 'acronym' | 'whitespace' | 'word' | 'domain';
|
|
4
|
+
text: string;
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
shape: string;
|
|
8
|
+
sentenceStart: boolean;
|
|
9
|
+
subSentenceStart: boolean;
|
|
10
|
+
hyphenated?: Token[];
|
|
11
|
+
};
|
|
12
|
+
export declare function tokenize(title: string, markup?: RegExp): Token[];
|
|
13
|
+
//# sourceMappingURL=tokenizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenizer.d.ts","sourceRoot":"","sources":["../../tokenizer.ts"],"names":[],"mappings":"AA+FA,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,YAAY,CAAA;IACtC,OAAO,EAAE,EAAE,GAAG,aAAa,GAAG,SAAS,GAAG,YAAY,GAAG,MAAM,GAAG,QAAQ,CAAA;IAC1E,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,OAAO,CAAA;IACtB,gBAAgB,EAAE,OAAO,CAAA;IACzB,UAAU,CAAC,EAAE,KAAK,EAAE,CAAA;CACrB,CAAA;AAkBD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,EAAE,CA6EhE"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type Entry = {
|
|
2
|
+
input: string;
|
|
3
|
+
type: string;
|
|
4
|
+
key: string;
|
|
5
|
+
fields: Record<string, string>;
|
|
6
|
+
};
|
|
7
|
+
export interface ParseError {
|
|
8
|
+
error: string;
|
|
9
|
+
input?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ParserOptions {
|
|
12
|
+
/**
|
|
13
|
+
* stop parsing after `max_entries` entries have been found. Useful for quick detection if a text file is in fact a bibtex file
|
|
14
|
+
*/
|
|
15
|
+
max_entries?: number;
|
|
16
|
+
/**
|
|
17
|
+
* preload these strings
|
|
18
|
+
*/
|
|
19
|
+
strings?: string | Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
export declare class Library {
|
|
22
|
+
parsing: string | null;
|
|
23
|
+
entries: Entry[];
|
|
24
|
+
strings: Record<string, string>;
|
|
25
|
+
comments: string[];
|
|
26
|
+
errors: ParseError[];
|
|
27
|
+
preambles: string[];
|
|
28
|
+
private default_strings;
|
|
29
|
+
private pos;
|
|
30
|
+
private linebreaks;
|
|
31
|
+
private input;
|
|
32
|
+
private max_entries;
|
|
33
|
+
constructor(input: string, options?: ParserOptions);
|
|
34
|
+
parse(): void;
|
|
35
|
+
parseAsync(): Promise<void>;
|
|
36
|
+
private isWhitespace;
|
|
37
|
+
private match;
|
|
38
|
+
private tryMatch;
|
|
39
|
+
private skipWhitespace;
|
|
40
|
+
private value_braces;
|
|
41
|
+
private value_quotes;
|
|
42
|
+
private single_value;
|
|
43
|
+
location(): string;
|
|
44
|
+
error(err: ParseError): void;
|
|
45
|
+
private value;
|
|
46
|
+
private key;
|
|
47
|
+
private key_equals_value;
|
|
48
|
+
private entry;
|
|
49
|
+
private directive;
|
|
50
|
+
private string;
|
|
51
|
+
private preamble;
|
|
52
|
+
private comment;
|
|
53
|
+
private hasMore;
|
|
54
|
+
private bibtex;
|
|
55
|
+
private bibtexAsync;
|
|
56
|
+
private matchGuard;
|
|
57
|
+
private parseNext;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Parses a bibtex source in verbatim mode. Good for detection of bibtex and for later LaTeX-reparsing.
|
|
61
|
+
*/
|
|
62
|
+
export declare function parse(input: string, options?: ParserOptions): Library;
|
|
63
|
+
export declare const promises: {
|
|
64
|
+
parse(input: string, options?: ParserOptions): Promise<Library>;
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=verbatim.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verbatim.d.ts","sourceRoot":"","sources":["../../verbatim.ts"],"names":[],"mappings":"AAsBA,MAAM,MAAM,KAAK,GAAG;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B,CAAA;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC1C;AAED,qBAAa,OAAO;IACX,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAEtB,OAAO,EAAE,KAAK,EAAE,CAAK;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAK;IACpC,QAAQ,EAAE,MAAM,EAAE,CAAK;IACvB,MAAM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