diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-12-02 13:48:45 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2024-12-04 10:12:07 +0100 |
| commit | 497446944c78bcf598e8ac8dcdff6c0d0433d844 (patch) | |
| tree | db5c3cfdf09746f41bb85999da9b4dfd5e1afac0 /crates/typst-library/src/model/document.rs | |
| parent | d00a5d6c9b35e4a340be8df18a11943e3591b86a (diff) | |
Add `document.description` field
Diffstat (limited to 'crates/typst-library/src/model/document.rs')
| -rw-r--r-- | crates/typst-library/src/model/document.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/typst-library/src/model/document.rs b/crates/typst-library/src/model/document.rs index c333dff3..5124b248 100644 --- a/crates/typst-library/src/model/document.rs +++ b/crates/typst-library/src/model/document.rs @@ -37,6 +37,10 @@ pub struct DocumentElem { #[ghost] pub author: Author, + /// The document's description. + #[ghost] + pub description: Option<Content>, + /// The document's keywords. #[ghost] pub keywords: Keywords, @@ -91,6 +95,8 @@ pub struct DocumentInfo { pub title: Option<EcoString>, /// The document's author. pub author: Vec<EcoString>, + /// The document's description. + pub description: Option<EcoString>, /// The document's keywords. pub keywords: Vec<EcoString>, /// The document's creation date. @@ -111,6 +117,10 @@ impl DocumentInfo { if has(<DocumentElem as Fields>::Enum::Author) { self.author = DocumentElem::author_in(chain).0; } + if has(<DocumentElem as Fields>::Enum::Description) { + self.description = + DocumentElem::description_in(chain).map(|content| content.plain_text()); + } if has(<DocumentElem as Fields>::Enum::Keywords) { self.keywords = DocumentElem::keywords_in(chain).0; } |
