diff options
author | EuAndreh <eu@euandre.org> | 2021-05-30 19:40:02 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-05-30 19:40:02 -0300 |
commit | b8cf943fb17a750aaf9f567fb97e7392d9cfb455 (patch) | |
tree | 566499e8369922c8af63b574364c619755a02b7b /src | |
parent | Remove empty Perl code (diff) | |
download | gistatic-b8cf943fb17a750aaf9f567fb97e7392d9cfb455.tar.gz gistatic-b8cf943fb17a750aaf9f567fb97e7392d9cfb455.tar.xz |
WIP init Rust
Diffstat (limited to '')
-rw-r--r-- | src/cli/main.rs | 4 | ||||
-rw-r--r-- | src/lib/lib.rs | 19 | ||||
-rw-r--r-- | src/templates/commit.html (renamed from etc/gistatic/templates/html/commit.tmpl) | 0 | ||||
-rw-r--r-- | src/templates/head.html (renamed from etc/gistatic/templates/html/head.html.tmpl) | 2 | ||||
-rw-r--r-- | src/templates/header.html (renamed from etc/gistatic/templates/html/header.html.tmpl) | 0 | ||||
-rw-r--r-- | src/templates/log.html (renamed from etc/gistatic/templates/html/log.html.tmpl) | 0 |
6 files changed, 24 insertions, 1 deletions
diff --git a/src/cli/main.rs b/src/cli/main.rs new file mode 100644 index 0000000..cdb964d --- /dev/null +++ b/src/cli/main.rs @@ -0,0 +1,4 @@ +pub fn main() { + println!("Hello, World!"); + println!("a_fn(): {}", gistatic::a_fn()); +} diff --git a/src/lib/lib.rs b/src/lib/lib.rs new file mode 100644 index 0000000..311a11f --- /dev/null +++ b/src/lib/lib.rs @@ -0,0 +1,19 @@ +const t: &'static str = include_str!("../templates/log.html"); + +pub fn a_fn() -> i32 { + // println!("log.html.tmpl: {}", t); + let template = mustache::compile_str(t).unwrap(); + let _data = mustache::MapBuilder::new() + .insert_str("name", "Venus") + .build(); + + let mut d2 = std::collections::HashMap::new(); + d2.insert("a", "b"); + template.render(&mut std::io::stdout(), &d2). unwrap(); + + 0 +} + +#[test] +fn a_test() { +} diff --git a/etc/gistatic/templates/html/commit.tmpl b/src/templates/commit.html index e69de29..e69de29 100644 --- a/etc/gistatic/templates/html/commit.tmpl +++ b/src/templates/commit.html diff --git a/etc/gistatic/templates/html/head.html.tmpl b/src/templates/head.html index 7f036d5..e6988ec 100644 --- a/etc/gistatic/templates/html/head.html.tmpl +++ b/src/templates/head.html @@ -1,7 +1,7 @@ <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> - <link rel="icon" type="image/svg+xml" href="favicon.svg" /> + <link rel="icon" type="image/svg+xml" href="/favicon.svg" /> <link rel="alternate" type="application/atom+xml" title="{{ name }} atom feed of commits" href="commits.xml" /> <link rel="alternate" type="application/atom+xml" title="{{ name }} atom feed of tags" href="tags.xml" /> <link rel="stylesheet" type="text/css" href="style.css" /> diff --git a/etc/gistatic/templates/html/header.html.tmpl b/src/templates/header.html index bbad31a..bbad31a 100644 --- a/etc/gistatic/templates/html/header.html.tmpl +++ b/src/templates/header.html diff --git a/etc/gistatic/templates/html/log.html.tmpl b/src/templates/log.html index 7caa079..7caa079 100644 --- a/etc/gistatic/templates/html/log.html.tmpl +++ b/src/templates/log.html |