#citeworks #file-format #citation #author #serde #url #cff

citeworks-cff

序列化和反序列化CFF(引用文件格式)的Serde类型

2个版本

0.1.1 2022年8月31日
0.1.0 2022年8月13日

#7 in #citation

每月24次下载
citeworks-cli 中使用

Apache-2.0

37KB
634

引用文件格式 serde类型和实现。

此版本针对CFF 1.2.0,但可能不支持整个规范。

顶级API模仿[serde_yaml]

let cff = citeworks_cff::from_str(r#"
cff-version: 1.2.0
message:
  If you dare use this commercial, closed-source, strangely versioned
  software in your research, please at least cite it as below.
authors:
  - family-names: Vader
    name-suffix: né Skywalker
    given-names: 'Anakin "Darth"'
  - name: anonymous
title: Opaquity
version: opq-1234-XZVF-ACME-RLY
date-released: 2017-02-28
url: http://www.opaquity.com/
contact:
  - name: Dark Side Software
    address: DS-1 Orbital Battle Station, near Scarif
    email: father@imperial-empire.com
    tel: +850 (0)123-45-666
"#).unwrap();

assert_eq!(
    cff
        .authors[0]
        .as_person()
        .and_then(|his| his.family_names.as_deref()),
    Some("Vader")
);

依赖关系

~5MB
~114K SLoC