@retorquere/bibtex-parser 9.0.20 → 9.0.22
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/README.md +1 -1
- package/package.json +36 -18
- package/crossref.json +0 -186
- package/fields.json +0 -6938
- package/index.d.ts +0 -193
- package/index.js +0 -1191
- package/index.js.map +0 -1
- package/jabref.d.ts +0 -58
- package/jabref.js +0 -110
- package/jabref.js.map +0 -1
- package/merge.d.ts +0 -2
- package/merge.js +0 -11
- package/merge.js.map +0 -1
- package/prepositions.json +0 -88
- package/sentence-case.d.ts +0 -9
- package/sentence-case.js +0 -110
- package/sentence-case.js.map +0 -1
- package/tokenizer.d.ts +0 -13
- package/tokenizer.js +0 -167
- package/tokenizer.js.map +0 -1
- package/verbatim.d.ts +0 -66
- package/verbatim.js +0 -430
- package/verbatim.js.map +0 -1
- package/yield.d.ts +0 -2
- package/yield.js +0 -7
- package/yield.js.map +0 -1
package/index.d.ts
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import { Node } from '@unified-latex/unified-latex-types';
|
|
2
|
-
import * as JabRef from './jabref';
|
|
3
|
-
import * as bibtex from './verbatim';
|
|
4
|
-
export { JabRefMetadata } from './jabref';
|
|
5
|
-
export { ParseError } from './verbatim';
|
|
6
|
-
export { toSentenceCase } from './sentence-case';
|
|
7
|
-
export { Token, tokenize } from './tokenizer';
|
|
8
|
-
type CreatorFields = {
|
|
9
|
-
author?: Creator[];
|
|
10
|
-
bookauthor?: Creator[];
|
|
11
|
-
collaborator?: Creator[];
|
|
12
|
-
commentator?: Creator[];
|
|
13
|
-
director?: Creator[];
|
|
14
|
-
editor?: Creator[];
|
|
15
|
-
editora?: Creator[];
|
|
16
|
-
editorb?: Creator[];
|
|
17
|
-
editors?: Creator[];
|
|
18
|
-
holder?: Creator[];
|
|
19
|
-
scriptwriter?: Creator[];
|
|
20
|
-
translator?: Creator[];
|
|
21
|
-
};
|
|
22
|
-
type ArrayFields = {
|
|
23
|
-
keywords?: string[];
|
|
24
|
-
institution?: string[];
|
|
25
|
-
publisher?: string[];
|
|
26
|
-
origpublisher?: string[];
|
|
27
|
-
organization?: string[];
|
|
28
|
-
location?: string[];
|
|
29
|
-
origlocation?: string[];
|
|
30
|
-
};
|
|
31
|
-
type TypedFields = CreatorFields & ArrayFields;
|
|
32
|
-
type Fields = TypedFields & Omit<Record<string, string>, keyof TypedFields>;
|
|
33
|
-
export type Entry = {
|
|
34
|
-
type: string;
|
|
35
|
-
key: string;
|
|
36
|
-
fields: Fields;
|
|
37
|
-
mode: Record<string, ParseMode>;
|
|
38
|
-
crossref?: {
|
|
39
|
-
inherited: string[];
|
|
40
|
-
donated: string[];
|
|
41
|
-
};
|
|
42
|
-
input: string;
|
|
43
|
-
};
|
|
44
|
-
export interface Library {
|
|
45
|
-
/**
|
|
46
|
-
* errors found while parsing
|
|
47
|
-
*/
|
|
48
|
-
errors: bibtex.ParseError[];
|
|
49
|
-
/**
|
|
50
|
-
* entries in the order in which they are found, omitting those which could not be parsed.
|
|
51
|
-
*/
|
|
52
|
-
entries: Entry[];
|
|
53
|
-
/**
|
|
54
|
-
* `@comment`s found in the bibtex file.
|
|
55
|
-
*/
|
|
56
|
-
comments: string[];
|
|
57
|
-
/**
|
|
58
|
-
* `@string`s found in the bibtex file.
|
|
59
|
-
*/
|
|
60
|
-
strings: Record<string, string>;
|
|
61
|
-
/**
|
|
62
|
-
* `@preamble` declarations found in the bibtex file
|
|
63
|
-
*/
|
|
64
|
-
preamble: string[];
|
|
65
|
-
/**
|
|
66
|
-
* jabref metadata (such as groups information) found in the bibtex file
|
|
67
|
-
*/
|
|
68
|
-
jabref: JabRef.JabRefMetadata;
|
|
69
|
-
}
|
|
70
|
-
export interface Options {
|
|
71
|
-
/**
|
|
72
|
-
* Bib(La)TeX handles entries that are in English differently from emtries in other languages. For English-like entries,
|
|
73
|
-
* it expects titles in title-case. Words within braces are recognized as "case-protected" and their original casing is preserved during
|
|
74
|
-
* rendering. For non-English entries, the casing as entered in the entries is rendered as entered. Other reference managers, such as
|
|
75
|
-
* 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
|
|
76
|
-
* that it can convert those titles to sentence-case, and to carry over case-protection. If no `langid` is present an entry is
|
|
77
|
-
* assumed to be English by bib(la)tex, and the parser follows that convention. Note that sentence-casing uses heuristics and
|
|
78
|
-
* does not employ any kind of natural language processing, so you should always inspect the results. If you offer your own list
|
|
79
|
-
* of english-langids here, do not forget to include the empty string, stands for "`langid` absent". Default languages to sentenceCase
|
|
80
|
-
* are the empty string, plus:
|
|
81
|
-
*
|
|
82
|
-
* - american
|
|
83
|
-
* - british
|
|
84
|
-
* - canadian
|
|
85
|
-
* - english
|
|
86
|
-
* - australian
|
|
87
|
-
* - newzealand
|
|
88
|
-
* - usenglish
|
|
89
|
-
* - ukenglish
|
|
90
|
-
* - en
|
|
91
|
-
* - eng
|
|
92
|
-
* - en-au
|
|
93
|
-
* - en-bz
|
|
94
|
-
* - en-ca
|
|
95
|
-
* - en-cb
|
|
96
|
-
* - en-gb
|
|
97
|
-
* - en-ie
|
|
98
|
-
* - en-jm
|
|
99
|
-
* - en-nz
|
|
100
|
-
* - en-ph
|
|
101
|
-
* - en-tt
|
|
102
|
-
* - en-us
|
|
103
|
-
* - en-za
|
|
104
|
-
* - en-zw
|
|
105
|
-
*
|
|
106
|
-
* If you pass an empty array, or `false`, no sentence casing will be applied (even when there's no language field).
|
|
107
|
-
*/
|
|
108
|
-
english?: string[] | boolean;
|
|
109
|
-
/**
|
|
110
|
-
* By default, `langid` and `hyphenation` are used to determine whether an entry is English, but some sources (ab)use the `language` field
|
|
111
|
-
* for this. If you turn on this option, this field will also be taken into account as a source for `langid`.
|
|
112
|
-
*/
|
|
113
|
-
languageAsLangid?: boolean;
|
|
114
|
-
sentenceCase?: false | {
|
|
115
|
-
/**
|
|
116
|
-
* Some bibtex files will have English titles in sentence case, or all-uppercase. If this is on, and there is a field that would
|
|
117
|
-
* normally have sentence-casing applied in which there are all-lowercase words that are not prepositions (where `X` is either
|
|
118
|
-
* 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
|
|
119
|
-
*/
|
|
120
|
-
guess?: boolean;
|
|
121
|
-
/**
|
|
122
|
-
* Retain Capitalised words in sub-sentences after colons. Given the input title "Structured Interviewing For OCB: Construct Validity,
|
|
123
|
-
* Faking, And The Effects Of Question Type":
|
|
124
|
-
* - when `true`, sentence-cases to "Structured interviewing for OCB: Construct validity, faking, and the effects of question type"
|
|
125
|
-
* - when `false`, sentence-cases to "Structured interviewing for OCB: construct validity, faking, and the effects of question type"
|
|
126
|
-
*/
|
|
127
|
-
subSentence?: boolean;
|
|
128
|
-
/**
|
|
129
|
-
* If you have sentence-casing on, you can independently choose whether quoted titles within a title are preserved as-is (true)
|
|
130
|
-
* or also sentence-cased (false).
|
|
131
|
-
*/
|
|
132
|
-
preserveQuoted?: boolean;
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* translate braced parts of English-entry titles into a case-protected counterpart; Default == true == as-needed.
|
|
136
|
-
* 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
|
|
137
|
-
* case protection exactly as the input has it
|
|
138
|
-
*/
|
|
139
|
-
caseProtection?: 'as-needed' | 'strict' | boolean;
|
|
140
|
-
/**
|
|
141
|
-
* 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.
|
|
142
|
-
*/
|
|
143
|
-
unsupported?: 'ignore' | unsupportedHandler;
|
|
144
|
-
/**
|
|
145
|
-
* 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,
|
|
146
|
-
* for example to help parse Mendeley `file` fields, which against spec are not in verbatim mode.
|
|
147
|
-
*/
|
|
148
|
-
verbatimFields?: (string | RegExp)[];
|
|
149
|
-
/**
|
|
150
|
-
* 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
|
|
151
|
-
* 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.
|
|
152
|
-
*/
|
|
153
|
-
removeOuterBraces?: string[];
|
|
154
|
-
/**
|
|
155
|
-
* Specify parsing mode for specific fields
|
|
156
|
-
*/
|
|
157
|
-
fieldMode?: Record<string, ParseMode>;
|
|
158
|
-
/**
|
|
159
|
-
* If this flag is set entries will be returned without conversion of LaTeX to unicode equivalents.
|
|
160
|
-
*/
|
|
161
|
-
raw?: boolean;
|
|
162
|
-
/**
|
|
163
|
-
* You can pass in an existing `@string` dictionary
|
|
164
|
-
*/
|
|
165
|
-
strings?: Record<string, string> | string;
|
|
166
|
-
/**
|
|
167
|
-
* Apply crossref inheritance
|
|
168
|
-
*/
|
|
169
|
-
applyCrossRef?: boolean;
|
|
170
|
-
}
|
|
171
|
-
export interface Creator {
|
|
172
|
-
name?: string;
|
|
173
|
-
lastName?: string;
|
|
174
|
-
firstName?: string;
|
|
175
|
-
prefix?: string;
|
|
176
|
-
suffix?: string;
|
|
177
|
-
initial?: string;
|
|
178
|
-
useprefix?: boolean;
|
|
179
|
-
juniorcomma?: boolean;
|
|
180
|
-
}
|
|
181
|
-
export declare const FieldMode: {
|
|
182
|
-
creatorlist: string[];
|
|
183
|
-
title: string[];
|
|
184
|
-
verbatim: (string | RegExp)[];
|
|
185
|
-
richtext: string[];
|
|
186
|
-
literallist: string[];
|
|
187
|
-
};
|
|
188
|
-
type ParseMode = keyof typeof FieldMode | 'literal' | 'verbatimlist';
|
|
189
|
-
export declare const English: string[];
|
|
190
|
-
type unsupportedHandler = (node: Node, tex: string, entry: Entry) => string;
|
|
191
|
-
export declare function parse(input: string, options?: Options): Library;
|
|
192
|
-
export declare function parseAsync(input: string, options?: Options): Promise<Library>;
|
|
193
|
-
//# sourceMappingURL=index.d.ts.map
|