diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-12-22 18:25:29 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-12-22 18:25:29 +0100 |
| commit | 8527517258cf62a2f229796cc3f118d8bf0494b6 (patch) | |
| tree | 7662e90bcb9d610e63f4b1a9f1f12f84cb1f742a /library/src/layout | |
| parent | 947522b71aa6220ce8f006bfab4700d6e3cb04f1 (diff) | |
Rename `desc` to `terms`
Diffstat (limited to 'library/src/layout')
| -rw-r--r-- | library/src/layout/mod.rs | 18 | ||||
| -rw-r--r-- | library/src/layout/page.rs | 50 |
2 files changed, 31 insertions, 37 deletions
diff --git a/library/src/layout/mod.rs b/library/src/layout/mod.rs index bd4b0430..67b53e1b 100644 --- a/library/src/layout/mod.rs +++ b/library/src/layout/mod.rs @@ -40,7 +40,7 @@ use typst::model::{ StyleVecBuilder, StyledNode, }; -use crate::basics::{DescItem, DescNode, EnumNode, ListNode}; +use crate::basics::{EnumNode, ListNode, TermItem, TermsNode}; use crate::meta::DocumentNode; use crate::prelude::*; use crate::shared::BehavedBuilder; @@ -418,7 +418,7 @@ impl<'a, 'v, 't> Builder<'a, 'v, 't> { self.interrupt_par()?; } else if map.interruption::<ListNode>().is_some() || map.interruption::<EnumNode>().is_some() - || map.interruption::<DescNode>().is_some() + || map.interruption::<TermsNode>().is_some() { self.interrupt_list()?; } @@ -519,7 +519,7 @@ impl<'a> FlowBuilder<'a> { node.tight } else if let Some(node) = content.to::<EnumNode>() { node.tight - } else if let Some(node) = content.to::<DescNode>() { + } else if let Some(node) = content.to::<TermsNode>() { node.tight } else { false @@ -621,10 +621,10 @@ impl<'a> ListBuilder<'a> { }), } .pack(), - ListItem::Desc(_) => DescNode { + ListItem::Term(_) => TermsNode { tight: self.tight, items: items.map(|item| match item { - ListItem::Desc(item) => item.clone(), + ListItem::Term(item) => item.clone(), _ => panic!("wrong list item"), }), } @@ -648,12 +648,12 @@ impl Default for ListBuilder<'_> { #[capable] #[derive(Debug, Clone, Hash)] pub enum ListItem { - /// An item of an unordered list. + /// An item of a bullet list. List(Content), - /// An item of an ordered list. + /// An item of a numbered list. Enum(Option<NonZeroUsize>, Content), - /// An item of a description list. - Desc(DescItem), + /// An item of a term list. + Term(TermItem), } #[node] diff --git a/library/src/layout/page.rs b/library/src/layout/page.rs index c1ac6118..beedf4c5 100644 --- a/library/src/layout/page.rs +++ b/library/src/layout/page.rs @@ -125,17 +125,15 @@ impl PageNode { /// # Example /// ``` /// #set page(columns: 2, height: 4.8cm) - /// Climate change is one of the - /// most pressing issues of our - /// time, with the potential to - /// devastate communities, - /// ecosystems, and economies - /// around the world. It's clear - /// that we need to take urgent + /// Climate change is one of the most + /// pressing issues of our time, with + /// the potential to devastate + /// communities, ecosystems, and + /// economies around the world. It's + /// clear that we need to take urgent /// action to reduce our carbon - /// emissions and mitigate the - /// impacts of a rapidly changing - /// climate. + /// emissions and mitigate the impacts + /// of a rapidly changing climate. /// ``` pub const COLUMNS: NonZeroUsize = NonZeroUsize::new(1).unwrap(); @@ -191,13 +189,13 @@ impl PageNode { /// ``` /// #set par(justify: true) /// #set page( - /// margin: (x: 24pt, y: 32pt), - /// footer: i => align(horizon + right, - /// text(8pt, numbering("I", i)) - /// ) + /// margin: (x: 24pt, y: 32pt), + /// footer: i => align(horizon + right, + /// text(8pt, numbering("I", i)) /// ) + /// ) /// - /// #lorem(18) + /// #lorem(18) /// ``` #[property(referenced)] pub const FOOTER: Marginal = Marginal::None; @@ -209,14 +207,12 @@ impl PageNode { /// /// # Example /// ``` - /// #set page( - /// background: align( - /// center + horizon, - /// rotate(24deg, - /// text(18pt, fill: rgb("FFCBC4"))[*CONFIDENTIAL*] - /// ) + /// #set page(background: align( + /// center + horizon, + /// rotate(24deg, + /// text(18pt, fill: rgb("FFCBC4"))[*CONFIDENTIAL*] /// ), - /// ) + /// )) /// /// = Typst's secret plans /// @@ -232,12 +228,10 @@ impl PageNode { /// /// # Example /// ``` - /// #set page( - /// foreground: align( - /// center + horizon, - /// text(24pt)[🥸] - /// ), - /// ) + /// #set page(foreground: align( + /// center + horizon, + /// text(24pt)[🥸], + /// )) /// /// Reviewer 2 has marked our paper /// "Weak Reject" because they did |
