Skip to content

More issues with escaped unicode #85

Description

@blegat

Follow up from #78

With the script

using DocumenterCitations
bib = CitationBibliography("bug.bib")
DocumenterCitations.format_bibliography_reference(bib.style, bib.entries["key"])

For

@misc{key,
  author = {{\"U}nl{\"u}, {\c C}a{\u g}lar},
}

I get

ERROR: LoadError: ArgumentError: Premature end of tex string: BoundsError("{\\c", 4)
Stacktrace:
  [1] tex_to_markdown(tex_str::SubString{String}; transform_case::Function, debug::Base.CoreLogging.LogLevel)
    @ DocumenterCitations ~/.julia/dev/DocumenterCitations/src/tex_to_markdown.jl:135

When I try DocumenterCitations.tex_to_markdown(raw"{\"U}nl{\"u}, {\c C}a{\u g}lar"), I get "\"Unl\"u, Çağlar", which seems indeed weird because \"u" is not replaced by the unicode character.

With

@inproceedings{key,
  author = {Mikolov, Tom{\'a}{\v s}},
}

I get

caused by: BoundsError: attempt to access 11-codeunit SubString{String} at index [12]
Stacktrace:
  [1] checkbounds
    @ ./strings/basic.jl:216 [inlined]
  [2] getindex
    @ ./strings/substring.jl:100 [inlined]
  [3] _collect_group(tex_str::SubString{String}, i::Int64)
    @ DocumenterCitations ~/.julia/dev/DocumenterCitations/src/tex_to_markdown.jl:407
  [4] _process_tex(tex_str::SubString{…}; transform_case::DocumenterCitations.var"#73#75", debug::Base.CoreLogging.LogLevel)
    @ DocumenterCitations ~/.julia/dev/DocumenterCitations/src/tex_to_markdown.jl:196
  [5] tex_to_markdown(tex_str::SubString{String}; transform_case::Function, debug::Base.CoreLogging.LogLevel)
    @ DocumenterCitations ~/.julia/dev/DocumenterCitations/src/tex_to_markdown.jl:131
  [6] tex_to_markdown
    @ ~/.julia/dev/DocumenterCitations/src/tex_to_markdown.jl:125 [inlined]
  [7] _initial(name::String)
    @ DocumenterCitations ~/.julia/dev/DocumenterCitations/src/formatting.jl:25

but when I do DocumenterCitations.tex_to_markdown(raw"Mikolov, Tom{\'a}{\v s}") I get correctly "Mikolov, Tomáš".

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions