ipypublish.bib2glossary.classes module

class ipypublish.bib2glossary.classes.BibGlossDB[source]

Bases: collections.abc.MutableMapping

static get_fake_entry_obj(key)[source]
static guess_path(path)[source]

guess the path of a bib file, with or without a file extension, from the available files in the path folder

load(path, encoding='utf8')[source]

load a file, the type will be guessed from the extension, or (if no extension is given), the available files in the path folder

Parameters
  • path (str) –

  • encoding='utf8' (str) – encoding of the file

load_bib(text_str=None, path=None, bibdb=None, encoding='utf8', ignore_nongloss_types=False, ignore_duplicates=False)[source]

load a bib file

Parameters
  • text_str=None (str or None) – string representing the bib file contents

  • path=None (str or None) – path to bibfile

  • bibdb=None (bibtexparser.bibdatabase.BibDatabase or None) –

  • encoding="utf8" (str) – bib file encoding

  • ignore_nongloss_types (bool) – if False, a KeyError will be raised for non-gloss types

  • ignore_duplicates (bool) – if False, a KeyError will be raised if multiple entries are found with the same key, otherwise only the first entry will be used

load_tex(text_str=None, path=None, encoding='utf8', skip_ioerrors=False, ignore_unknown_types=True)[source]

load a tex file

Parameters
  • text_str=None (str or None) – string representing the bib file contents

  • path=None (str or None) – path to bibfile

  • bibdb=None (bibtexparser.bibdatabase.BibDatabase or None) –

  • encoding="utf8" (str) – bib file encoding

  • skip_ioerrors (bool) – if False, an IOError will be raised if newglossaryterm or newacronym is badly formatted

  • ignore_unknown_types (bool) – if True, strip unknown types, otherwise raise a ValueError

Notes

the texsoup package is required.

if a newglossaryterm has field ‘type={symbols}’, then it will be loaded as a symbol

to_bib_string()[source]
to_dict()[source]
to_latex_dict(splitlines=True)[source]

convert to dict of latex strings

Returns

{(<type>, <key>): <latex string>}

Return type

dict

to_latex_string()[source]
class ipypublish.bib2glossary.classes.BibGlossEntry(entry_dict)[source]

Bases: object

get(key)[source]
property key
property label
property plural
property sortkey
property text
to_dict()[source]
to_latex()[source]
property type