From 574d458bb7ddf1e2526a16874b581bf511be5f53 Mon Sep 17 00:00:00 2001 From: Michael Goerz Date: Fri, 13 Oct 2023 16:15:03 -0400 Subject: [PATCH 1/3] Add test for "corporate authors" --- test/test_formatting.jl | 23 +++++++++++++++++++++++ test/test_formatting/corporateauthor.bib | 7 +++++++ 2 files changed, 30 insertions(+) create mode 100644 test/test_formatting/corporateauthor.bib diff --git a/test/test_formatting.jl b/test/test_formatting.jl index cb3f2b8..3a88852 100644 --- a/test/test_formatting.jl +++ b/test/test_formatting.jl @@ -165,3 +165,26 @@ end @Test md("jax") == "Bradbury, J.; Frostig, R.; Hawkins, P.; Johnson, M. J.; Leary, C.; Maclaurin, D.; Necula, G.; Paszke, A.; VanderPlas, J.; Wanderman-Milne, S. and Zhang, Q. [*`JAX`: composable transformations of Python+NumPy programs*](https://github.com/google/jax), [`https://numpy.org`](https://numpy.org)." end + + +@testset "corporate author" begin + + # https://github.com/JuliaDocs/DocumenterCitations.jl/issues/44 + + bib = CitationBibliography(joinpath(splitext(@__FILE__)[1], "corporateauthor.bib")) + + entry = bib.entries["OEIS"] + @test length(entry.authors) == 1 + + name = entry.authors[1] + dump(name) + @test_broken name.last == "OEIS Foundation Inc." + @test name.first == "" + @test name.middle == "" + @test name.particle == "" + + md(key) = format_bibliography_reference(Val(:numeric), bib.entries[key]) + @test_broken md("OEIS") == "OEIS Foundation Inc. [*The On-Line Encyclopedia of Integer Sequences*](https://oeis.org). Published electronically at https://oeis.org (2023)." + + +end diff --git a/test/test_formatting/corporateauthor.bib b/test/test_formatting/corporateauthor.bib new file mode 100644 index 0000000..845c180 --- /dev/null +++ b/test/test_formatting/corporateauthor.bib @@ -0,0 +1,7 @@ +@Misc{OEIS, + author = {{OEIS Foundation Inc.}}, + title = {The {O}n-{L}ine {E}ncyclopedia of {I}nteger {S}equences}, + howpublished = {Published electronically at https://oeis.org}, + year = {2023}, + url = {https://oeis.org} +} From f34f9655798249fd3fd66338b14badea99d4d5fc Mon Sep 17 00:00:00 2001 From: Michael Goerz Date: Fri, 13 Oct 2023 16:38:39 -0400 Subject: [PATCH 2/3] Add workaround --- test/test_formatting.jl | 4 +++- test/test_formatting/corporateauthor.bib | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/test/test_formatting.jl b/test/test_formatting.jl index 3a88852..fda88e3 100644 --- a/test/test_formatting.jl +++ b/test/test_formatting.jl @@ -174,7 +174,6 @@ end bib = CitationBibliography(joinpath(splitext(@__FILE__)[1], "corporateauthor.bib")) entry = bib.entries["OEIS"] - @test length(entry.authors) == 1 name = entry.authors[1] dump(name) @@ -186,5 +185,8 @@ end md(key) = format_bibliography_reference(Val(:numeric), bib.entries[key]) @test_broken md("OEIS") == "OEIS Foundation Inc. [*The On-Line Encyclopedia of Integer Sequences*](https://oeis.org). Published electronically at https://oeis.org (2023)." + nbsp = "\u00A0" + @test md("OEISworkaround") == "OEIS$(nbsp)Foundation$(nbsp)Inc. [*The On-Line Encyclopedia of Integer Sequences*](https://oeis.org). Published electronically at https://oeis.org (2023)." + end diff --git a/test/test_formatting/corporateauthor.bib b/test/test_formatting/corporateauthor.bib index 845c180..1d6a4ef 100644 --- a/test/test_formatting/corporateauthor.bib +++ b/test/test_formatting/corporateauthor.bib @@ -5,3 +5,11 @@ @Misc{OEIS year = {2023}, url = {https://oeis.org} } + +@Misc{OEISworkaround, + author = {OEIS Foundation Inc.}, + title = {The {O}n-{L}ine {E}ncyclopedia of {I}nteger {S}equences}, + howpublished = {Published electronically at https://oeis.org}, + year = {2023}, + url = {https://oeis.org} +} From 6ed3baa45d9623c35731f63af74a5a3b657c5c36 Mon Sep 17 00:00:00 2001 From: Michael Goerz Date: Tue, 24 Oct 2023 01:43:15 -0400 Subject: [PATCH 3/3] Confirm corporate authors working with BibInternal 0.3.5 --- test/test_formatting.jl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/test_formatting.jl b/test/test_formatting.jl index fda88e3..8641ca0 100644 --- a/test/test_formatting.jl +++ b/test/test_formatting.jl @@ -176,17 +176,18 @@ end entry = bib.entries["OEIS"] name = entry.authors[1] - dump(name) - @test_broken name.last == "OEIS Foundation Inc." + @test name.last == "{OEIS Foundation Inc.}" @test name.first == "" @test name.middle == "" @test name.particle == "" md(key) = format_bibliography_reference(Val(:numeric), bib.entries[key]) - @test_broken md("OEIS") == "OEIS Foundation Inc. [*The On-Line Encyclopedia of Integer Sequences*](https://oeis.org). Published electronically at https://oeis.org (2023)." + @test md("OEIS") == + "OEIS Foundation Inc. [*The On-Line Encyclopedia of Integer Sequences*](https://oeis.org). Published electronically at https://oeis.org (2023)." nbsp = "\u00A0" - @test md("OEISworkaround") == "OEIS$(nbsp)Foundation$(nbsp)Inc. [*The On-Line Encyclopedia of Integer Sequences*](https://oeis.org). Published electronically at https://oeis.org (2023)." + @test md("OEISworkaround") == + "OEIS$(nbsp)Foundation$(nbsp)Inc. [*The On-Line Encyclopedia of Integer Sequences*](https://oeis.org). Published electronically at https://oeis.org (2023)." end