Hayagriva allows most fields to take either a plain scalar or a structured form: title and
url may be a string or a map with a value key, author/editor may be a string, a list of
strings, or a list of maps, parent may be a map or a list of maps, and serial-number may be
a scalar or a map. Parsing therefore works on the untyped node tree instead of fixed POJOs,
extracting what JabRef can represent and ignoring the rest.
| Modifier and Type | Field and Description |
|---|---|
| private static final Set | |
| private static final Set | |
| private static final Set | |
| private static final YAMLMapper | |
| private static final int | MAX_LOOKAHEAD_CHARS
Generous room for leading comments plus the first entry, whose |
| private static final Set | RECOGNIZED_TYPES
All entry types of the Hayagriva specification (https://github.com/typst/hayagriva/blob/main/docs/file-format.md#entry-type); used for format recognition. |
| private static final Pattern | |
| private static final Map |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | applyAffiliated(BibEntry bibEntry, @Nullable JsonNode affiliatedNode)
|
| private void | applyParents(BibEntry bibEntry, @Nullable JsonNode parentNode)
A Hayagriva |
| private Optional | formatPerson(JsonNode personNode)
Hayagriva person strings already use BibTeX's structured "Family, Given" form and are kept verbatim; the structured map form is converted to it. |
| private static Optional | formattedText(@Nullable JsonNode node)
Reads a Hayagriva "formattable string": either a plain scalar or a map holding the actual
string under |
| public String | getDescription()
Implements abstract org. Returns the description of the import format. |
| public FileType | getFileType()
Implements abstract org. Returns the type of files that this importer can read |
| public String | getId()
Implements abstract org. Returns a slug, which identifies this importer. |
| public String | getName()
Implements abstract org. Returns the name of this import format. |
| public ParserResult | importDatabase(BufferedReader input)
Implements abstract org. Parse the database in the source. |
| public boolean | isRecognizedFormat(BufferedReader input)
Overrides org. Lightweight recognition for the |
| public boolean | isRecognizedFormat(Reader input)
Overrides org. Full recognition for the |
| private Optional | |
| private static Optional | scalarText(@Nullable JsonNode node)
Returns the text of a scalar node (string, number, boolean); empty for containers and null. |
| private static void | |
| private BibEntry |
| BOOK_PART_TYPES | back to summary |
|---|---|
| private static final Set<EntryType> BOOK_PART_TYPES | |
| BOOKTITLE_PARENT_TYPES | back to summary |
|---|---|
| private static final Set<String> BOOKTITLE_PARENT_TYPES | |
| JOURNAL_PARENT_TYPES | back to summary |
|---|---|
| private static final Set<String> JOURNAL_PARENT_TYPES | |
| MAPPER | back to summary |
|---|---|
| private static final YAMLMapper MAPPER | |
| MAX_LOOKAHEAD_CHARS | back to summary |
|---|---|
| private static final int MAX_LOOKAHEAD_CHARS Generous room for leading comments plus the first entry, whose | |
| RECOGNIZED_TYPES | back to summary |
|---|---|
| private static final Set<String> RECOGNIZED_TYPES All entry types of the Hayagriva specification
(https://github.com/typst/hayagriva/blob/main/docs/file-format.md#entry-type); used for
format recognition. Types without a BibTeX equivalent in | |
| TYPE_LINE_PATTERN | back to summary |
|---|---|
| private static final Pattern TYPE_LINE_PATTERN | |
| TYPES_MAP | back to summary |
|---|---|
| private static final Map<String, EntryType> TYPES_MAP | |
| HayagrivaImporter | back to summary |
|---|---|
| public HayagrivaImporter() | |
| applyAffiliated | back to summary |
|---|---|
| private void applyAffiliated(BibEntry bibEntry, @Nullable JsonNode affiliatedNode)
| |
| applyParents | back to summary |
|---|---|
| private void applyParents(BibEntry bibEntry, @Nullable JsonNode parentNode) A Hayagriva | |
| formatPerson | back to summary |
|---|---|
| private Optional Hayagriva person strings already use BibTeX's structured "Family, Given" form and are kept verbatim; the structured map form is converted to it. | |
| formattedText | back to summary |
|---|---|
| private static Optional Reads a Hayagriva "formattable string": either a plain scalar or a map holding the actual
string under | |
| getDescription | back to summary |
|---|---|
| public String getDescription() Implements abstract org. Doc from org. Returns the description of the import format. The description should specifywhat kind of entries from what sources and based on what specification it is able to importby what criteria it
| |
| getFileType | back to summary |
|---|---|
| public FileType getFileType() Implements abstract org. Doc from org. Returns the type of files that this importer can read
| |
| getId | back to summary |
|---|---|
| public String getId() Implements abstract org. Doc from org. Returns a slug, which identifies this importer. Used, for example, to identify the importer in CLI. Typically, this name should be short, in English, and should not contain special characters like #, %, etc.
| |
| getName | back to summary |
|---|---|
| public String getName() Implements abstract org. Doc from org. Returns the name of this import format. Typically, this is a string that denotes file type or format. It can also be localized, like "XMP-annotated PDF".
| |
| importDatabase | back to summary |
|---|---|
| public ParserResult importDatabase(BufferedReader input) throws IOException Implements abstract org. Doc from org. Parse the database in the source. This method can be called in two different contexts - either when importing in a specified format, or when importing in unknown format. In the latter case, JabRef cycles through all available import formats. No error messages or feedback is displayed from individual import formats in this case. If importing in a specified format and an empty library is returned, JabRef reports that no entries were found. If your format is binary-based (PDF, ZIP-based, or others), then you should not solely override this method. For binary formats do this:
| |
| isRecognizedFormat | back to summary |
|---|---|
| public boolean isRecognizedFormat(BufferedReader input) throws IOException Overrides org. Lightweight recognition for the
| |
| isRecognizedFormat | back to summary |
|---|---|
| public boolean isRecognizedFormat(Reader input) throws IOException Overrides org. Full recognition for the
| |
| persons | back to summary |
|---|---|
| private Optional Persons may be a single scalar, a list of scalars, a map, or a list of maps. | |
| scalarText | back to summary |
|---|---|
| private static Optional Returns the text of a scalar node (string, number, boolean); empty for containers and null. | |
| setIfAbsent | back to summary |
|---|---|
| private static void setIfAbsent(BibEntry entry, StandardField field, String value) | |
| toBibEntry | back to summary |
|---|---|
| private BibEntry toBibEntry(String citationKey, JsonNode entryNode) | |