bib.bibtexparser.model¶
Classes¶
Block ¶
A abstract superclass of all top-level building blocks of a bibtex file.
E.g. a @string block, a @preamble block, an @entry block, a comment, etc.
Source code in pybibtexer/bib/bibtexparser/model.py
Attributes¶
parser_metadata property ¶
EXPERIMENTAL: field for middleware to store auxiliary information.
As an end-user, as long as you are not writing middleware, you probably do not need to use this field.
** Warning (experimental) ** The content of this field is undefined and may change at any time.
This field is intended for middleware to store auxiliary information. It is a key-value store, where the key is a string and the value is any python object. This allows for example to pass information between different middleware.
raw property ¶
The raw, unmodified string (bibtex) representation of this block.
Note: Middleware does not update this field, hence, after applying middleware to a library, this field may be outdated.
start_line property ¶
The line number of the first line of this block in the parsed string.
Functions¶
get_parser_metadata ¶
EXPERIMENTAL: get auxiliary information stored in parser_metadata.
See attribute parser_metadata for more information.
Source code in pybibtexer/bib/bibtexparser/model.py
set_parser_metadata ¶
EXPERIMENTAL: set auxiliary information stored in parser_metadata.
See attribute parser_metadata for more information.
DuplicateBlockKeyBlock ¶
Bases: ParsingFailedBlock
An error-indicating block created for blocks with keys present in the library already.
To get the block that caused this error, call block.ignore_error_block.
Source code in pybibtexer/bib/bibtexparser/model.py
DuplicateFieldKeyBlock ¶
Bases: ParsingFailedBlock
An error-indicating block indicating a duplicate field key in an entry.
Source code in pybibtexer/bib/bibtexparser/model.py
Entry ¶
Bases: Block
Bibtex Blocks of the @entry type, e.g. @article{Cesar2013, ...}.
Source code in pybibtexer/bib/bibtexparser/model.py
Attributes¶
entry_type property writable ¶
The type of the entry, e.g. article in @article{Cesar2013, ...}.
fields_dict property ¶
A dict of fields, with field keys as keys.
Note that with duplicate field keys, the behavior is undefined.
Functions¶
__contains__ ¶
__delitem__ ¶
Dict-mimicking index.
This serves for partial v1.x backwards compatibility, as well as for a shorthand for pop.
__getitem__ ¶
Dict-mimicking index.
This serves for partial v1.x backwards compatibility, as well as for a shorthand for accessing field values.
Note that with duplicate field keys, the behavior is undefined.
Source code in pybibtexer/bib/bibtexparser/model.py
__setitem__ ¶
Dict-mimicking index.
This serves for partial v1.x backwards compatibility, as well as for a shorthand for set_field.
get ¶
Return the field with the given key, or the default value if it does not exist.
:param key: The key of the field. :param default: The value to return if the field does not exist.
Source code in pybibtexer/bib/bibtexparser/model.py
items ¶
Dict-mimicking, for partial v1.x backwards compatibility.
For newly written code, it's recommended to use entry.entry_type, entry.key and entry.fields instead.
Source code in pybibtexer/bib/bibtexparser/model.py
pop ¶
Remove and return the field with the given key.
:param key: The key of the field to remove. :param default: The value to return if the field does not exist.
Source code in pybibtexer/bib/bibtexparser/model.py
set_field ¶
Add a new field, or replaces existing with same key.
Source code in pybibtexer/bib/bibtexparser/model.py
ExplicitComment ¶
Bases: Block
Bibtex Blocks of the @comment type, e.g. @comment{This is a comment}.
Source code in pybibtexer/bib/bibtexparser/model.py
Field ¶
ImplicitComment ¶
Bases: Block
Bibtex outside of an @{...} block, which is treated as a comment.
Source code in pybibtexer/bib/bibtexparser/model.py
MiddlewareErrorBlock ¶
Bases: ParsingFailedBlock
A block that could not be parsed due to a middleware error.
To get the block that caused this error, call block.ignore_error_block (which is the block with the middleware not or only partially applied).
Source code in pybibtexer/bib/bibtexparser/model.py
ParsingFailedBlock ¶
Bases: Block
A block that could not be parsed due to some raised exception.
Source code in pybibtexer/bib/bibtexparser/model.py
Preamble ¶
Bases: Block
Bibtex Blocks of the @preamble type, e.g. @preamble{This is a preamble}.