bibble.io.writer
Type Aliases
Classes
A Refactored bibtexparser writer |
|
Module Contents
- bibble.io.writer.Middleware: TypeAlias = API.Middleware_p | API.BidirectionalMiddleware_p
- class bibble.io.writer.BibbleWriter(
- stack,
- *,
- format=None,
- logger=None,
- active_blocks=None,
A Refactored bibtexparser writer Uses visitor pattern
Note: visit method are responsible for new lines
- Parameters:
stack (bibble.util.PairStack | list[Middleware])
format (jgdv.Maybe[bibtexparser.writer.BibtexFormat])
logger (jgdv.Maybe[logmod.Logger])
active_blocks (jgdv.Maybe[collections.abc.Iterable[type[bibtexparser.model.Block]]])
- _align_key(key) <Unknown>[source]
take {key} and make {key}{padding}{sep}, Padding is from ‘_calculate_auto_value_align’, the largest key length. Sep is typically ‘=’.
eg: _align_key(‘blah’) -> ‘blah = ‘
- _calculate_auto_value_align(library) <Unknown>[source]
Sets the separation between keys and the value separator. If its already set, does nothing. If the format specifies a value, uses that. Otherwise calulates it from the larges field key
- Parameters:
library (bibtexparser.library.Library)
- Return type:
None
- Parameters:
file (None | pathlib.Path)
- Return type:
- set_active(active) <Unknown>[source]
- Parameters:
active (collections.abc.Iterable[type[bibtexparser.model.Block]])
- Return type:
None
- write(
- library,
- *,
- file=None,
- append=None,
- title=None,
Write the library to a string, and possbly a file # TODO write failure reports to a separate file
- Parameters:
library (bibtexparser.library.Library)
file (None | pathlib.Path)
append (jgdv.Maybe[list[Middleware]])
title (jgdv.Maybe[str])
- Return type:
- abstractmethod write_as_data(
- library,
- *,
- file=None,
- append=None,
- title=None,
Instead of writing the library out as a string, write it as data
eg: creating a docutils structure.
- Parameters:
library (bibtexparser.library.Library)
file (None | pathlib.Path)
append (jgdv.Maybe[list[Middleware]])
title (jgdv.Maybe[str])
- Return type:
Any
- write_failures(
- library,
- *,
- file=None,
- append=False,
Write failed blocks to a separate file
- Parameters:
library (bibtexparser.library.Library)
file (jgdv.Maybe[pathlib.Path])
append (bool)
- Return type:
- _join_char = ''
- _logger
- format: bibtexparser.writer.BibtexFormat
- class bibble.io.writer._Visitors_m[source]
-
- visit_failed_block(block) <Unknown>[source]
- Parameters:
block (bibble.model.FailedBlock)
- Return type:
- visit_metablock(block) <Unknown>[source]
- Parameters:
block (bibble.model.MetaBlock)
- Return type: