-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Maarten
committed
May 25, 2017
1 parent
7b2c748
commit 187428e
Showing
17 changed files
with
350 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# bibtex-js | ||
|
||
Library for parsing BibTeX. | ||
Library for parsing BibTeX .bib files 📚. | ||
|
||
This module literally just parses a BibTex file and doesn't do any fancy TeX string processing yet. If you want to actually work with a bibliography, look for [Bibliography.js](https://github.com/digitalheir/bibliography-js). | ||
This module literally just parses a BibTex file and doesn't do any TeX string processing (i.e., `{\"o}` is not translated to `ö`). If you want to actually work with a bibliography, look for [Bibliography.js](https://github.com/digitalheir/bibliography-js). | ||
|
||
Also, many internal BibTeX functions are not implemented simply because I don't need them personally. Pull requests are welcome. | ||
Also, many internal BibTeX functions are not implemented yet, simply because I don't need them personally. Pull requests are welcome. | ||
|
||
## License | ||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import {StringRef} from "./StringRef"; | ||
import {BracedString, OuterBracedString} from "./BracedString"; | ||
import {OuterQuotedString, QuotedString} from "./QuotedString"; | ||
|
||
|
||
export type BibStringDatum = (BracedString | QuotedString | OuterQuotedString | OuterBracedString | string | number | StringRef); | ||
export type BibStringData = BibStringDatum[]; | ||
|
||
export class BibStringComponent { | ||
readonly data: BibStringData; | ||
readonly type: string; | ||
|
||
/** | ||
* The brace depth of an item is the number of braces surrounding it (surrounding the field with braces instead of quotes does not modify the brace depth) | ||
*/ | ||
readonly braceDepth: number; | ||
|
||
constructor(type: string, braceDepth: number, data: BibStringData) { | ||
this.type = type; | ||
this.braceDepth = braceDepth; | ||
this.data = data; | ||
} | ||
|
||
|
||
} | ||
|
||
export function isBibStringComponent(x: any): x is BibStringComponent { | ||
return typeof x.braceDepth === "number" && typeof x.type === "string"; | ||
} | ||
|
||
// TODO | ||
// /** | ||
// * A special character is a | ||
// part of a field starting with a left brace being at brace depth 0 immediately followed with a backslash, | ||
// and ending with the corresponding right brace. For instance, in the above example, there is no special | ||
// character, since \LaTeX is at depth 2. It should be noticed that anything in a special character is | ||
// considered as being at brace depth 0, even if it is placed between another pair of braces. | ||
// */ | ||
// export class SpecialCharacter extends BibStringComponent { | ||
// constructor(data: BibStringData) { | ||
// super("specialCharacter", 0, data); | ||
// } | ||
// | ||
// copyWithResolvedStringReferences(alreadyResolved, refs): BibStringComponent { | ||
// return new SpecialCharacter(resolveStringReferences(this,(alreadyResolved, refs)); | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.