diff options
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index 27b6510..d03d5f8 100644 --- a/src/main.rs +++ b/src/main.rs | |||
| @@ -30,11 +30,14 @@ fn build_block(blocks: &Blocks, code: &Cow<str>) -> String { | |||
| 30 | } | 30 | } |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | fn build(blocks: &Blocks, entry: &str) { | 33 | fn build(blocks: &Blocks) { |
| 34 | if let Some(code) = blocks.get(entry) { | 34 | lazy_static! { |
| 35 | let string = build_block(blocks, code); | 35 | static ref PATH: Regex = Regex::new(r"^(?:[[:word:]\.-]+/)+[[:word:]\.-]+\.[[:alpha:]]+$").unwrap(); |
| 36 | println!("{}", string); | ||
| 37 | } | 36 | } |
| 37 | blocks.iter().for_each(|(k,v)| if PATH.is_match(k) { | ||
| 38 | let string = build_block(blocks, v); | ||
| 39 | println!("[[{}]]\n{}", k, string); | ||
| 40 | }) | ||
| 38 | } | 41 | } |
| 39 | 42 | ||
| 40 | fn main() -> Result<()> { | 43 | fn main() -> Result<()> { |
| @@ -65,7 +68,7 @@ fn main() -> Result<()> { | |||
| 65 | } | 68 | } |
| 66 | } | 69 | } |
| 67 | ); | 70 | ); |
| 68 | build(dbg!(&blocks), "src/main.rs"); | 71 | build(dbg!(&blocks)); |
| 69 | pandoc | 72 | pandoc |
| 70 | })); | 73 | })); |
| 71 | pandoc.execute().unwrap(); | 74 | pandoc.execute().unwrap(); |
