Skip to content

Commit

Permalink
feat(template): implement html and markdown templating for reflections (
Browse files Browse the repository at this point in the history
#105)

* feat(template): implement html templating for reflections

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>

* use tera one_off for rendering template from user

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>

* convert ReflectionSummary to PaceReflection to wrap tera::Context

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>

* feat(time): make duration human readable for templating

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>

* more templating

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>

* feat(templating): add first templates for html and markdown

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>

* fix config

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>

* fix config

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>

* replace lazy_static with once_cell

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>

---------

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
  • Loading branch information
simonsan authored Mar 24, 2024
1 parent dc148ec commit a042abb
Show file tree
Hide file tree
Showing 16 changed files with 470 additions and 46 deletions.
3 changes: 2 additions & 1 deletion .dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
],
"excludes": [
"target/**/*",
"CHANGELOG.md"
"CHANGELOG.md",
"templates/reflections/**.md"
],
"plugins": [
"https://plugins.dprint.dev/markdown-0.16.4.wasm",
Expand Down
170 changes: 170 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ itertools = "0.12.1"
libsqlite3-sys = "0.27"
merge = "0.1.0"
miette = "7.2.0"
once_cell = "1.19"
once_cell = "1.19.0"
open = "5.1.2"
pace_cli = { path = "crates/cli", version = "0" }
pace_core = { path = "crates/core", version = "0" }
Expand All @@ -59,6 +59,7 @@ strum = "0.26.2"
strum_macros = "0.26.2"
tabled = "0.15.0"
tempfile = "3.10.1"
tera = "1.19.1"
thiserror = "1.0.58"
toml = "0.8.12"
tracing = "0.1.40"
Expand Down Expand Up @@ -94,6 +95,7 @@ license = false
eula = false

[dependencies]
abscissa_core = { workspace = true }
chrono = { workspace = true, features = ["serde"] }
clap = { workspace = true, features = ["env", "wrap_help", "derive"] }
clap_complete = { workspace = true }
Expand All @@ -107,17 +109,16 @@ pace_core = { workspace = true, features = ["cli"] }
pace_time = { workspace = true, features = ["cli"] }
serde = { workspace = true }
serde_derive = { workspace = true }

# Better error messages for Serde
# serde_path_to_error = "0.1.15"

abscissa_core = { workspace = true }
thiserror = { workspace = true }
toml = { workspace = true, features = ["preserve_order"] }

# optional: use `gimli` to capture backtraces
# see https://github.com/rust-lang/backtrace-rs/issues/189
# features = ["gimli-backtrace"]

# Better error messages for Serde
# serde_path_to_error = "0.1.15"

[dev-dependencies]
abscissa_core = { workspace = true, features = ["testing"] }
assert_cmd = { workspace = true }
Expand Down Expand Up @@ -161,6 +162,7 @@ install-updater = true
include = [
"./config/",
"./docs/",
"./templates/",
]

# see: https://nnethercote.github.io/perf-book/build-configuration.html
Expand Down
4 changes: 2 additions & 2 deletions config/pace.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ default-priority = "medium"
default-timezone = "UTC"

[reflections]
# Format of the reflections generated by the pace: "pdf", "html", "markdown", etc.
format = "html"
# Format of the reflections generated by the pace: "console", "template", "json", or "csv" etc.
format = "console"
# Directory where the reflections will be stored
directory = "/path/to/your/reflections/"

Expand Down
2 changes: 2 additions & 0 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ itertools = { workspace = true }
libsqlite3-sys = { workspace = true, features = ["bundled"], optional = true }
merge = { workspace = true }
miette = { workspace = true, features = ["fancy"] }
once_cell = { workspace = true }
open = { workspace = true }
pace_time = { workspace = true }
parking_lot = { workspace = true, features = ["deadlock_detection"] }
Expand All @@ -50,6 +51,7 @@ serde_json = { workspace = true }
strum = { workspace = true, features = ["derive"] }
strum_macros = { workspace = true }
tabled = { workspace = true }
tera = { workspace = true }
thiserror = { workspace = true }
toml = { workspace = true, features = ["indexmap", "preserve_order"] }
tracing = { workspace = true }
Expand Down
Loading

0 comments on commit a042abb

Please sign in to comment.