summaryrefslogtreecommitdiff
path: root/src/library/style.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-12-04 19:34:29 +0100
committerLaurenz <laurmaedje@gmail.com>2019-12-04 19:35:28 +0100
commit9fb31defd037a90bf8f9e38fa33acae23a70b269 (patch)
treee0fd887792a59cbb3262a5d3157d0c786df56d60 /src/library/style.rs
parentace57c34206a13b4bc3885b944cc51e274f30b0f (diff)
Expand functionality of function! macro 🛰
Diffstat (limited to 'src/library/style.rs')
-rw-r--r--src/library/style.rs39
1 files changed, 0 insertions, 39 deletions
diff --git a/src/library/style.rs b/src/library/style.rs
deleted file mode 100644
index b2de19bb..00000000
--- a/src/library/style.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-use crate::func::prelude::*;
-use toddle::query::FontClass;
-
-macro_rules! stylefunc {
- ($ident:ident, $doc:expr) => (
- #[doc = $doc]
- #[derive(Debug, PartialEq)]
- pub struct $ident {
- body: Option<SyntaxTree>
- }
-
- function! {
- data: $ident,
-
- parse(args, body, ctx) {
- args.done()?;
- Ok($ident { body: parse!(optional: body, ctx) })
- }
-
- layout(this, ctx) {
- let mut style = ctx.style.text.clone();
- style.toggle_class(FontClass::$ident);
-
- Ok(match &this.body {
- Some(body) => vec![
- SetTextStyle(style),
- LayoutTree(body),
- SetTextStyle(ctx.style.text.clone()),
- ],
- None => vec![SetTextStyle(style)]
- })
- }
- }
- );
-}
-
-stylefunc!(Italic, "`italic`: Sets text in _italics_.");
-stylefunc!(Bold, "`bold`: Sets text in **bold**.");
-stylefunc!(Monospace, "`mono`: Sets text in `monospace`.");