SortBlocksByTypeAndUserSortKeyMiddleware(
keep_entry_according_cite_keys=None,
sort_entry_according_field_keys=None,
sort_entry_according_field_keys_reverse=True,
)
Bases: LibraryMiddleware
Sorts the blocks of a library by type and User Sort Key.
Source code in pybibtexer/bib/bibtexparser/middlewares/library/sorting_blocks.py
| def __init__(
self,
keep_entry_according_cite_keys: list[str] | None = None,
sort_entry_according_field_keys: list[str] | None = None,
sort_entry_according_field_keys_reverse: bool = True,
):
if keep_entry_according_cite_keys is None:
keep_entry_according_cite_keys = []
if sort_entry_according_field_keys is None:
sort_entry_according_field_keys = ["year", "volume", "number", "month", "pages"]
self._verify_all_types_are_block_types(DEFAULT_BLOCK_TYPE_ORDER)
self.keep_entry_according_cite_keys = keep_entry_according_cite_keys
self.sort_entry_according_field_keys = sort_entry_according_field_keys
self.sort_entry_according_field_keys_reverse = sort_entry_according_field_keys_reverse
# In-place modification is not yet supported, we make this explicit here,
super().__init__(allow_inplace_modification=False)
|