-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Allow simple way to create custom block sorting #480
Comments
Hi, I would like to take a crack at this. I have a code at work that renders BibTeX into HTML and I ran into the issue of having to code custom sorting for the I have a few questions:
It might take me a bit. Day job takes precedence. Edit: Regarding the docstrings, I see some Sphinx-autodoc stuff here and there, but not everywhere. |
Hi @mirhahn Awesome, thanks a lot!
No. Go ahead. I personally like google docstyle the best and think it's used most frequently in the repo, but so far we're not enforcing it. Should probably do that eventually, though ;-)
Well, if your implementation is capable of parallel execution (has no race condition, is threadsafe, ...) just pass "true" to the superclass. Otherwise, pass "false". Note however thata at the moment, parallel execution is not yet supported, thus this is more something to be prepared once this is eventually implemented in the parser.
Any version which is not yet EOL. Thus, I assume we'll drop 3.8 support later this year.
Search for |
We'd want to facilitate users sorting blocks according to their needs.
They easiest and most general way to do this would probably be to create a new abstract class
SortBlocksMiddleware
with the following properties:compare(block1, block2) -> int
, following the standard convention that any returned value > 0 indicates that block2 should come anywhere after block1, any value <0 the opposit and a return value of 0 sais that any order of the two should be fine.compare
method should list the standard conventions for such a method (the conditions above, but also that it's transitive, pure, ...)SortBlocksByTypeAndKeyMiddleware
should extend/implementSortBlocksMiddleware
Location of the code: https://github.com/sciunto-org/python-bibtexparser/blob/main/bibtexparser/middlewares/sorting_blocks.py
I am currently not working on this, so feel free to comment below if you want to take over.
The text was updated successfully, but these errors were encountered: