Skip to content

Commit

Permalink
Merge pull request #82 from JuliaDocs/78-fix-tex-escape-initials
Browse files Browse the repository at this point in the history
Un-escape TeX before generating name initials
  • Loading branch information
goerz authored Nov 14, 2024
2 parents df162b1 + 616fc4e commit 39a8cf2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/src/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ @phdthesis{GoerzPhd2015
}

@article{GoerzPRA2015,
Author = {Goerz, Michael H. and Gualdi, Giulia and Reich, Daniel M. and Koch, Christiane P. and Motzoi, Felix and Whaley, K. Birgitta and Vala, Ji\vr\'i and Müller, Matthias M. and Montangero, Simone and Calarco, Tommaso},
Author = {Goerz, Michael H. and Gualdi, Giulia and Reich, Daniel M. and Koch, Christiane P. and Motzoi, Felix and Whaley, K. Birgitta and Vala, Jiří and Müller, Matthias M. and Montangero, Simone and Calarco, Tommaso},
Title = {Optimizing for an arbitrary perfect entangler. II. Application},
Journal = pra,
Year = {2015},
Expand Down
2 changes: 1 addition & 1 deletion src/formatting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ end

function _initial(name)
initial = ""
_name = Unicode.normalize(strip(name))
_name = Unicode.normalize(tex_to_markdown(strip(name)))
if length(_name) > 0
initial = "$(_name[1])."
for part in split(_name, "-")[2:end]
Expand Down
12 changes: 12 additions & 0 deletions test/test_formatting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,18 @@ end
end


@testset "Handling initial for tex-escaped Ł (#78)" begin

# https://github.com/JuliaDocs/DocumenterCitations.jl/issues/78

bib = CitationBibliography(joinpath(splitext(@__FILE__)[1], "issue78.bib"))
md(key) = format_bibliography_reference(Val(:numeric), bib.entries[key])
@test md("vaswani2017Attention") ==
"Ł. Kaiser. *Attention Is All You Need*. In: *Proceedings of the 31st International Conference on Neural Information Processing Systems* (2017)."

end


@testset "invalid DOI" begin

bib = CitationBibliography(joinpath(splitext(@__FILE__)[1], "invalid_doi.bib"))
Expand Down
6 changes: 6 additions & 0 deletions test/test_formatting/issue78.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@inproceedings{vaswani2017Attention,
title = {Attention Is All You Need},
author = {Kaiser, {\L}ukasz},
year = {2017},
booktitle = {Proceedings of the 31st International Conference on Neural Information Processing Systems},
}
2 changes: 2 additions & 0 deletions test/test_tex_to_markdown.jl
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ end
@test tex_to_markdown(raw"Ga{\\\"e}tan") == "Gaëtan"
@test tex_to_markdown(raw"C\^ot\'e") == "Côté"
@test tex_to_markdown(raw"Gro{\ss}") == "Groß"
@test tex_to_markdown(raw"{\L}ukasz") == "Łukasz"
@test tex_to_markdown(raw"Ji\v{r}\'i") == "Jiří"
end

@testset "titles" begin
Expand Down

0 comments on commit 39a8cf2

Please sign in to comment.