From 4f66907d08a8ed18b41e70188b112d7c915aa0bc Mon Sep 17 00:00:00 2001 From: Martin Haug Date: Tue, 14 Dec 2021 14:24:02 +0100 Subject: Add Code Block syntax highlighting --- src/library/deco.rs | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'src/library') diff --git a/src/library/deco.rs b/src/library/deco.rs index 3e91d1de..5f27c8be 100644 --- a/src/library/deco.rs +++ b/src/library/deco.rs @@ -38,6 +38,41 @@ pub struct Decoration { pub extent: Linear, } +impl Decoration { + /// Create a new underline with default settings. + pub const fn underline() -> Self { + Self { + line: DecoLine::Underline, + stroke: None, + thickness: None, + offset: None, + extent: Linear::zero(), + } + } + + /// Create a new strikethrough with default settings. + pub const fn strikethrough() -> Self { + Self { + line: DecoLine::Underline, + stroke: None, + thickness: None, + offset: None, + extent: Linear::zero(), + } + } + + /// Create a new overline with default settings. + pub const fn overline() -> Self { + Self { + line: DecoLine::Overline, + stroke: None, + thickness: None, + offset: None, + extent: Linear::zero(), + } + } +} + /// The kind of decorative line. #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum DecoLine { @@ -49,7 +84,7 @@ pub enum DecoLine { Overline, } -/// Differents kinds of decorative lines for text. +/// Different kinds of decorative lines for text. pub trait LineKind { const LINE: DecoLine; } -- cgit v1.2.3 From c183ed3c15110e11bffd40fad5c5fdfb4d1a5814 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 27 Jan 2022 23:07:10 +0100 Subject: Mutex comes from tex and we don't want any --- src/library/deco.rs | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) (limited to 'src/library') diff --git a/src/library/deco.rs b/src/library/deco.rs index 5f27c8be..ccb657d1 100644 --- a/src/library/deco.rs +++ b/src/library/deco.rs @@ -38,33 +38,10 @@ pub struct Decoration { pub extent: Linear, } -impl Decoration { - /// Create a new underline with default settings. - pub const fn underline() -> Self { +impl From for Decoration { + fn from(line: DecoLine) -> Self { Self { - line: DecoLine::Underline, - stroke: None, - thickness: None, - offset: None, - extent: Linear::zero(), - } - } - - /// Create a new strikethrough with default settings. - pub const fn strikethrough() -> Self { - Self { - line: DecoLine::Underline, - stroke: None, - thickness: None, - offset: None, - extent: Linear::zero(), - } - } - - /// Create a new overline with default settings. - pub const fn overline() -> Self { - Self { - line: DecoLine::Overline, + line, stroke: None, thickness: None, offset: None, -- cgit v1.2.3