Add configuration options
This commit is contained in:
parent
5d28a2e707
commit
270fed54f0
16 changed files with 272 additions and 83 deletions
|
|
@ -26,7 +26,7 @@ impl Display for Level {
|
|||
}
|
||||
}
|
||||
|
||||
pub(in crate::syntax::content) struct Header {
|
||||
pub struct Header {
|
||||
level: Level,
|
||||
text: String,
|
||||
}
|
||||
|
|
@ -70,6 +70,7 @@ impl Parseable for Header {
|
|||
format!("<h{}>{}</h{0}>", &self.level, self.text)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Header {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(f, "Level {} Header: <{}>", &self.level, self.text)
|
||||
|
|
|
|||
28
src/syntax/content/elements/span.rs
Normal file
28
src/syntax/content/elements/span.rs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
use std::fmt::Display;
|
||||
use crate::syntax::content::{Parseable, Lexeme};
|
||||
|
||||
pub struct Span {
|
||||
text: String,
|
||||
}
|
||||
|
||||
impl Parseable for Span {
|
||||
fn probe(lexeme: &Lexeme) -> bool {
|
||||
!lexeme.raw.trim().is_empty()
|
||||
}
|
||||
|
||||
fn lex(lexeme: &Lexeme) -> Self {
|
||||
Self {
|
||||
text: lexeme.raw.trim().to_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
fn render(&self) -> String {
|
||||
format!("<span>{}</span>", &self.text)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Span {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(f, "Span: <{}>", &self.text)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue