GithubHelp home page GithubHelp logo

derdrodt / biblatex Goto Github PK

View Code? Open in Web Editor NEW

This project forked from typst/biblatex

0.0 0.0 0.0 339 KB

A Rust crate for parsing and writing BibTeX and BibLaTeX files.

License: Apache License 2.0

Rust 54.17% TeX 45.83%

biblatex's Introduction

BibLaTeX

Build status Current crates.io release Documentation

A Rust crate for parsing and writing BibTeX and BibLaTeX files.

BibLaTeX can help you to parse .bib bibliography files. As opposed to other available crates, this crate attempts to parse the data within the fields into easily usable structs and enums like Person and Date for downstream consumption.

Usage

Add this to your Cargo.toml:

[dependencies]
biblatex = "0.9"

Parsing a bibliography and getting the author of an item is as simple as:

let src = "@book{tolkien1937, author = {J. R. R. Tolkien}}";
let bibliography = Bibliography::parse(src).unwrap();
let entry = bibliography.get("tolkien1937").unwrap();
let author = entry.author().unwrap();
assert_eq!(author[0].name, "Tolkien");

This library operates on a Bibliography struct, which is a collection of entries (the items in your .bib file that start with an @ and are wrapped in curly braces). The entries may hold multiple fields. Entries have getter methods for each of the possible fields in a Bib(La)TeX file which handle possible field aliases, composition and type conversion automatically.

Refer to the WikiBook section on LaTeX bibliography management and the BibLaTeX package manual to learn more about the intended meaning of each of the fields.

The generated documentation more specifically describes the selection and behavior of the getters but generally, they follow the convention of being the snake-case name of the corresponding field (such that the getter for booktitleaddon is named book_title_addon).

Limitations

This library attempts to provide fairly comprehensive coverage of the BibLaTeX spec with which most of the .bib files in circulation can be processed.

However, the crate currently has some limitations:

  • There is no explicit support for entry sets, although it is easy to account for them by manually getting the entryset field and calling parse::<Vec<String>>() on it

biblatex's People

Contributors

ariroffe avatar bamonroe avatar cgmossa avatar constraintautomaton avatar dependabot[bot] avatar laurmaedje avatar mutlusun avatar pjhuxford avatar reknih avatar violetfauna avatar yuxqiu avatar zepinglee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.