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

Use case sensitive entry type #453

Open
2 tasks
claell opened this issue Jan 25, 2024 · 4 comments
Open
2 tasks

Use case sensitive entry type #453

claell opened this issue Jan 25, 2024 · 4 comments

Comments

@claell
Copy link
Contributor

claell commented Jan 25, 2024

Is your feature request related to a problem? Please describe.
Creating an entry with entry = bibtexparser.model.Entry(entry_type, key, fields) won't preserve the case for the entry_type. If I use Article, it gets converted to article, etc.

This is not so nice, as other software will then change the case again when I use it.

Describe the solution you'd like
Ability to preserve the given case.

Use cases
Compatibility with other software, don't mess up git diffs.

Describe alternatives you've considered
Manually changing; using other software for it.

Remaining Questions (Optional)
Please tick all that apply:

  • I would be willing to contribute a PR to fix this issue.
  • This issue is a blocker, I'd be grateful for an early fix.
@claell
Copy link
Contributor Author

claell commented Jan 25, 2024

Possibly, there also is a way to do that, which I don't know of, yet.

@MiWeiss
Copy link
Collaborator

MiWeiss commented Jan 25, 2024

I confirm there's no way to do this yet.

The usecase is certainty a valid one, I'm happy to take this into our backlog. However, it should be accompanied by a "KeysToLowercase" middleware to also allow use cases where keys are assumed to be lowercase (which is helpful, e.g. when querying for specific blocks or keys).

Help wanted: Anyone, please volunteer if you'd be willing to implement this feature. Note: The implementation will require some further refinement (e.g. how to define duplicate keys). Thus, make sure to first continue the discussion here before starting with implementing this feature.

@MiWeiss MiWeiss added the v2 label Jan 25, 2024
@claell
Copy link
Contributor Author

claell commented Jan 26, 2024

I noticed that this is not a problem, when just creating an entry and writing it. However, when reading a file with case-sensitive entry types, modifying it and saving again, then it results in lower case entry types.

@claell
Copy link
Contributor Author

claell commented Jan 26, 2024

This allows a manual workaround for now. After loading the file, I'll loop over the entries and manually replace the entry_type with its uppercase version before writing again.

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