summaryrefslogtreecommitdiff
path: root/src/text.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/text.rs')
-rw-r--r--src/text.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/text.rs b/src/text.rs
new file mode 100644
index 0000000..e9dbdeb
--- /dev/null
+++ b/src/text.rs
@@ -0,0 +1,30 @@
+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,
+}