.. _bibble.io.writer: ================ bibble.io.writer ================ .. py:module:: bibble.io.writer Type Aliases ------------ .. autoapisummary:: bibble.io.writer.Middleware Classes ------- .. autoapisummary:: bibble.io.writer.BibbleWriter bibble.io.writer._Visitors_m Module Contents =============== .. py:data:: Middleware :type: TypeAlias :value: API.Middleware_p | API.BidirectionalMiddleware_p .. _bibble.io.writer.BibbleWriter: .. py:class:: BibbleWriter(stack, *, format = None, logger = None, active_blocks = None) A Refactored bibtexparser writer Uses visitor pattern Note: visit method are responsible for new lines .. py:method:: _align_key(key) -> 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 = ' .. py:method:: _calculate_auto_value_align(library) -> 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 .. py:method:: make_body(library) -> .. py:method:: make_footer(library, file = None) -> .. py:method:: make_header(library, title) -> .. py:method:: make_lib(*, header, body, footer) -> .. py:method:: set_active(active) -> .. py:method:: visit(block) -> .. py:method:: 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 .. py:method:: write_as_data(library, *, file = None, append = None, title = None) -> :abstractmethod: Instead of writing the library out as a string, write it as data eg: creating a docutils structure. .. py:method:: write_failures(library, *, file = None, append = False) -> Write failed blocks to a separate file .. py:attribute:: _active_blocks :type: set[type[bibtexparser.model.Block]] .. py:attribute:: _join_char :value: '' .. py:attribute:: _logger .. py:attribute:: _middlewares :type: list[Middleware] .. py:attribute:: _value_column :type: jgdv.Maybe[int] .. py:attribute:: _value_sep :type: str .. py:attribute:: format :type: bibtexparser.writer.BibtexFormat .. bibble.io.writer._Visitors_m: .. py:class:: _Visitors_m .. py:method:: visit_entry(block) -> .. py:method:: visit_expl_comment(block) -> .. py:method:: visit_failed_block(block) -> .. py:method:: visit_impl_comment(block) -> .. py:method:: visit_metablock(block) -> .. py:method:: visit_middleware_error_block(block) -> .. py:method:: visit_parsing_failed_block(block) -> .. py:method:: visit_preamble(block) -> .. py:method:: visit_string(block) ->