bib2x

TeXhandler.Memory

API

StoringTeXhandler

Bases: handler.BibTeXhandler

A BibTeX handler keeping the entries in memory

__init__()

Constructor

startDocument()

Called at the begin of a document's processing

addStringDefinition(key, value)

Adds the definition of a string

Stores the definition in the self._stringMap dictionary.

Parameters:

Name Type Description Default
key str

The shortcut for the string.

required
value str

The value of the string.

required

Todo: Remove self._stringMapKeys

addComment(key, value)

Adds a comment

This implementation is somehow "magic" as it targets parsing JabRef comments that contain a group assignment.

Parameters:

Name Type Description Default
key str

The name of the comment?

required
value str

The value of the comment.

required

Todo: Extract JabRef-parsing.

startEntry(entryID)

Called if a new entry is started to being parsed.

Begins entry by storing it in internal containers.

Parameters:

Name Type Description Default
entryID str

The ID (key) of the entry

required

addField(entryID, key, value)

Called if a new attribute of an entry shall be added.

Stores the attribute in the self._entries[entryID] dictionary.

Parameters:

Name Type Description Default
entryID str

The ID (key) of the entry

required
key str

The name of the attribute

required
value str

The value of the attribute

required

addField2(entryID, key, pairs)

Called if a new attribute consisting of multiple named fields shall be added.

Allocates a dictionary entry in self._entries[entryID] with the given key. Inserts the given pairs as key/values into this dictionary.

Parameters:

Name Type Description Default
entryID str

The ID (key) of the entry

required
key str

The name of the attribute

required
pairs List[Tuple[str, str]]

The value of the attribute

required

closeEntry(entryID)

Closes the entry

Parameters:

Name Type Description Default
entryID str

The ID (key) of the entry

required

endDocument()

Called after parsing a document