BibInternal contains the canonical entry model and the lossless document types used by Bibliography.jl.
This page exists mainly as a bridge for readers who want to understand how the high-level API maps onto the shared data model.
BibInternal.BibInternal — Module
BibInternal provides the canonical bibliography model shared by the bibliography stack.
It keeps the core entry types, validation rules, diagnostics, and lossless document containers in one place so parsers and exporters can share the same data model.
BibInternal.entries — Constant
const entriesList of possible entries (currently based on bibtex). Keep it sorted for readability.
BibInternal.fields — Constant
const fields = [
:address,
:annote,
:archivePrefix,
:author,
:booktitle,
:chapter,
:crossref,
:edition,
:editor,
:eprint,
:howpublished,
:institution,
:isbn,
:issn,
:journal,
:key,
:month,
:note,
:number,
:organization,
:pages,
:primaryClass,
:publisher,
:school,
:series,
:title,
:type,
:volume,
:year
]List of possible fields (currently based on bibtex). Keep it sorted for readability
BibInternal.maxfieldlength — Constant
const maxfieldlengthFor output formatting purpose, for instance, export to BibTeX format.
BibInternal.rules — Constant
const rules = Dict([
"article" => ["author", "journal", "title", "year"]
"book" => [("author", "editor"), "publisher", "title", "year"]
"booklet" => ["title"]
"eprint" => ["author", "eprint", "title", "year"]
"inbook" => [("author", "editor"), ("chapter", "pages"), "publisher", "title", "year"]
"incollection" => ["author", "booktitle", "publisher", "title", "year"]
"inproceedings" => ["author", "booktitle", "title", "year"]
"manual" => ["title"]
"mastersthesis" => ["author", "school", "title", "year"]
"misc" => []
"phdthesis" => ["author", "school", "title", "year"]
"proceedings" => ["title", "year"]
"techreport" => ["author", "institution", "title", "year"]
"unpublished" => ["author", "note", "title"]
])List of BibTeX rules bases on the entry type. A field value as a singleton represents a required field. A pair of values represents mutually exclusive required fields.
BibInternal.AbstractBibliographyRule — Type
Base type for declarative and custom bibliography validation rules.
Third-party packages may subtype this type and extend validate_rule without modifying BibInternal's canonical field model.
BibInternal.AbstractEntry — Type
Abstract entry supertype.
BibInternal.Access — Type
struct Access
doi::String
howpublished::String
url::String
endStore the online access of an entry as a String. Handles the fields doi and url and the arXiv entries. For additional fields or entries, please fill an issue or make a pull request.
BibInternal.Access — Method
Access(fields::Fields)Construct the online access information based on the entry fields.
BibInternal.AlternativeRequiredField — Type
AlternativeRequiredField(names)A requirement where at least one of the listed fields must be present.
BibInternal.BibliographyDocument — Type
BibliographyDocumentLossless document-level container returned by parsers that need to preserve ordering, non-entry blocks, and parse diagnostics.
BibInternal.Date — Type
struct Date
day::String
month::String
year::String
endStore the date information as day, month, and year.
BibInternal.Date — Method
Date(fields::Fields)Construct the date information based on the entry fields.
BibInternal.Diagnostic — Type
DiagnosticStructured message attached to a bibliography document, raw entry, or field. The suggestion field is intentionally textual for now so command line tools and future GUIs can present a friendly next action without depending on a fix engine.
BibInternal.DiagnosticSeverity — Type
@enum DiagnosticSeverity diagnostic_info diagnostic_warning diagnostic_errorSeverity level for structured diagnostics emitted while parsing, normalizing, or validating bibliography data.
BibInternal.Entry — Type
struct Entry <: AbstractEntry
access::Access
authors::Names
booktitle::String
date::Date
editors::Names
eprint::Eprint
id::String
in::In
fields::Dict{String,String}
note::String
title::String
type::String
endGeneric Entry type. If some construction rules are required, it should be done beforehand. Check bibtex.jl as the example of rules implementation for BibTeX format.
BibInternal.Entry — Method
Entry(id::String, fields::Fields)Construct an entry with a unique id and a list of Fields.
BibInternal.EntryRule — Type
EntryRuleValidation rule for one source entry type.
BibInternal.EntryRuleSet — Type
EntryRuleSetVersioned collection of entry validation rules for a bibliography format. The aliases dictionary applies before entry-specific aliases, which makes it easy to share canonical field names across the whole format.
BibInternal.Eprint — Type
struct Eprint
archive_prefix::String
eprint::String
primary_class::String
endStore the information related to arXiv eprint format.
BibInternal.Eprint — Method
Eprint(fields::Fields)Construct the eprint arXiv information based on the entry fields. Handle old and current arXiv format.
BibInternal.FieldCardinalityRule — Type
FieldCardinalityRule(name, minimum=0, maximum=nothing)Constrain the number of values in a structured field. Flat string values count as one; parsers that preserve multiple values should pass a collection.
BibInternal.FieldSpec — Type
FieldSpecFormat-independent description of a canonical bibliography field. Parsers and exporters own source-format mappings; this catalog only describes the semantic field exposed to downstream consumers.
BibInternal.FieldTypeRule — Type
FieldTypeRule(name, value_kind)Require a populated field to match a canonical value kind such as :integer, :year, :date, or :uri.
BibInternal.Fields — Type
Fields = Dict{String, String}. Stores the fields name => value of an entry.
BibInternal.ForbiddenField — Type
ForbiddenField(name)Reject a field when it has a value.
BibInternal.In — Type
struct In
address::String
chapter::String
edition::String
institution::String
isbn::String
issn:String
journal::String
number::String
organization::String
pages::String
publisher::String
school::String
series::String
volume::String
endStore all the information related to how an entry was published.
BibInternal.In — Method
In(fields::Fields)Construct the information of how an entry was published based on its fields
BibInternal.LosslessEntry — Type
LosslessEntryPair a stable canonical Entry with the raw source entry and diagnostics used to build it. This keeps existing consumers on Entry while enabling parsers and writers to preserve source information.
BibInternal.MutuallyExclusiveFields — Type
MutuallyExclusiveFields(names)Allow at most one populated field in the group.
BibInternal.Name — Method
Name(str::String)Decompose without ambiguities a name as particle (optional) last, junior (optional), first middle (optional) based on BibTeX possible input. As for BibTeX, the decomposition of a name in the form of first last is also possible, but ambiguities can occur.
BibInternal.RawBlock — Type
RawBlockTop-level source block that is not necessarily a bibliographic entry, such as a BibTeX comment, preamble, string definition, or free text.
BibInternal.RawEntry — Type
RawEntryLossless representation of a parsed bibliography entry. kind is the source entry type, key is the citation key when the format has one, and fields preserves source order.
BibInternal.RawField — Type
RawFieldLossless representation of a parsed field.
name and value contain the interpreted field pair, while raw preserves the source representation. span and diagnostics are optional metadata collected by parsers that keep source locations.
BibInternal.RequiredField — Type
RequiredField(name)A single required field in an entry rule.
BibInternal.RuleContext — Type
RuleContextContext passed to validate_rule. Custom rule packages can extend validate_rule(rule, fields, context) for their own AbstractBibliographyRule subtype.
BibInternal.RuleProfile — Type
RuleProfileNamed and versioned set of composable bibliography rules. A nothing supported_entry_types value means that the profile accepts every entry type; it is used for product or institution overlays.
BibInternal.SourceSpan — Type
SourceSpanOptional source location for raw bibliography content and diagnostics. The span uses 1-based inclusive coordinates.
BibInternal.ValidationResult — Type
ValidationResultResult of validating one entry or a bibliography document. ok is true when no diagnostic has diagnostic_error severity.
Base.isless — Method
Base.isless(a::BibInternal.Date,b::BibInternal.Date)::BoolFunction to check for a < b on BibInternal.Date data types.
This function will throw an ArgumentError if the year can not parsed into Int. If it is not possible to parse month or day to Int those entries will be silently ignored for comparison. This function will not check if the date fields are given in a correct format all fields are parsed into and compared as Int (no checking if date format is correct or valid!).
Base.isless — Method
Base.isless(a::BibInternal.Name,b::BibInternal.Name)::BoolFunction to check for a < b on BibInternal.Name data types.
This function will check the fields last, first and middle in this order of priority. The other fields are ignored for now. The field comparison is done by string comparison no advanced alphabetizing rules are used for now.
BibInternal.arxive_url — Method
arxive_url(fields::Fields)Make an arxiv url from an eprint entry. Work with both old and current arxiv BibTeX format.
BibInternal.canonical — Method
canonical(entry)Return the canonical Entry view of an entry-like object.
BibInternal.canonical_field_specs — Method
canonical_field_specs()Return the canonical field catalog in stable display order.
BibInternal.check_entry — Method
check_entry(fields::Fields)Check the validity of the fields of a BibTeX entry.
BibInternal.compose_profiles — Method
compose_profiles(profiles...; name)Compose format, product, and institution profiles. Constraints accumulate. Conflicts are retained as error diagnostics on the resulting profile rather than being resolved through precedence.
BibInternal.diagnostics — Method
diagnostics(entry)Return the diagnostics attached to a lossless entry or document.
BibInternal.entry_fields — Method
entry_fields(entry::Entry)Convert a canonical Entry back into a flat field dictionary. This is the bridge used by validation and format conversion code.
BibInternal.erase_spaces — Method
erase_spaces(str::String)Erase extra spaces, i.e. r"[ ]+", from str and return a new string.
BibInternal.field_spec — Method
field_spec(name)Return the canonical specification for name, or nothing for a source-specific extra field.
BibInternal.get_delete! — Method
get_delete!(fields::Fields, key::String)Get the value of a field and delete it afterward.
BibInternal.handle_validation — Method
handle_validation(result::ValidationResult, level)Apply a validation policy. :error raises on errors, :warn logs warnings, and :none returns the result untouched.
BibInternal.make_biblatex_entry — Method
make_biblatex_entry(id::String, fields::Fields; check = :error)Make an entry using BibLaTeX field aliases and date conventions while preserving source-specific fields that are not part of the canonical view.
BibInternal.make_bibtex_entry — Method
make_bibtex_entry(id::String, fields::Fields)Make an entry if the entry follows the BibTeX guidelines. Throw an error otherwise.
BibInternal.names — Method
names(str::String)Decompose into parts a list of names in BibTeX compatible format. That is names separated by and.
BibInternal.profile_field_names — Method
profile_field_names(profile, entry_type)Return fields made available by the profile for an entry type. Custom fields remain legal unless a profile explicitly forbids them.
BibInternal.profile_rules — Method
profile_rules(profile, entry_type)Return global rules followed by rules for the normalized entry type.
BibInternal.raw — Method
raw(entry)Return the raw source representation attached to a lossless entry.
BibInternal.space — Method
space(field::Symbol)Return the amount of spaces needed to export entries, for instance to BibTeX format.
BibInternal.validate — Function
validate(entry::LosslessEntry, ruleset::EntryRuleSet = BIBTEX_RULESET)Validate the canonical view of a lossless entry.
BibInternal.validate — Function
validate(entry::Entry, ruleset::EntryRuleSet = BIBTEX_RULESET)Validate a canonical entry against a ruleset.
BibInternal.validate — Method
validate(document::BibliographyDocument, ruleset::EntryRuleSet)Validate every entry stored in a lossless bibliography document.
BibInternal.validate_fields — Method
validate_fields(fields::AbstractDict, ruleset::EntryRuleSet; id::AbstractString = "")Validate one field dictionary against a ruleset and return structured diagnostics. The input dictionary can come from a parser or from a canonical entry converted back to fields.
BibInternal.validate_fields — Method
validate_fields(fields, profile; id="")Validate one entry against a composed rule profile.