summaryrefslogtreecommitdiff
path: root/src/library/text
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-05-13 13:52:52 +0200
committerLaurenz <laurmaedje@gmail.com>2022-05-13 13:52:52 +0200
commit11f1f0818b990be1ed4a16652b7f30bf11159237 (patch)
treeb52fc6063d8bdec3937ec384cc44ee7a616e51e4 /src/library/text
parent3e9c63d685a6ff05a72e5a07d40216ff0ac6ae32 (diff)
Pass language to raw show rule
Diffstat (limited to 'src/library/text')
-rw-r--r--src/library/text/deco.rs2
-rw-r--r--src/library/text/link.rs2
-rw-r--r--src/library/text/mod.rs4
-rw-r--r--src/library/text/raw.rs10
4 files changed, 11 insertions, 7 deletions
diff --git a/src/library/text/deco.rs b/src/library/text/deco.rs
index 34c70720..dedaa6e8 100644
--- a/src/library/text/deco.rs
+++ b/src/library/text/deco.rs
@@ -45,7 +45,7 @@ impl<const L: DecoLine> Show for DecoNode<L> {
Self(self.0.unguard(sel)).pack()
}
- fn encode(&self) -> Dict {
+ fn encode(&self, _: StyleChain) -> Dict {
dict! { "body" => Value::Content(self.0.clone()) }
}
diff --git a/src/library/text/link.rs b/src/library/text/link.rs
index 9e933529..284f0b1f 100644
--- a/src/library/text/link.rs
+++ b/src/library/text/link.rs
@@ -36,7 +36,7 @@ impl Show for LinkNode {
.pack()
}
- fn encode(&self) -> Dict {
+ fn encode(&self, _: StyleChain) -> Dict {
dict! {
"url" => Value::Str(self.url.clone()),
"body" => match &self.body {
diff --git a/src/library/text/mod.rs b/src/library/text/mod.rs
index 80b036ac..ae7024e5 100644
--- a/src/library/text/mod.rs
+++ b/src/library/text/mod.rs
@@ -524,7 +524,7 @@ impl Show for StrongNode {
Self(self.0.unguard(sel)).pack()
}
- fn encode(&self) -> Dict {
+ fn encode(&self, _: StyleChain) -> Dict {
dict! { "body" => Value::Content(self.0.clone()) }
}
@@ -549,7 +549,7 @@ impl Show for EmphNode {
Self(self.0.unguard(sel)).pack()
}
- fn encode(&self) -> Dict {
+ fn encode(&self, _: StyleChain) -> Dict {
dict! { "body" => Value::Content(self.0.clone()) }
}
diff --git a/src/library/text/raw.rs b/src/library/text/raw.rs
index 6124359e..52cabe3d 100644
--- a/src/library/text/raw.rs
+++ b/src/library/text/raw.rs
@@ -52,10 +52,14 @@ impl Show for RawNode {
Self { text: self.text.clone(), ..*self }.pack()
}
- fn encode(&self) -> Dict {
+ fn encode(&self, styles: StyleChain) -> Dict {
dict! {
- "text" => Value::Str(self.text.clone()),
- "block" => Value::Bool(self.block)
+ "text" => Value::Str(self.text.clone()),
+ "block" => Value::Bool(self.block),
+ "lang" => match styles.get(Self::LANG) {
+ Some(lang) => Value::Str(lang.clone()),
+ None => Value::None,
+ },
}
}