summaryrefslogtreecommitdiff
path: root/library/src/text
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-12-05 12:21:10 +0100
committerLaurenz <laurmaedje@gmail.com>2022-12-05 12:21:10 +0100
commit1d324235bd80fe8d1fb21b1e73ae9e3dfe918078 (patch)
tree342b3ad9f0ca40dbf6f51c2b29646ca6803fe85a /library/src/text
parent1bb05677faa7bd6566e1231ed2b16547f476b143 (diff)
Make show rule fallible again
Diffstat (limited to 'library/src/text')
-rw-r--r--library/src/text/deco.rs6
-rw-r--r--library/src/text/misc.rs8
-rw-r--r--library/src/text/raw.rs4
-rw-r--r--library/src/text/shift.rs11
4 files changed, 17 insertions, 12 deletions
diff --git a/library/src/text/deco.rs b/library/src/text/deco.rs
index 4c9f6dcd..a6fa490f 100644
--- a/library/src/text/deco.rs
+++ b/library/src/text/deco.rs
@@ -47,8 +47,8 @@ impl<const L: DecoLine> DecoNode<L> {
}
impl<const L: DecoLine> Show for DecoNode<L> {
- fn show(&self, _: &mut Vt, _: &Content, styles: StyleChain) -> Content {
- self.0.clone().styled(
+ fn show(&self, _: &mut Vt, _: &Content, styles: StyleChain) -> SourceResult<Content> {
+ Ok(self.0.clone().styled(
TextNode::DECO,
Decoration {
line: L,
@@ -57,7 +57,7 @@ impl<const L: DecoLine> Show for DecoNode<L> {
extent: styles.get(Self::EXTENT),
evade: styles.get(Self::EVADE),
},
- )
+ ))
}
}
diff --git a/library/src/text/misc.rs b/library/src/text/misc.rs
index c3897a8e..896c03ac 100644
--- a/library/src/text/misc.rs
+++ b/library/src/text/misc.rs
@@ -62,8 +62,8 @@ impl StrongNode {
}
impl Show for StrongNode {
- fn show(&self, _: &mut Vt, _: &Content, styles: StyleChain) -> Content {
- self.0.clone().styled(TextNode::DELTA, Delta(styles.get(Self::DELTA)))
+ fn show(&self, _: &mut Vt, _: &Content, styles: StyleChain) -> SourceResult<Content> {
+ Ok(self.0.clone().styled(TextNode::DELTA, Delta(styles.get(Self::DELTA))))
}
}
@@ -104,8 +104,8 @@ impl EmphNode {
}
impl Show for EmphNode {
- fn show(&self, _: &mut Vt, _: &Content, _: StyleChain) -> Content {
- self.0.clone().styled(TextNode::EMPH, Toggle)
+ fn show(&self, _: &mut Vt, _: &Content, _: StyleChain) -> SourceResult<Content> {
+ Ok(self.0.clone().styled(TextNode::EMPH, Toggle))
}
}
diff --git a/library/src/text/raw.rs b/library/src/text/raw.rs
index 9c04fedf..a043019a 100644
--- a/library/src/text/raw.rs
+++ b/library/src/text/raw.rs
@@ -56,7 +56,7 @@ impl Prepare for RawNode {
}
impl Show for RawNode {
- fn show(&self, _: &mut Vt, _: &Content, styles: StyleChain) -> Content {
+ fn show(&self, _: &mut Vt, _: &Content, styles: StyleChain) -> SourceResult<Content> {
let lang = styles.get(Self::LANG).as_ref().map(|s| s.to_lowercase());
let foreground = THEME
.settings
@@ -109,7 +109,7 @@ impl Show for RawNode {
map.set(TextNode::SMART_QUOTES, false);
map.set_family(FontFamily::new("IBM Plex Mono"), styles);
- realized.styled_with_map(map)
+ Ok(realized.styled_with_map(map))
}
}
diff --git a/library/src/text/shift.rs b/library/src/text/shift.rs
index 3419cc91..92e963e8 100644
--- a/library/src/text/shift.rs
+++ b/library/src/text/shift.rs
@@ -43,7 +43,12 @@ impl<const S: ShiftKind> ShiftNode<S> {
}
impl<const S: ShiftKind> Show for ShiftNode<S> {
- fn show(&self, vt: &mut Vt, _: &Content, styles: StyleChain) -> Content {
+ fn show(
+ &self,
+ vt: &mut Vt,
+ _: &Content,
+ styles: StyleChain,
+ ) -> SourceResult<Content> {
let mut transformed = None;
if styles.get(Self::TYPOGRAPHIC) {
if let Some(text) = search_text(&self.0, S) {
@@ -53,12 +58,12 @@ impl<const S: ShiftKind> Show for ShiftNode<S> {
}
};
- transformed.unwrap_or_else(|| {
+ Ok(transformed.unwrap_or_else(|| {
let mut map = StyleMap::new();
map.set(TextNode::BASELINE, styles.get(Self::BASELINE));
map.set(TextNode::SIZE, styles.get(Self::SIZE));
self.0.clone().styled_with_map(map)
- })
+ }))
}
}