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

Replace BibTexParser & Writer #123

Closed
stefan-kolb opened this issue Aug 24, 2015 · 12 comments
Closed

Replace BibTexParser & Writer #123

stefan-kolb opened this issue Aug 24, 2015 · 12 comments

Comments

@stefan-kolb
Copy link
Member

The class BibtexParsershould be replaced or rewritten if possible. Currently, it is quite a mess. Also, it only does the parsing of the files and not the writing.

We need to investigate if we can replace it by some external library like jBibTex or need to rewrite it properly. The same probably holds for the writing process which should be aligned with the reading process.

Any information appreciated.

@koppor
Copy link
Member

koppor commented Aug 24, 2015

Maybe we should check all Java-based BibTeX-based managers how they do it?

@koppor
Copy link
Member

koppor commented Aug 24, 2015

jBibTex should be checked if arbitrary keys are supported. The commit S-Shimotori/jbibtex@da1bb9e indicates that the keys are are hardcoded. Another option is to drop support of customized entries completely and only support hard-coded ones.

@koppor
Copy link
Member

koppor commented Aug 24, 2015

The ANTLRv3 Grammar could be a good start. If we use it, we have to ask @bkiers if he is willing to relicense it GPLv2+ or any other GPL-compatible license.

@bluebirch
Copy link

Erathostenes (https://bitbucket.org/mkmatlock/eratosthenes/wiki/Home) use
jBibTeX and arbitrary keys are supported, as far as I am aware since I use
it.

@koppor
Copy link
Member

koppor commented Aug 25, 2015

We should generate test cases for it. I started to collect publicly available bibtex files at the wiki. Should we include them using git submodules? I think, that is too much overhead.

@koppor
Copy link
Member

koppor commented Oct 6, 2015

Comments in the file before all entries and after all entries should be kept.

Example (from http://shelah.logic.at/eindex.html)

%  a sample bibliography file
%  

@article{small,
author = {Freely, I.P.},
title = {A small paper},
journal = {The journal of small papers},
year = 1997,
volume = {-1},
note = {to appear},
}

@article{big,
author = {Jass, Hugh},
title = {A big paper},
journal = {The journal of big papers},
year = 7991,
volume = {MCMXCVII},
}

%  The authors mentioned here are almost, but not quite,
%  entirely unrelated to Matt Groening.

@vruusmann
Copy link

The JBibTeX library has full support for inline comments. In JavaCC terminology, they are part of the class model object as special tokens (attached to normal tokens).

@koppor
Copy link
Member

koppor commented Oct 6, 2015

The library needs a deeper invesitagation. Just browsing https://github.com/jbibtex/jbibtex/blob/master/src/main/java/org/jbibtex/LaTeXPrinter.java makes the impression that strings are somehow replaced with unicode chars at some writing. But I can't see how this class is used just by browsing. (Comments missing 😇)

There are some forks like

@oscargus
Copy link
Contributor

oscargus commented Oct 6, 2015

Note that everything outside of @xxx{ } is a comment in BibTex. Hence, just make sure that you support anything, not just lines starting with %.

@vruusmann
Copy link

The JBibTeX parser (which is auto-generated after JavaCC grammar file) skips all content that doesn't start with % or @.

Currently, normal and special tokens are created, but they are not added to the resulting high-level class model objects (eg. the org.jbibtex.StringValue instance that is returned by org.jbibtex.BibTeXComment#getValue() does not provide method getToken()). However, this kind of API would be easy to introduce if necessary.

@lenhard
Copy link
Member

lenhard commented Oct 8, 2015

This resolution of this issue heavily depends on our decision for #116

If we decide to maintain configuration options (and therefore custom formats), it is highly likely that we cannot use a third party library, but have to implement serialization on our own. Having said that, I a very much for completely rewriting the serialization as it currently stands.

@lenhard
Copy link
Member

lenhard commented Dec 9, 2015

BibtexParser and BibtexEntryWriter have already been changed significantly in our endeavour to standardize writing and parsing. See #116

With the customizations we want to keep and implement, using an external API is really not an option. Therefore, I am closing this issue. If there are more things to discuss, we can defer to #116, or for specific aspects open a new issue.

@lenhard lenhard closed this as completed Dec 9, 2015
hitalo-siriano added a commit to hitalo-siriano/jabref that referenced this issue Oct 22, 2024
Modified the handling of URLs in the file field to replace the pipe character (|) with its encoded representation (%7C) to avoid exceptions
in JabRef.

Closes JabRef#123
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

6 participants