diff options
author | NerdyPepper <[email protected]> | 2018-06-28 16:36:06 +0100 |
---|---|---|
committer | NerdyPepper <[email protected]> | 2018-06-28 16:36:06 +0100 |
commit | 95039a0abc39dcc8cfe6b9f8f5d59f0b86021f75 (patch) | |
tree | 0e7734ceb8b76729d35ad8bf6ae245b10cad681c /src | |
parent | 07412986834f08ce3a70878a332ec2e81d836b86 (diff) |
Add support for sub-sub-headings
Diffstat (limited to 'src')
-rw-r--r-- | src/content.rs | 7 | ||||
-rw-r--r-- | src/gui.rs | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/content.rs b/src/content.rs index 18b39f7..6492431 100644 --- a/src/content.rs +++ b/src/content.rs | |||
@@ -70,6 +70,7 @@ pub fn extract_formatter(extract: String) -> StyledString { | |||
70 | 70 | ||
71 | let heading= Regex::new(r"^== (?P<d>.*) ==$").unwrap(); | 71 | let heading= Regex::new(r"^== (?P<d>.*) ==$").unwrap(); |
72 | let subheading= Regex::new(r"^=== (?P<d>.*) ===$").unwrap(); | 72 | let subheading= Regex::new(r"^=== (?P<d>.*) ===$").unwrap(); |
73 | let subsubheading= Regex::new(r"^==== (?P<d>.*) ====$").unwrap(); | ||
73 | 74 | ||
74 | for line in extract.lines() { | 75 | for line in extract.lines() { |
75 | if heading.is_match(line) { | 76 | if heading.is_match(line) { |
@@ -84,6 +85,12 @@ pub fn extract_formatter(extract: String) -> StyledString { | |||
84 | subheading.replace(line, "$d"), Effect::Italic | 85 | subheading.replace(line, "$d"), Effect::Italic |
85 | ) | 86 | ) |
86 | ); | 87 | ); |
88 | } else if subsubheading.is_match(line) { | ||
89 | formatted.append( | ||
90 | StyledString::styled( | ||
91 | subsubheading.replace(line, "$d"), Effect::Underline | ||
92 | ) | ||
93 | ); | ||
87 | } else { | 94 | } else { |
88 | formatted.append(StyledString::plain(line)); | 95 | formatted.append(StyledString::plain(line)); |
89 | } | 96 | } |
diff --git a/src/gui.rs b/src/gui.rs new file mode 100644 index 0000000..ec2302c --- /dev/null +++ b/src/gui.rs | |||
@@ -0,0 +1,9 @@ | |||
1 | extern crate cursive; | ||
2 | |||
3 | use cursive::Cursive; | ||
4 | use cursive::traits::*; | ||
5 | use cursive::views::{TextView, Dialog, LinearLayout, Button}; | ||
6 | |||
7 | fn draw_content(s: &mut Cursive) { | ||
8 | |||
9 | } | ||