@retorquere/bibtex-parser 8.0.9 → 8.0.11
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/index.d.ts +4 -8
- package/index.js +24 -24
- package/package.json +1 -1
- package/verbatim.d.ts +3 -3
- package/grammar.d.ts +0 -216
package/index.d.ts
CHANGED
|
@@ -27,11 +27,7 @@ type ArrayFields = {
|
|
|
27
27
|
location?: string[];
|
|
28
28
|
origlocation?: string[];
|
|
29
29
|
};
|
|
30
|
-
type
|
|
31
|
-
year?: number | string;
|
|
32
|
-
month?: number | string;
|
|
33
|
-
};
|
|
34
|
-
type TypedFields = CreatorFields & ArrayFields & NumberFields;
|
|
30
|
+
type TypedFields = CreatorFields & ArrayFields;
|
|
35
31
|
type Fields = TypedFields & Omit<Record<string, string>, keyof TypedFields>;
|
|
36
32
|
export type Entry = {
|
|
37
33
|
type: string;
|
|
@@ -43,7 +39,7 @@ export type Entry = {
|
|
|
43
39
|
};
|
|
44
40
|
input: string;
|
|
45
41
|
};
|
|
46
|
-
export interface
|
|
42
|
+
export interface Library {
|
|
47
43
|
/**
|
|
48
44
|
* errors found while parsing
|
|
49
45
|
*/
|
|
@@ -184,6 +180,6 @@ export declare const FieldMode: {
|
|
|
184
180
|
};
|
|
185
181
|
type ParseMode = keyof typeof FieldMode | 'literal';
|
|
186
182
|
type unsupportedHandler = (node: Node, tex: string, entry: Entry) => string;
|
|
187
|
-
export declare function parse(input: string, options?: Options):
|
|
188
|
-
export declare function parseAsync(input: string, options?: Options): Promise<
|
|
183
|
+
export declare function parse(input: string, options?: Options): Library;
|
|
184
|
+
export declare function parseAsync(input: string, options?: Options): Promise<Library>;
|
|
189
185
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -77,29 +77,29 @@ for (const tag of ['i', 'b', 'sc', 'nc', 'ncx', 'br', 'p', 'li', 'code']) {
|
|
|
77
77
|
}
|
|
78
78
|
const collapsable = /\x0E\/([a-z]+)\x0F(\s*)\x0E\1\x0F/ig;
|
|
79
79
|
const Month = {
|
|
80
|
-
jan: 1,
|
|
81
|
-
january: 1,
|
|
82
|
-
feb: 2,
|
|
83
|
-
february: 2,
|
|
84
|
-
mar: 3,
|
|
85
|
-
march: 3,
|
|
86
|
-
apr: 4,
|
|
87
|
-
april: 4,
|
|
88
|
-
may: 5,
|
|
89
|
-
jun: 6,
|
|
90
|
-
june: 6,
|
|
91
|
-
jul: 7,
|
|
92
|
-
july: 7,
|
|
93
|
-
aug: 8,
|
|
94
|
-
august: 8,
|
|
95
|
-
sep: 9,
|
|
96
|
-
september: 9,
|
|
97
|
-
oct: 10,
|
|
98
|
-
october: 10,
|
|
99
|
-
nov: 11,
|
|
100
|
-
november: 11,
|
|
101
|
-
dec: 12,
|
|
102
|
-
december: 12,
|
|
80
|
+
jan: '1',
|
|
81
|
+
january: '1',
|
|
82
|
+
feb: '2',
|
|
83
|
+
february: '2',
|
|
84
|
+
mar: '3',
|
|
85
|
+
march: '3',
|
|
86
|
+
apr: '4',
|
|
87
|
+
april: '4',
|
|
88
|
+
may: '5',
|
|
89
|
+
jun: '6',
|
|
90
|
+
june: '6',
|
|
91
|
+
jul: '7',
|
|
92
|
+
july: '7',
|
|
93
|
+
aug: '8',
|
|
94
|
+
august: '8',
|
|
95
|
+
sep: '9',
|
|
96
|
+
september: '9',
|
|
97
|
+
oct: '10',
|
|
98
|
+
october: '10',
|
|
99
|
+
nov: '11',
|
|
100
|
+
november: '11',
|
|
101
|
+
dec: '12',
|
|
102
|
+
december: '12',
|
|
103
103
|
};
|
|
104
104
|
exports.FieldMode = {
|
|
105
105
|
creator: [
|
|
@@ -751,7 +751,7 @@ class BibTeXParser {
|
|
|
751
751
|
if (field === 'crossref')
|
|
752
752
|
return value;
|
|
753
753
|
if (FieldAction.parseInt.includes(field) && value.trim().match(/^-?\d+$/))
|
|
754
|
-
return parseInt(value)
|
|
754
|
+
return `${parseInt(value)}`;
|
|
755
755
|
if (mode === 'title' && sentenceCase) {
|
|
756
756
|
if (!this.options.sentenceCase.guess || !(0, sentence_case_2.guessSentenceCased)(value, /\x0E\/?([a-z]+)\x0F/ig)) {
|
|
757
757
|
value = (0, sentence_case_2.toSentenceCase)(value, {
|
package/package.json
CHANGED
package/verbatim.d.ts
CHANGED
|
@@ -58,13 +58,13 @@ declare class Parser {
|
|
|
58
58
|
private matchGuard;
|
|
59
59
|
private parseNext;
|
|
60
60
|
}
|
|
61
|
-
export type
|
|
61
|
+
export type Library = Parser;
|
|
62
62
|
/**
|
|
63
63
|
* Parses a bibtex source in verbatim mode. Good for detection of bibtex and for later LaTeX-reparsing.
|
|
64
64
|
*/
|
|
65
|
-
export declare function parse(input: string, options?: ParserOptions):
|
|
65
|
+
export declare function parse(input: string, options?: ParserOptions): Library;
|
|
66
66
|
export declare const promises: {
|
|
67
|
-
parse(input: string, options?: ParserOptions): Promise<
|
|
67
|
+
parse(input: string, options?: ParserOptions): Promise<Library>;
|
|
68
68
|
};
|
|
69
69
|
export {};
|
|
70
70
|
//# sourceMappingURL=verbatim.d.ts.map
|
package/grammar.d.ts
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License
|
|
3
|
-
|
|
4
|
-
Copyright (c) 2017 Derek P Sifford, parts copyright (c) 2019 by Emiliano Heyns
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
in the Software without restriction, including without limitation the rights
|
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
furnished to do so, subject to the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
interface LocationInfo {
|
|
26
|
-
offset: number
|
|
27
|
-
line: number
|
|
28
|
-
column: number
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface Location {
|
|
32
|
-
start: LocationInfo
|
|
33
|
-
end: LocationInfo
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface TextValue {
|
|
37
|
-
kind: 'Text'
|
|
38
|
-
loc?: Location
|
|
39
|
-
source?: string
|
|
40
|
-
value: string
|
|
41
|
-
mode: 'text' | 'math' | 'verbatim'
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface StringReference {
|
|
45
|
-
kind: 'StringReference'
|
|
46
|
-
loc: Location
|
|
47
|
-
source: string
|
|
48
|
-
name: string
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface NumberValue {
|
|
52
|
-
kind: 'Number'
|
|
53
|
-
loc: Location
|
|
54
|
-
source: string
|
|
55
|
-
value: number
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export type Argument = Block | Command | TextValue
|
|
59
|
-
|
|
60
|
-
export interface RegularCommand {
|
|
61
|
-
kind: 'RegularCommand'
|
|
62
|
-
loc: Location
|
|
63
|
-
source: string
|
|
64
|
-
command: string
|
|
65
|
-
arguments: {
|
|
66
|
-
optional: TextValue[]
|
|
67
|
-
required: Argument[]
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface SubscriptCommand {
|
|
72
|
-
kind: 'SubscriptCommand'
|
|
73
|
-
loc: Location
|
|
74
|
-
source: string
|
|
75
|
-
value: string
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface SuperscriptCommand {
|
|
79
|
-
kind: 'SuperscriptCommand'
|
|
80
|
-
loc: Location
|
|
81
|
-
source: string
|
|
82
|
-
value: string
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface SymbolCommand {
|
|
86
|
-
kind: 'SymbolCommand'
|
|
87
|
-
loc: Location
|
|
88
|
-
source: string
|
|
89
|
-
command: string
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface DiacriticCommand {
|
|
93
|
-
kind: 'DiacriticCommand'
|
|
94
|
-
loc?: Location
|
|
95
|
-
source?: string
|
|
96
|
-
mark: string
|
|
97
|
-
character: string
|
|
98
|
-
dotless?: boolean
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export interface Math {
|
|
102
|
-
kind: 'InlineMath' | 'DisplayMath'
|
|
103
|
-
loc?: Location
|
|
104
|
-
source?: string
|
|
105
|
-
value: ValueType[]
|
|
106
|
-
case?: 'protect' | 'preserve'
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export interface Environment {
|
|
110
|
-
kind: 'Environment'
|
|
111
|
-
loc?: Location
|
|
112
|
-
source?: string
|
|
113
|
-
value: ValueType[]
|
|
114
|
-
env: string
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export interface Block {
|
|
118
|
-
kind: 'Block'
|
|
119
|
-
loc?: Location
|
|
120
|
-
source?: string
|
|
121
|
-
value: ValueType[]
|
|
122
|
-
|
|
123
|
-
case?: 'protect' | 'preserve'
|
|
124
|
-
markup: {
|
|
125
|
-
sub?: boolean
|
|
126
|
-
sup?: boolean
|
|
127
|
-
bold?: boolean
|
|
128
|
-
italics?: boolean
|
|
129
|
-
smallCaps?: boolean
|
|
130
|
-
enquote?: boolean
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export interface Field {
|
|
135
|
-
kind: 'Field'
|
|
136
|
-
loc: Location
|
|
137
|
-
source: string
|
|
138
|
-
name: string
|
|
139
|
-
value: ValueType[]
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export interface Entry {
|
|
143
|
-
kind: 'Entry'
|
|
144
|
-
id: string
|
|
145
|
-
type: string
|
|
146
|
-
loc: Location
|
|
147
|
-
source: string
|
|
148
|
-
fields: Field[]
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export interface PreambleExpression {
|
|
152
|
-
kind: 'PreambleExpression'
|
|
153
|
-
loc: Location
|
|
154
|
-
source: string
|
|
155
|
-
value: ValueType[]
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export interface StringDeclaration {
|
|
159
|
-
kind: 'StringDeclaration'
|
|
160
|
-
loc: Location
|
|
161
|
-
source: string
|
|
162
|
-
name: string
|
|
163
|
-
value: ValueType[]
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export interface BracedComment {
|
|
167
|
-
kind: 'BracedComment'
|
|
168
|
-
loc: Location
|
|
169
|
-
source: string
|
|
170
|
-
value: string
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export interface LineComment {
|
|
174
|
-
kind: 'LineComment'
|
|
175
|
-
loc: Location
|
|
176
|
-
source: string
|
|
177
|
-
value: string
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export interface NonEntryText {
|
|
181
|
-
kind: 'NonEntryText'
|
|
182
|
-
loc: Location
|
|
183
|
-
source: string
|
|
184
|
-
value: string
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export interface Markup {
|
|
188
|
-
kind: 'Markup',
|
|
189
|
-
loc?: Location,
|
|
190
|
-
value: string,
|
|
191
|
-
source: string
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export type Comment = BracedComment | LineComment | NonEntryText
|
|
195
|
-
|
|
196
|
-
export type Command = RegularCommand | SymbolCommand | DiacriticCommand | SubscriptCommand | SuperscriptCommand
|
|
197
|
-
|
|
198
|
-
export type ValueType = TextValue | StringReference | Block | Environment | Math | NumberValue | Command
|
|
199
|
-
|
|
200
|
-
export type Node = Comment | Entry | PreambleExpression | StringDeclaration | Markup
|
|
201
|
-
|
|
202
|
-
export interface Bibliography {
|
|
203
|
-
kind: 'Bibliography'
|
|
204
|
-
loc: Location
|
|
205
|
-
source: string
|
|
206
|
-
children: Node[]
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export interface ParseOptions {
|
|
210
|
-
verbatimFields?: Array<string | RegExp>
|
|
211
|
-
verbatimCommands?: string[]
|
|
212
|
-
unnestFields?: string[]
|
|
213
|
-
combining?: string[]
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export function parse(input: string, options?: ParseOptions): Bibliography
|