1 unstable release

Uses new Rust 2024

new 0.1.0 May 11, 2025

#4 in #formatted

Download history 90/week @ 2025-05-06

90 downloads per month

MIT/Apache

10KB
144 lines

BibLike

Convert the citation to any format.

Crate API

Example

use biblatex::{Bibliography, Entry};
use biblike::CitationManager;

let mut manager = CitationManager::open("tests/references.bib").unwrap();

let entry_fn = |key: &str, number: usize, entry: Option<&Entry>| -> String {
    if let Some(entry) = entry {
        let formatted = format!(
            "{} {}",
            entry.author().unwrap()[0].name,
            entry.title().unwrap()[0].v.get()
        );
        format!("[{}] {}\n", number, formatted)
    } else {
        format!("[{}] [Missing entry for key: {}]\n", number, key)
    }
};

let format_content = manager.render_content(
    "This is a test content \\cite{sample1999article} with \\cite{sample2099book, sample2025web}.\nSecond line \\cite{sample1999article}\n References\n\\printbibliography",
    "\\printbibliography",
    entry_fn,
);

assert_eq!(
    format_content,
    "This is a test content [1] with [2], [3].\nSecond line [1]\n References\n[1] Suzuki A Completely Fictional Study on the Effects of Imaginary Numbers\n[2] Yamada This is a Sample Book Title\n[3] Corporation Sample Blog Post: Talking to Imaginary Friends\n"
);

Dependencies

~2.2–3MB
~73K SLoC