Documentation ¶
Overview ¶
Package resolver transforms a Bibtex AST into complete bibtex entries, resolving cross references, parsing authors and editors, and normalizing page numbers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractAuthors ¶
func ExtractAuthors(txt *ast.ParsedText) (ast.Authors, error)
ExtractAuthors extracts the authors from the parsed text of a bibtex field, usually from the author or editor field of bibtex entry.
func SimplifyEscapedTextResolver ¶
SimplifyEscapedTextResolver replaces ast.TextEscaped nodes with a plain ast.Text containing the value that was escaped. Meaning, `\&` is converted to `&`.
Types ¶
type AuthorResolver ¶
type AuthorResolver struct {
// contains filtered or unexported fields
}
AuthorResolver extracts ast.Authors from the expression value of a tag statement.
func NewAuthorResolver ¶
func NewAuthorResolver(tags ...string) AuthorResolver
type Biber ¶
type Biber struct {
// contains filtered or unexported fields
}
Bibtex contains methods for parsing, resolving, and rendering bibtex.
func (*Biber) Resolve ¶
Resolve resolves all bibtex entries from an AST. The AST is a faithful representation of source code. By default, resolving the AST means replacing all abbreviation expressions with the value, inlining concatenation expressions, simplifying tag values by replacing TeX quote macros with Unicode graphemes, and stripping Tex macros.
The exact resolve steps are configurable using bibtex.WithResolvers.
type CiteKey ¶
type CiteKey = string
CiteKey is the citation key for a Bibtex entry, like the "foo" in:
@article{ foo }
type Entry ¶
type Entry struct { Type EntryType Key CiteKey // All tags in the entry with the corresponding expression value. Tags map[Field]ast.Expr }
Entry is a Bibtex entry, like an @article{} entry, that provides the rendered plain text of the entry.
type EntryType ¶
type EntryType = string
EntryType is the type of Bibtex entry. An "@article" entry is represented as "article". String alias to allow for unknown entries.
const ( EntryArticle EntryType = "article" EntryBook EntryType = "book" EntryBooklet EntryType = "booklet" EntryInBook EntryType = "inbook" EntryInCollection EntryType = "incollection" EntryInProceedings EntryType = "inproceedings" EntryManual EntryType = "manual" EntryMastersThesis EntryType = "mastersthesis" EntryMisc EntryType = "misc" EntryPhDThesis EntryType = "phdthesis" EntryProceedings EntryType = "proceedings" EntryTechReport EntryType = "techreport" EntryUnpublished EntryType = "unpublished" )
type Field ¶
type Field = string
Field is a single field in a Bibtex Entry.
const ( FieldAddress Field = "address" FieldAnnote Field = "annote" FieldAuthor Field = "author" FieldBookTitle Field = "booktitle" FieldChapter Field = "chapter" EntryDOI Field = "doi" FieldCrossref Field = "crossref" FieldEdition Field = "edition" FieldEditor Field = "editor" FieldHowPublished Field = "howpublished" FieldInstitution Field = "institution" FieldJournal Field = "journal" FieldKey Field = "key" FieldMonth Field = "month" FieldNote Field = "note" FieldNumber Field = "number" FieldOrganization Field = "organization" FieldPages Field = "pages" FieldPublisher Field = "publisher" FieldSchool Field = "school" FieldSeries Field = "series" FieldTitle Field = "title" FieldType Field = "type" FieldVolume Field = "volume" FieldYear Field = "year" )
type Option ¶
type Option func(*Biber)
Option is a functional option to change how Bibtex is parsed, resolved, and rendered.
func WithParserMode ¶
WithParserMode sets the parser options overwriting any previous parser options. parser.Mode is a bitflag so use bit-or for multiple flags like so:
WithParserMode(parser.ParserStrings|parser.Trace)
func WithRenderer ¶
func WithRenderer(kind ast.NodeKind, r render.NodeRendererFunc) Option
WithRenderer sets the renderer for the node kind, replacing the previous renderer.
func WithResolvers ¶
WithResolvers appends the resolvers to the list of resolvers. Resolvers run in the order given.
type RenderParsedTextResolver ¶
type RenderParsedTextResolver struct {
// contains filtered or unexported fields
}
RenderParsedTextResolver replaces ast.ParsedText with a simplified rendering of ast.Text.
func NewRenderParsedTextResolver ¶
func NewRenderParsedTextResolver() *RenderParsedTextResolver
Directories ¶
Path | Synopsis |
---|---|
Package ast declares the types used to represent syntax trees for bibtex files.
|
Package ast declares the types used to represent syntax trees for bibtex files. |
Packages asts contains utilities for constructing and manipulating ASTs.
|
Packages asts contains utilities for constructing and manipulating ASTs. |
This file contains the exported entry points for invoking the parser.
|
This file contains the exported entry points for invoking the parser. |
Package scanner implements a scanner for bibtex source text.
|
Package scanner implements a scanner for bibtex source text. |
Package token defines constants representing the lexical tokens of the bibtex language and basic operations on tokens (printing, predicates).
|
Package token defines constants representing the lexical tokens of the bibtex language and basic operations on tokens (printing, predicates). |