Skip to main content

detect_and_parse

Function detect_and_parse 

Source
pub fn detect_and_parse(
    content: &str,
) -> Result<(Vec<Citation>, CitationFormat), CitationError>
Expand description

Format detection and automatic parsing of citation files

§Arguments

  • content - The content of the file to parse

§Returns

A Result containing a vector of parsed Citations and the detected format, or a CitationError if parsing fails

§Examples

use biblib::detect_and_parse;

let content = r#"TY  - JOUR
TI  - Example Title
ER  -"#;

let (citations, format) = detect_and_parse(content).unwrap();
assert_eq!(format.as_str(), "RIS");
assert_eq!(citations[0].title, "Example Title");