Bibliography is the orchestration layer of the bibliography stack.
Use it when you want a simple API for common operations:
- import a bibliography from BibTeX, BibLaTeX, RIS, CFF, CSL-JSON, EndNote, or MODS;
- validate or filter a bibliography document;
- sort entries;
- export to BibTeX, BibLaTeX, RIS, CFF, CSL-JSON, EndNote, MODS, or a lightweight web projection.
using Bibliography
bib = read_bibliography("references.bib")
validate(bib)
selected = select(bib, ["lovelace1843"])
write_bibliography("references.out.bib", selected)Bibliography.Bibliography — Module
Bibliography is the high-level bibliography interface for the Humans of Julia stack.
It combines BibParser.jl and BibInternal.jl into a single package that can import, validate, filter, sort, and export bibliographic data.
Bibliography.sorting_rules — Constant
const sorting_rules = Dict{Symbol, Vector{Symbol}}(
:nty => [:authors; :title; :date],
:nyt => [:authors; :date; :title],
:nety => [:authors; :editors; :title; :date],
:neyt => [:authors; :editors; :date; :title],:y => [:date], );
Implemented sorting rules for bibliography entry sorting.
See also sort_bibliography!.
Bibliography.Publication — Type
PublicationA structure to store all the information necessary for web export.
Bibliography.Publication — Method
Publication(entry)Construct a Publication for the lightweight web projection.
Bibliography.access_to_bibtex! — Method
access_to_bibtex!(fields, a)Transform the how-to-access field to a BibTeX string.
Bibliography.bibliography_entries — Method
bibliography_entries(bibliography)Return an ordered dictionary of canonical entries keyed by entry id.
Bibliography.bibtex_to_web — Method
bibtex_to_web(source::String)Convert a BibTeX file to the lightweight web projection returned by export_web.
Bibliography.cff_dict — Method
export_cff(e::Entry, destination::String="CITATION.cff", version::String="1.2.0", add_preferred::Bool=true) -> Dict{String, Any}Export an Entry to a CFF file (default is CITATION.cff).
Bibliography.compose_rule_profiles — Method
compose_rule_profiles(format, overlays...; name)Compose a destination format profile with product, project, or institution overlays.
Bibliography.date_to_bibtex! — Method
date_to_bibtex!(fields, date)Convert a date to a BibTeX string.
Bibliography.eprint_to_bibtex! — Method
eprint_to_bibtex!(fields, eprint)Convert eprint information to a BibTeX string.
Bibliography.export_biblatex — Method
export_biblatex(bibliography)Export a bibliography to BibLaTeX format.
Bibliography.export_bibtex — Method
export_bibtex(target, bibliography)Export a bibliography to BibTeX format.
Bibliography.export_bibtex — Method
export_bibtex(bibliography)Export a bibliography to a BibTeX string.
Bibliography.export_bibtex — Method
export_bibtex(e::Entry)Export an Entry to a BibTeX string.
Bibliography.export_cff — Method
export_cff(e::Entry; destination::String = "CITATION.cff",
version::String = "1.2.0", add_preferred::Bool = true)Export an Entry to a CFF file and return the generated dictionary.
Bibliography.export_cff_collection — Method
export_cff_collection(bibliography; destination, version="1.2.0",
add_preferred=true) -> Vector{String}Export every bibliography entry as an independent, specification-compliant CFF document in destination. Files are named <entry-id>.cff; the returned vector contains their paths in bibliography order.
Bibliography.export_csl — Method
export_csl(args...)Placeholder for the CSL writer extension. Install the corresponding extension package to enable it.
Bibliography.export_endnote — Method
export_endnote(args...)Placeholder for the EndNote writer extension. Install the corresponding extension package to enable it.
Bibliography.export_mods — Method
export_mods(args...)Placeholder for the MODS writer extension. Install the corresponding extension package to enable it.
Bibliography.export_web — Method
export_web(bibliography::DataStructures.OrderedDict{String,BibInternal.Entry})Export a bibliography in internal format to a lightweight web projection. The same representation is also used by DocumenterCitations.jl.
Bibliography.field_to_bibtex — Method
field_to_bibtex(key, value)Convert an entry field to BibTeX format.
Bibliography.fileio_load — Method
fileio_load(file; check)
fileio_load(stream; check)The FileIO interface to import a BibTeX file or parse a BibTeX string and convert it to the internal bibliography format. The check keyword argument can be set to :none (or nothing), :warn, or :error to raise appropriate logs.
Bibliography.fileio_save — Method
fileio_save(file, data)
fileio_save(stream, data)Export a bibliography as a BibTeX string to a file or stream.
Bibliography.filter_bibliography — Method
filter_bibliography(bibliography, predicate)Filter entries with predicate(entry), preserving document metadata when the input is a lossless document.
Bibliography.import_bibtex — Method
import_bibtex(input; check = :none)Import a BibTeX file or parse a BibTeX string and convert it to the internal bibliography format. The check keyword argument can be set to :none (or nothing), :warn, or :error to raise appropriate logs.
Bibliography.import_cff — Method
import_cff(input; id="") -> EntryImport a CFF file and convert it to the internal bibliography format.
When no identifier is supplied, a deterministic internal identifier is derived from the CFF title and release year. CFF itself has no citation-key field.
Bibliography.import_cff_collection — Method
import_cff_collection(source) -> OrderedDict{String, Entry}Import a collection of independent CFF documents. source can be a directory containing .cff files or a vector of file paths. Each file stem becomes the entry id, making directory export/import round-trips preserve bibliography keys without adding non-standard fields to the CFF documents.
Bibliography.in_to_bibtex! — Method
in_to_bibtex!(fields::BibInternal.Fields, i::BibInternal.In)Convert the "published in" information to a BibTeX string.
Bibliography.int_to_spaces — Method
int_to_spaces(n)Make a string of n spaces.
Bibliography.na_if_empty — Method
na_if_empty(str::AbstractString) -> AbstractStringUse placeholder value if string param is empty.
Bibliography.name_to_string — Method
name_to_string(name::BibInternal.Name)Convert a name in an Entry to a string.
Bibliography.names_to_strings — Method
names_to_strings(names)Convert a collection of names to a BibTeX string.
Bibliography.read_bibliography — Method
read_bibliography(input; format = :auto, check = :error)Read a bibliography from a path, stream, or string and return a lossless BibInternal.BibliographyDocument.
Bibliography.recursive_isless — Function
recursive_isless(a::Entry, b::Entry, fields::Tuple{Symbol},
depth::Int = 0)Helper function for sort_bibliography!.
This function allows recursive checking if a < b with descending importance. The importance set for the comparison is defined by the argument fields. This argument is a tuple consisting of symbols denoting the fields of the data type BibInternal.Entry. The ordering implies the importance.
The depth argument is purely for iterating/recursive purposes.
Bibliography.rule_profile — Method
rule_profile(format)Return the canonical validation profile associated with a supported bibliography format. Exchange-format profiles deliberately validate the canonical input required by the current exporter; source schema validation remains the parser's responsibility.
Bibliography.select — Method
select(
bibliography::DataStructures.OrderedDict{String,Entry},
selection::Vector{String};
complementary::Bool = false
)Select a subset of bibliography entries by key.
If complementary is true, the keys in selection are excluded instead of kept.
Bibliography.sort_bibliography! — Function
sort_bibliography!(
bibliography::DataStructures.OrderedDict{String,Entry},
sorting_rule::Symbol = :key
)Sorts the bibliography in place.
The sorting order can be set by specifying the sorting_rule. The sorting is implemented via isless() functions. For detailed insight have a look at the isless() implementation of Julia and BibInternal.jl.
Supported symbols for sorting_rule are:
:key(default): sort by bibliography keys e.g. BibTeX keys or:id- the sorting rules defined in
sorting_rules
Bibliography.validate — Method
validate(bibliography; ruleset=nothing, profile=nothing)Validate a bibliography document or collection of entries and return a BibInternal.ValidationResult. With neither keyword, a document uses its format profile. ruleset remains available for compatibility; new consumers should use composable profile values.
Bibliography.write_bibliography — Method
write_bibliography([target], bibliography; format = :BibTeX, mode = :normalized)Write or return a bibliography string. With mode = :original or mode = :preserved, a lossless document returns its original source when available. With mode = :normalized, entries are emitted from the canonical view.
Bibliography.xcite — Method
xcite(entry)Format the BibTeX cite output of an Entry for web export.
Bibliography.xfile — Method
xfile(entry)Format the downloadable path of an Entry file for web export.
Bibliography.xin — Method
xin(entry)Format the appears-in field of an Entry for web export.
Bibliography.xlabels — Method
xlabels(entry)Format the labels of an Entry for web export.
Bibliography.xlink — Method
xlink(entry)Format the download link of an Entry for web export.
Bibliography.xnames — Function
xnames(entry, editors = false; names = :full)Format the name of an Entry for web export.
Arguments:
entry: an entryeditors:trueif the name describes editorsnames: :full (full names) or :last (last names + first name abbreviation)
Bibliography.xtitle — Method
xtitle(entryFormat the title of an Entry for web export.
Bibliography.xyear — Method
xyear(entry)Format the year of an Entry for web export.