@retorquere/bibtex-parser 10.0.1 → 11.0.0

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.
@@ -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,2 @@
1
+ export declare function merge<T>(options: T, defaults: T): T;
2
+ //# sourceMappingURL=merge.d.ts.map
@@ -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,3 @@
1
+ declare const _default: string[];
2
+ export default _default;
3
+ //# sourceMappingURL=prepositions.d.ts.map
@@ -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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Ac;IAwBtB,OAAO,CAAC,YAAY;IAwCpB,OAAO,CAAC,YAAY;IAmCpB,OAAO,CAAC,YAAY;IAuBpB,QAAQ,IAAI,MAAM;IAKlB,KAAK,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI;IAK5B,OAAO,CAAC,KAAK;IAUb,OAAO,CAAC,GAAG;IAgBX,OAAO,CAAC,gBAAgB;IAwBxB,OAAO,CAAC,KAAK;IAkCb,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,OAAO;IAaf,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,MAAM;YAMA,WAAW;IAQzB,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,SAAS;CAoDlB;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAIzE;AAED,eAAO,MAAM,QAAQ;iBACA,MAAM,YAAW,aAAa,GAAQ,OAAO,CAAC,OAAO,CAAC;CAK1E,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare function playnice(): Promise<void>;
2
+ //# sourceMappingURL=yield.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yield.d.ts","sourceRoot":"","sources":["../../yield.ts"],"names":[],"mappings":"AAAA,wBAAsB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAE9C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retorquere/bibtex-parser",
3
- "version": "10.0.1",
3
+ "version": "11.0.0",
4
4
  "description": "BibTeX parser",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",