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

Incorrect parsing of names with spaced escape codes #39

Open
goerz opened this issue Nov 16, 2024 · 1 comment
Open

Incorrect parsing of names with spaced escape codes #39

goerz opened this issue Nov 16, 2024 · 1 comment

Comments

@goerz
Copy link

goerz commented Nov 16, 2024

Originally reported by @blegat in JuliaDocs/DocumenterCitations.jl#85

With a file issue.bib:

@misc{Unlu2024,
  title = {More issues with escaped unicode},
  author = {{\"U}nl{\"u}, {\c C}a{\u g}lar},
  year = {2024},
  note = {Bug Report #85},
}

the author name gets parsed incorrectly:

julia> import Bibliography

julia> bib = Bibliography.import_bibtex("issue.bib")
OrderedCollections.OrderedDict{String, BibInternal.Entry} with 1 entry:
  "Unlu2024" => Entry(Access("", "", ""), Name[Name("", "{\\\"U}nl{\\\"u}", "", "{\\c", "C}a{\\u g}lar")], "", Date("", "", "2024"), Name[], Eprint("", "", ""), "Unlu2024", In("", "…

julia> entry = bib["Unlu2024"]
BibInternal.Entry(BibInternal.Access("", "", ""), BibInternal.Name[BibInternal.Name("", "{\\\"U}nl{\\\"u}", "", "{\\c", "C}a{\\u g}lar")], "", BibInternal.Date("", "", "2024"), BibInternal.Name[], BibInternal.Eprint("", "", ""), "Unlu2024", BibInternal.In("", "", "", "", "", "", "", "", "", "", "", "", "", ""), Dict{String, String}(), "Bug Report #85", "More issues with escaped unicode", "misc")

julia> name = entry.authors[1]
BibInternal.Name("", "{\\\"U}nl{\\\"u}", "", "{\\c", "C}a{\\u g}lar")

julia> dump(name)
BibInternal.Name
  particle: String ""
  last: String "{\\\"U}nl{\\\"u}"
  junior: String ""
  first: String "{\\c"
  middle: String "C}a{\\u g}lar"

I'm guessing that the parser splits at the space before it processes the TeX group

@goerz
Copy link
Author

goerz commented Nov 16, 2024

Another example that fails (for the same reason):

@article{Lehtinen2007,
  title = {Estimating nucleation rates from apparent particle formation rates and vice versa: Revised formulation of the Kerminen–Kulmala equation},
  author = {Kari E.J. Lehtinen and Miikka {Dal Maso} and Markku Kulmala and Veli-Matti Kerminen},
  journal = {Journal of Aerosol Science},
  volume = {38},
  number = {9},
  pages = {988-994},
  year = {2007},
  doi = {10.1016/j.jaerosci.2007.06.009}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant