diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-05-13 13:52:52 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-05-13 13:52:52 +0200 |
| commit | 11f1f0818b990be1ed4a16652b7f30bf11159237 (patch) | |
| tree | b52fc6063d8bdec3937ec384cc44ee7a616e51e4 /src/library | |
| parent | 3e9c63d685a6ff05a72e5a07d40216ff0ac6ae32 (diff) | |
Pass language to raw show rule
Diffstat (limited to 'src/library')
| -rw-r--r-- | src/library/math/mod.rs | 2 | ||||
| -rw-r--r-- | src/library/structure/heading.rs | 2 | ||||
| -rw-r--r-- | src/library/structure/list.rs | 2 | ||||
| -rw-r--r-- | src/library/structure/table.rs | 2 | ||||
| -rw-r--r-- | src/library/text/deco.rs | 2 | ||||
| -rw-r--r-- | src/library/text/link.rs | 2 | ||||
| -rw-r--r-- | src/library/text/mod.rs | 4 | ||||
| -rw-r--r-- | src/library/text/raw.rs | 10 |
8 files changed, 15 insertions, 11 deletions
diff --git a/src/library/math/mod.rs b/src/library/math/mod.rs index 9709c00c..ad01f28a 100644 --- a/src/library/math/mod.rs +++ b/src/library/math/mod.rs @@ -40,7 +40,7 @@ impl Show for MathNode { Self { formula: self.formula.clone(), ..*self }.pack() } - fn encode(&self) -> Dict { + fn encode(&self, _: StyleChain) -> Dict { dict! { "formula" => Value::Str(self.formula.clone()), "display" => Value::Bool(self.display) diff --git a/src/library/structure/heading.rs b/src/library/structure/heading.rs index 468757ad..70589de0 100644 --- a/src/library/structure/heading.rs +++ b/src/library/structure/heading.rs @@ -68,7 +68,7 @@ impl Show for HeadingNode { Self { body: self.body.unguard(sel), ..*self }.pack() } - fn encode(&self) -> Dict { + fn encode(&self, _: StyleChain) -> Dict { dict! { "level" => Value::Int(self.level.get() as i64), "body" => Value::Content(self.body.clone()), diff --git a/src/library/structure/list.rs b/src/library/structure/list.rs index fca7d5ce..6bcc9f3e 100644 --- a/src/library/structure/list.rs +++ b/src/library/structure/list.rs @@ -86,7 +86,7 @@ impl<const L: ListKind> Show for ListNode<L> { .pack() } - fn encode(&self) -> Dict { + fn encode(&self, _: StyleChain) -> Dict { dict! { "start" => Value::Int(self.start as i64), "tight" => Value::Bool(self.tight), diff --git a/src/library/structure/table.rs b/src/library/structure/table.rs index 304a8681..b983a7ea 100644 --- a/src/library/structure/table.rs +++ b/src/library/structure/table.rs @@ -60,7 +60,7 @@ impl Show for TableNode { .pack() } - fn encode(&self) -> Dict { + fn encode(&self, _: StyleChain) -> Dict { dict! { "cells" => Value::Array( self.cells 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, + }, } } |
