diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-09-26 15:39:32 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-09-26 16:12:57 +0200 |
| commit | 704f2fbaf1b4483caa12f249a222c49e44f08961 (patch) | |
| tree | 146f7813fe63409df2c1bbaa487731e992d3ac71 /src/library/text | |
| parent | 2661f1a5066bd5e3f8a9c68e4a5c304c248efcb7 (diff) | |
Description lists, link syntax, and new enum syntax
Diffstat (limited to 'src/library/text')
| -rw-r--r-- | src/library/text/link.rs | 7 | ||||
| -rw-r--r-- | src/library/text/par.rs | 4 | ||||
| -rw-r--r-- | src/library/text/raw.rs | 2 |
3 files changed, 10 insertions, 3 deletions
diff --git a/src/library/text/link.rs b/src/library/text/link.rs index c06fea55..78ae4d23 100644 --- a/src/library/text/link.rs +++ b/src/library/text/link.rs @@ -10,6 +10,13 @@ pub struct LinkNode { pub body: Option<Content>, } +impl LinkNode { + /// Create a link node from a URL with its bare text. + pub fn from_url(url: EcoString) -> Self { + Self { dest: Destination::Url(url), body: None } + } +} + #[node(showable)] impl LinkNode { /// The fill color of text in the link. Just the surrounding text color diff --git a/src/library/text/par.rs b/src/library/text/par.rs index 6910c23a..859a7c87 100644 --- a/src/library/text/par.rs +++ b/src/library/text/par.rs @@ -181,8 +181,8 @@ pub struct LinebreakNode; #[node] impl LinebreakNode { fn construct(_: &mut Vm, args: &mut Args) -> SourceResult<Content> { - let justified = args.named("justified")?.unwrap_or(false); - Ok(Content::Linebreak { justified }) + let justify = args.named("justify")?.unwrap_or(false); + Ok(Content::Linebreak { justify }) } } diff --git a/src/library/text/raw.rs b/src/library/text/raw.rs index e7c73a91..a64b1a92 100644 --- a/src/library/text/raw.rs +++ b/src/library/text/raw.rs @@ -91,7 +91,7 @@ impl Show for RawNode { let mut highlighter = HighlightLines::new(syntax, &THEME); for (i, line) in self.text.lines().enumerate() { if i != 0 { - seq.push(Content::Linebreak { justified: false }); + seq.push(Content::Linebreak { justify: false }); } for (style, piece) in |
