31 lines
988 B
Rust
31 lines
988 B
Rust
pub enum Text {
|
|
Normal(String),
|
|
Bold(String),
|
|
Italic(String),
|
|
BoldItalic(String),
|
|
Code(String),
|
|
WikiLink(String),
|
|
Hyperlink(Hyperlink),
|
|
}
|
|
impl std::fmt::Debug for Text {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
|
|
let string = match self {
|
|
Text::Normal(text) => format!("Normal ('{}')", text),
|
|
Text::Bold(text) => format!("Bold ('{}')", text),
|
|
Text::Italic(text) => format!("Italic ('{}')", text),
|
|
Text::BoldItalic(text) => format!("BoldItalic ('{}')", text),
|
|
Text::Code(text) => format!("Code ('{}')", text),
|
|
Text::WikiLink(text) => format!("WikiLink ('{}')", text),
|
|
Text::Hyperlink(Hyperlink { label, target }) => {
|
|
format!("Hyperlink (label:'{}', target:'{}')", label, target)
|
|
}
|
|
};
|
|
f.write_str(&string)
|
|
}
|
|
}
|
|
|
|
pub struct Hyperlink {
|
|
pub label: String,
|
|
pub target: String,
|
|
}
|