diff options
| author | Federico Igne <git@federicoigne.com> | 2022-04-25 21:40:18 +0100 |
|---|---|---|
| committer | Federico Igne <git@federicoigne.com> | 2022-05-27 00:45:48 +0100 |
| commit | cd1dbb23feb4115267c5bc80fb3aa206daf866ea (patch) | |
| tree | 85c68b2995750d2ed548e9219ae60267a46ed019 | |
| parent | 28b7a0fe190049b50c0033fafbcc618775e1fc79 (diff) | |
| download | pangler-cd1dbb23feb4115267c5bc80fb3aa206daf866ea.tar.gz pangler-cd1dbb23feb4115267c5bc80fb3aa206daf866ea.zip | |
feat: add support for multiple targets
| -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(); |
