Skip to content

bib.bibtexparser.middlewares_library_to_library

Classes

MiddlewaresLibraryToLibrary

MiddlewaresLibraryToLibrary(options)

Middlewares for converting a library to a library.

Parameters:

Name Type Description Default
options dict

Options for the middlewares.

required

Attributes:

Name Type Description
function_common_again bool

Run common middlewares again. Default is True.

lower_entry_type bool

Lower Entry type. Default is True.

lower_entry_field_key bool

Lower Entry field keys. Default is True.

keep_entries_by_cite_keys list

list of keys to keep entries in the order of cite keys. Default is [].

update_month bool

Convert str month to int month. Default is True.

update_number_volume bool

Update number and volume. Default is True.

update_pages bool

Update pages. Default is True.

update_title bool

Update title. Default is True.

sentence_title_case bool

Sentence title case. Default is True.

generate_entry_cite_keys bool

Generate Entry keys (cite keys). Default is False.

full_abbr_article_dict dict

Full to abbreviation dictionary for article. Default is {}.

full_abbr_inproceedings_dict dict

Full to abbreviation dictionary for inproceedings. Default is {}.

full_names_in_json str

Full names in json format. Default is "".

abbr_names_in_json str

Abbreviated names in json format. Default is "".

abbr_article_pattern_dict dict

Pre-compiled regex patterns for journal name matching

abbr_inproceedings_pattern_dict dict

Pre-compiled regex patterns for conference name matching

full_to_abbr_for_abbr bool

Full to abbreviation for abbreviate. Default is True.

abbr_index_article_for_abbr int

Index for abbreviation in article. Default is 1.

abbr_index_inproceedings_for_abbr int

Index for abbreviation in inproceedings. Default is 2.

protect_title_with_bracket_for_abbr bool

Protect title with bracket. Default is True

doi_or_url_for_abbr bool

Keep only doi or url. Default is True.

doi_to_url_for_abbr bool

Change doi to url and delete original doi. Default is True.

add_link_to_fields_for_abbr Optional[list[str]] = None

Add link to fields. Default is None.

is_keep_fields_for_abbr bool

Keep fields for abbreviate. Default is True.

keep_entry_list_for_abbr list

Entry list for keep fields. Default is keep_for_abbr()[0].

keep_field_list_list_for_abbr list

Field list list for keep fields. Default is keep_for_abbr()[1].

delete_field_list_for_abbr list

Delete fields list for abbreviate. Default is [].

replace_fields_for_abbr bool

Replace fields for abbreviate. Default is True.

replace_old_field_list_for_abbr list

Old field list for replace. Default is [["publisher"]].

replace_new_field_list_for_abbr list

New field list for replace. Default is [["howpublished"]].

replace_entry_list_for_abbr list

Entry list for replace. Default is ["misc"].

maximum_authors_for_abbr int

Maximum number of authors. Default is 0.

protect_title_with_bracket_for_zotero bool

Protect title with bracket. Default is False

doi_or_url_for_zotero bool

Keep only doi or url. Default is True.

is_keep_fields_for_zotero bool

Keep fields for zotero. Default is True.

keep_entry_list_for_zotero list

Entry list for keep fields. Default is keep_for_zotero()[0].

keep_field_list_list_for_zotero list

Field list list for keep fields. Default is keep_for_zotero()[1].

delete_field_list_for_zotero list

Delete fields list for zotero. Default is [].

delete_redundant_in_journal_booktitle bool

Delete redundant parts in journal and booktitle. Default is True.

title_journal_booktitle_for_zotero bool

Title journal and booktitle contents. Default is True.

add_archive_for_zotero bool

Add field 'archive'. Default is True.

add_journal_abbr_for_zotero bool

Add 'journal/booktitle abbreviation'. Default is True.

protect_title_with_bracket_for_save bool

Protect title with bracket. Default is False

delete_field_list_for_save list

Delete fields list for save. Default is [].

is_sort_entry_fields bool

Sort entry fields alphabetically. Default is True.

is_sort_blocks bool

Sort entries by type and user sort key. Default is True.

sort_entries_by_cite_keys list

list of keys to sort entries in the order of cite keys. Default is [].

sort_entries_by_field_keys list

list of keys to sort entries in the order of field keys. Default is ["year", "volume", "number", "month", "pages"].

sort_entries_by_field_keys_reverse bool

Reverse the sorting of the field keys. Default is True.

Source code in pybibtexer/bib/bibtexparser/middlewares_library_to_library.py
def __init__(self, options: dict[str, Any]):
    self.function_common_again = options.get("function_common_again", True)
    self.function_common_again_for_abbr = options.get("function_common_again_for_abbr", True)
    self.function_common_again_for_zotero = options.get("function_common_again_for_zotero", True)
    self.function_common_again_for_save = options.get("function_common_again_for_save", True)
    self._initialize_function_sort(options)

    self._initialize_function_common(options)
    self._initialize_function_abbr(options)
    self._initialize_function_zotero(options)
    self._initialize_function_save(options)