Humans-of-Julia / BibParser.jl

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

Spurious spaces inserted with curly braces #5

Closed simonbyrne closed 3 years ago

simonbyrne commented 3 years ago
julia> using BibParser

julia> bibtex = """@article{Heun1900,
          title = {Neue Methoden zur approximativen Integration der
          Differentialgleichungen einer unabh\\\"{a}ngigen Ver\\\"{a}nderlichen},
          author = {Heun, Karl},
          journal = {Z. Math. Phys},
          volume = {45},
          pages = {23--38},
          year = {1900},
       }"""
"@article{Heun1900,\n   title = {Neue Methoden zur approximativen Integration der\n   Differentialgleichungen einer unabh\\\"{a}ngigen Ver\\\"{a}nderlichen},\n   author = {Heun, Karl},\n   journal = {Z. Math. Phys},\n   volume = {45},\n   pages = {23--38},\n   year = {1900},\n}"

julia> _,bib = BibParser.parse_entry(bibtex)
("", OrderedCollections.OrderedDict("Heun1900" => Dict("volume" => "45","author" => "Heun , Karl","pages" => "23--38","journal" => "Z. Math. Phys","year" => "1900","title" => "Neue Methoden zur approximativen Integration der Differentialgleichungen einer unabh\\ \" { a } ngigen Ver\\ \" { a } nderlichen","type" => "article")))

julia> bib["Heun1900"]["title"]
"Neue Methoden zur approximativen Integration der Differentialgleichungen einer unabh\\ \" { a } ngigen Ver\\ \" { a } nderlichen"
Azzaare commented 3 years ago

I definitely need to make a new parser (instead of borrowing one from someone ><). As mentioned in https://github.com/ali-ramadhan/DocumenterCitations.jl/pull/21, I will do it next month.

I plan to follow the model of Tokenize.jl, and integrate LaTeX special character and diacritical marks.

Azzaare commented 3 years ago

Spurious spaces troubles should be solved now (v0.2.7) However, converting common TeX to Unicode is not possible yet. Hopefully, we can make something for the next version.

Closing this.