parent
54da038df9
commit
1a8fad9cb5
|
@ -11,46 +11,6 @@ Given a string (or IO stream) of bibtex-format bibliography data,
|
|||
parses the data and returns a `Dict`-like object `b::Bibliography` that
|
||||
behaves as a dictionary mapping strings to bibliography items
|
||||
[`Citation`](@ref).
|
||||
|
||||
```jldoctest
|
||||
julia> using BibTeX
|
||||
|
||||
julia> b = open(Bibliography, joinpath((@__FILE__) |> dirname |> dirname, "example", "examples.bib"), "r")
|
||||
BibTeX.Bibliography with 92 entries:
|
||||
"coleridge" => Citation{:book}(16 entries)
|
||||
"wilde" => Citation{:book}(8 entries)
|
||||
"aristotle:physics" => Citation{:book}(11 entries)
|
||||
"markey" => Citation{:online}(11 entries)
|
||||
"wassenberg" => Citation{:online}(11 entries)
|
||||
"baez/online" => Citation{:online}(9 entries)
|
||||
"moore:related" => Citation{:article}(12 entries)
|
||||
"almendro" => Citation{:patent}(7 entries)
|
||||
"sigfridsson" => Citation{:article}(13 entries)
|
||||
"malinowski" => Citation{:book}(11 entries)
|
||||
"nietzsche:ksa" => Citation{:book}(14 entries)
|
||||
"vangennep" => Citation{:book}(11 entries)
|
||||
"yoon" => Citation{:article}(8 entries)
|
||||
"gaonkar:in" => Citation{:incollection}(9 entries)
|
||||
"cms" => Citation{:manual}(14 entries)
|
||||
"moore" => Citation{:article}(9 entries)
|
||||
"laufenberg" => Citation{:patent}(10 entries)
|
||||
"iliad" => Citation{:book}(13 entries)
|
||||
"baez/article" => Citation{:article}(12 entries)
|
||||
⋮ => ⋮
|
||||
|
||||
julia> b["angenendt"]
|
||||
BibTeX.Citation{:article} with 10 entries:
|
||||
"pages" => "431--456, 791--823"
|
||||
"shorttitle" => "In Honore Salvatoris"
|
||||
"author" => "Angenendt, Arnold"
|
||||
"langid" => "german"
|
||||
"date" => "2002"
|
||||
"annotation" => "A German article in a French journal. Apart from that, a t…
|
||||
"indextitle" => "In Honore Salvatoris"
|
||||
"volume" => "97"
|
||||
"journaltitle" => "Revue d'Histoire Eccl{\\\\'e}siastique"
|
||||
"title" => "In Honore Salvatoris~-- Vom Sinn und Unsinn der Patrozinie…
|
||||
```
|
||||
"""
|
||||
function Bibliography(bibtex::String)
|
||||
preamble, data = parse_bibtex(bibtex)
|
||||
|
|
|
@ -13,6 +13,12 @@ Documenter.makedocs(
|
|||
authors = "Brandon Taylor"
|
||||
)
|
||||
|
||||
@testset "examples.bib" begin
|
||||
b = open(Bibliography, joinpath("..", "example", "examples.bib"), "r")
|
||||
@test length(b) == 92
|
||||
@test (b["angenendt"]::Citation{:article})["date"] == "2002"
|
||||
end
|
||||
|
||||
@testset "small bib" begin
|
||||
b = Bibliography("""
|
||||
@article{foo, bar=baz}
|
||||
|
|
Loading…
Reference in New Issue