Humans-of-Julia / BibParser.jl

Parser for bibliographic formats, including BibTeX, in pure Julia
MIT License
13 stars 4 forks source link

Questions to current state of parsing and an error message. #7

Open kellertuer opened 3 years ago

kellertuer commented 3 years ago

I am looking forward to using [DocumenterCitations.jl]() somewhen in my repositories and started playing around with BibParser trying to understand how I can maybe help going forward to CSL capabilities.

When I just take a Bibtex Example file – e.g. https://raw.githubusercontent.com/brechtm/citeproc-py/master/examples/xampl.bib

I get

julia> bib = BibParser.parse_file("xampl.bib")
ERROR: Expected } on line 345
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] expect at .julia/packages/BibParser/jVXKY/src/bibtex.jl:52 [inlined]
 [3] field!(::BibParser.BibTeX.Parser{Array{SubString{String},1}}, ::Dict{String,String}) at .julia/packages/BibParser/jVXKY/src/bibtex.jl:102
 [4] parse_bibtex(::String) at .julia/packages/BibParser/jVXKY/src/bibtex.jl:158
 [5] parse_file(::String) at .julia/packages/BibParser/jVXKY/src/bibtex.jl:169
 [6] #parse_file#1 at .julia/packages/BibParser/jVXKY/src/BibParser.jl:19 [inlined]
 [7] parse_file(::String) at .julia/packages/BibParser/jVXKY/src/BibParser.jl:18
 [8] top-level scope at REPL[7]:1

It seems to be a problem with doubly curly braces? Since line 345 is indeed

   author = "Ulrich {\"{U}}nderwood and Ned {\~N}et and Paul {\={P}}ot",

What's missing for this to be parsed?

Further if I shorten the file above to just the first entry

@ARTICLE{article-minimal,
   author = {L[eslie] A. Aamport},
   title = {The Gnats and Gnus Document Preparation System},
   journal = {\mbox{G-Animal's} Journal},
   year = 1986,
}

and parse the file only containing the, I get an empty dictionary.

Azzaare commented 3 years ago

As mentioned in #8 , I missed all the messages for a while ... Once I finish with the new bibtex parser, I will try your examples and see if there is still a need for a fix.

Azzaare commented 3 years ago

I think the parsing of xampl.bib is better now. However, it is far from satisfying (see #16 for instance)

Ideally, the content of the entries should be stored in BibInternal in a format that does not contain any more LaTeX code.