diff --git a/docs/manual.pdf b/docs/manual.pdf index 63dd041..dd2558a 100644 Binary files a/docs/manual.pdf and b/docs/manual.pdf differ diff --git a/plugin/src/lib.rs b/plugin/src/lib.rs index 8ef0eb1..a24ff38 100644 --- a/plugin/src/lib.rs +++ b/plugin/src/lib.rs @@ -193,18 +193,18 @@ fn read_impl(config: Config) -> Result { .into_iter() .map(|reference| { let key = reference.key; - let prefix = reference.first_field; - let reference = reference.content; + let first_field = reference.first_field; + let content = reference.content; let details = entries .get(&key) .cloned() .expect("key has been found before but not anymore"); - Entry { + Reference { key, - prefix, - reference, + first_field, + content, details, } }) diff --git a/plugin/src/model.rs b/plugin/src/model.rs index a936831..42ab29b 100644 --- a/plugin/src/model.rs +++ b/plugin/src/model.rs @@ -41,7 +41,7 @@ pub struct Citation { #[derive(Serialize, Debug, Clone, PartialEq)] #[serde(rename_all = "kebab-case")] pub struct Bibliography { - pub references: Vec, + pub references: Vec, #[serde(serialize_with = "wrapper::ser_wrapped_seq")] pub citations: Vec, pub hanging_indent: bool, @@ -49,12 +49,12 @@ pub struct Bibliography { #[derive(Serialize, Debug, Clone, PartialEq)] #[serde(rename_all = "kebab-case")] -pub struct Entry { +pub struct Reference { pub key: String, #[serde(serialize_with = "wrapper::ser_wrapped_option")] - pub prefix: Option, + pub first_field: Option, #[serde(serialize_with = "wrapper::ser_wrapped")] - pub reference: ElemChildren, + pub content: ElemChildren, pub details: hayagriva::Entry, } diff --git a/src/alexandria.wasm b/src/alexandria.wasm index bb37d75..7a0338d 100755 Binary files a/src/alexandria.wasm and b/src/alexandria.wasm differ diff --git a/src/lib.typ b/src/lib.typ index 23aa834..3256eba 100644 --- a/src/lib.typ +++ b/src/lib.typ @@ -230,15 +230,14 @@ /// - `hanging-indent`: a boolean indicating whether the citation style uses a hanging indent for /// its entries. /// -/// The `references` in turn each contain -/// - `key`: the reference key without prefix. -/// - `reference`: a representation of the Typst content that should be rendered; this is processed -/// by @@render-bibliography() to produce the actual context. -/// - optionally `prefix`: this is _not_ the Alexandria prefix but another Typst content -/// representation for styles that require it. For example, in IEEE style this would represent -/// "[1]" and so on. -/// - `details`: a dictionary containing several fields of structured data about the reference. -/// Among these are `type`, `title`, `author`, `date`, etc. A full list can be found in the +/// The elements of the `references` array have the following fields: +/// - `key`: the original bibliography key (without Alexandria's prefix). +/// - `content`: a Typst representation of the bibliographical entry; used by +/// @@render-bibliography() for rendering bibliographical items. +/// - optional `first-field`: Typst content for certain bibliography styles. For example, +/// in IEEE style it represents "[1]", "[2]", etc. +/// - `details`: a dictionary containing information about this reference, including +/// `type`, `title`, `author`, and `date` fields. The full list can be found in the /// #link("https://github.com/typst/hayagriva/blob/main/docs/file-format.md")[Hayagriva docs]. /// /// The `citations` are representations of the Typst content that should be rendered at their @@ -288,7 +287,7 @@ set par(hanging-indent: 1.5em) if bib.hanging-indent - if bib.references.any(e => e.prefix != none) { + if bib.references.any(e => e.first-field != none) { grid( columns: 2, // rows: (), @@ -303,11 +302,11 @@ ( { [#metadata(none)#label(bib.prefix + e.key)] - if e.prefix != none { - hayagriva.render(e.prefix) + if e.first-field != none { + hayagriva.render(e.first-field) } }, - hayagriva.render(e.reference), + hayagriva.render(e.content), ) }, ) @@ -316,7 +315,7 @@ for (i, e) in bib.references.enumerate() { if i != 0 { gutter } [#metadata(none)#label(bib.prefix + e.key)] - hayagriva.render(e.reference) + hayagriva.render(e.content) } } }