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

citeworks-cff

Serde types for serialising and deserialising CFF (Citation File Format)

2 releases

0.1.1 Aug 31, 2022
0.1.0 Aug 13, 2022

#6 in #citation

21 downloads per month
Used in citeworks-cli

Apache-2.0

37KB
634 lines

Citeworks

Install cargo binstall citeworks-cli.

csl2cff

$ csl2cff bibli.json
- type: article
  authors:
  - family-names: Vaidya
    given-names: Nina
  - family-names: Solgaard
    given-names: Olav
  abstract: Complex optical devices including aspherical focusing mirrors, solar concentrator
    arrays, and immersion lenses were 3D printed using commercial technology and experimentally
    demonstrated by evaluating surface roughness and shape. The as-printed surfaces
    had surface roughness on the order of tens of microns. To improve this unacceptable
    surface quality for creating optics, a polymer smoothing technique was developed.
    Atomic force microscopy and optical profilometry showed that the smoothing technique
    reduced the surface roughness to a few nanometers, consistent with the requirements
    of high-quality optics, while tests of optical functionality demonstrated that
    the overall shapes were maintained so that near theoretically predicted operation
    was achieved. The optical surface smoothing technique is a promising approach
    towards using 3D printing as a flexible tool for prototyping and fabrication of
    miniaturized high-quality optics.
  collection-title: Microsystems & Nanoengineering
  copyright: 2018 The Author(s)
  database: www.nature.com
  date-accessed: 2022-08-12
  doi: 10.1038/s41378-018-0015-4
  start: 1
  end: 8
  issn: 2055-7434
  issue: '1'
  issue-date: 2018-07-16
  journal: Microsyst Nanoeng
  languages:
  - en
  title: 3D printed optics with nanometer scale surface roughness
  url: https://www.nature.com/articles/s41378-018-0015-4
  volume: 4

Append to CITATION.cff's references:

$ csl2cff bibli.json --insert CITATION.cff

Replace the whole references list:

$ csl2cff bibli.json --replace CITATION.cff

Félix Saparelli (:passcod)

License: Apache 2.0.


lib.rs:

Citation File Format serde types and implementations.

This targets CFF 1.2.0 but may not support the entire specification.

The top level API mimics [serde_yaml]'s:

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")
);

Dependencies

~5.5MB
~129K SLoC