biblatex icon indicating copy to clipboard operation
biblatex copied to clipboard

Extract all keys from a bibfile to store them in var/vec/...

Open lukeflo opened this issue 5 months ago • 0 comments

Hey,

first of all, it is totally possible that I'm missing out on something. If thats the case, I'm sorry ;-)

I'm trying to get only the citekeys of all BibTeX entries. When I parse a file and print its whole content to stdout there is kind of an indexed array at the end containing all the keys. E.g.:

use std::fs;

use biblatex::{self, Bibliography};

fn main() {
    let bibfile = fs::read_to_string("test.bib").unwrap();
    let bibliography = Bibliography::parse(&bibfile).unwrap();
    println!("{:?}", bibliography);
}

will output this (full entries cut off):

, keys: {"grandsire_the_metafonttutorial_2004": 1, "gruber_markdown": 2, "how_tex_macros_actually_work": 0, "skibinski_automated_jats_xml_to_pdf_conversion_2018": 3}

As far as I can see, there is no struct or implementation to extract all (only) citekeys from the parsed bibfile. Of course, I can extract the keys on my own using some kind of regex pattern matching etc. But I was wondering if such a functionality is missing (and would then pledge for implementing it) or if I just overlooked something very obvious...

Thanks

lukeflo avatar Sep 13 '24 12:09 lukeflo