diff options
| author | Emil Walser <emil.walser+github@gmail.com> | 2023-05-01 18:42:38 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-01 18:42:38 +0200 |
| commit | 021694de239ca5d6d799dde98423036bb1da405e (patch) | |
| tree | cb987eb9536efa239d39f7393f1e6c17e3380b81 /library/src | |
| parent | b41cce191ca792e4622d859f3f8b84d45f9e070c (diff) | |
Add `.yaml` to supported bib file exts and update uknown bib format message (#1064)
Diffstat (limited to 'library/src')
| -rw-r--r-- | library/src/meta/bibliography.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/library/src/meta/bibliography.rs b/library/src/meta/bibliography.rs index 1e922c42..c3046dfc 100644 --- a/library/src/meta/bibliography.rs +++ b/library/src/meta/bibliography.rs @@ -614,19 +614,21 @@ fn load( } } -/// Parse a bibliography file (bib/yml) +/// Parse a bibliography file (bib/yml/yaml) fn parse_bib(path_str: &str, src: &str) -> StrResult<Vec<hayagriva::Entry>> { let path = Path::new(path_str); let ext = path.extension().and_then(OsStr::to_str).unwrap_or_default(); match ext.to_lowercase().as_str() { - "yml" => hayagriva::io::from_yaml_str(src).map_err(format_hayagriva_error), + "yml" | "yaml" => { + hayagriva::io::from_yaml_str(src).map_err(format_hayagriva_error) + } "bib" => hayagriva::io::from_biblatex_str(src).map_err(|err| { err.into_iter() .next() .map(|error| format_biblatex_error(path_str, src, error)) .unwrap_or_else(|| eco_format!("failed to parse {path_str}")) }), - _ => Err("unknown bibliography format".into()), + _ => Err("unknown bibliography format (must be .yml/.yaml or .bib)".into()), } } |
