diff options
Diffstat (limited to 'src/library')
| -rw-r--r-- | src/library/mod.rs | 2 | ||||
| -rw-r--r-- | src/library/text.rs | 20 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/library/mod.rs b/src/library/mod.rs index 44f8f947..3115cc7a 100644 --- a/src/library/mod.rs +++ b/src/library/mod.rs @@ -93,6 +93,8 @@ pub fn new() -> Scope { std.def_class::<ParbreakNode>("parbreak"); std.def_class::<LinebreakNode>("linebreak"); std.def_class::<TextNode>("text"); + std.def_class::<StrongNode>("strong"); + std.def_class::<EmphNode>("emph"); std.def_class::<DecoNode<Underline>>("underline"); std.def_class::<DecoNode<Strikethrough>>("strike"); std.def_class::<DecoNode<Overline>>("overline"); diff --git a/src/library/text.rs b/src/library/text.rs index b8810ac6..6d7be323 100644 --- a/src/library/text.rs +++ b/src/library/text.rs @@ -150,6 +150,26 @@ impl Debug for TextNode { } } +/// Strong text, rendered in boldface. +pub struct StrongNode; + +#[class] +impl StrongNode { + fn construct(_: &mut EvalContext, args: &mut Args) -> TypResult<Node> { + Ok(args.expect::<Node>("body")?.styled(TextNode::STRONG, true)) + } +} + +/// Emphasized text, rendered with an italic face. +pub struct EmphNode; + +#[class] +impl EmphNode { + fn construct(_: &mut EvalContext, args: &mut Args) -> TypResult<Node> { + Ok(args.expect::<Node>("body")?.styled(TextNode::EMPH, true)) + } +} + /// A generic or named font family. #[derive(Clone, Eq, PartialEq, Hash)] pub enum FontFamily { |
