Skip to content
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

✨ Nice way to handle enclosings for months while writing with the default stack #447

Open
nschloe opened this issue Jan 20, 2024 · 1 comment

Comments

@nschloe
Copy link

nschloe commented Jan 20, 2024

Instead of month = {1}, I would like to see month = jan in my bibtex outputs. I see that write_string and write_file both have some middleware argument, but something like

write_string(
    library,
    bibtex_format=bibtex_format,
    prepend_middleware=[MonthAbbreviationMiddleware(True)],
)

only gives

month = {jan}

(with brackets).

Any hints?

@MiWeiss
Copy link
Collaborator

MiWeiss commented Apr 20, 2024

Thanks for your comment. I don't think this is supported yet in a non-hacky fashion - although it clearly should be.

Hacky way: It should be possible if you did not prepend_middleware but unparse_stack with a custom AddEnclosingMiddleware instance which implements your desired behavior. That's hardly a nice solution, though.

I'll convert this into a feature request: One possible solution: We could implement a way to specify the desired enclosing on a field value. Said value should be set e.g. by the MonthAbbreviationMiddlewareorMonthAbbreviationMiddleware` and - if set - have precedence over the default enclosings set by the writer.

I'm happy to discuss specifics if anyone wants to take over this issue.

@MiWeiss MiWeiss changed the title [question] How to write months as abbreviations? ✨ Nice way to handle enclosings for months while writing with the default stack Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants