Skip to content

Commit

Permalink
dev(cli): cleanup print log
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin committed Aug 27, 2023
1 parent 313c11d commit 140d0bf
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

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

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ strip = true

typst = "0.7.0"
typst-library = "0.7.0"
typst-ts-svg-exporter = "0.3"
typst-ts-core = "0.3"
typst-ts-compiler = "0.3"
typst-ts-svg-exporter = "0.4.0-rc1"
typst-ts-core = "0.4.0-rc1"
typst-ts-compiler = "0.4.0-rc1"

handlebars = "4.3"

Expand Down Expand Up @@ -62,9 +62,9 @@ pathdiff = "0.1.0"
[patch.crates-io]
typst = { git = "https://github.com/Myriad-Dreamin/typst.git", branch = "typst.ts" }
typst-library = { git = "https://github.com/Myriad-Dreamin/typst.git", branch = "typst.ts" }
typst-ts-svg-exporter = { git = "https://github.com/Myriad-Dreamin/typst.ts", rev = "877b507e057630f3725016a8838426736c8cb987", package = "typst-ts-svg-exporter" }
typst-ts-core = { git = "https://github.com/Myriad-Dreamin/typst.ts", rev = "877b507e057630f3725016a8838426736c8cb987", package = "typst-ts-core" }
typst-ts-compiler = { git = "https://github.com/Myriad-Dreamin/typst.ts", rev = "877b507e057630f3725016a8838426736c8cb987", package = "typst-ts-compiler" }
typst-ts-svg-exporter = { git = "https://github.com/Myriad-Dreamin/typst.ts", rev = "47f3b700e3693653d6dff34c8acbe49a9a7666c9", package = "typst-ts-svg-exporter" }
typst-ts-core = { git = "https://github.com/Myriad-Dreamin/typst.ts", rev = "47f3b700e3693653d6dff34c8acbe49a9a7666c9", package = "typst-ts-core" }
typst-ts-compiler = { git = "https://github.com/Myriad-Dreamin/typst.ts", rev = "47f3b700e3693653d6dff34c8acbe49a9a7666c9", package = "typst-ts-compiler" }

# typst = { path = "../typst/crates/typst" }
# typst-library = { path = "../typst/crates/typst-library" }
Expand Down
7 changes: 6 additions & 1 deletion cli/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ impl Project {
}

pub fn render_chapter(&mut self, chapter_data: DataDict, path: &str) -> ZResult<String> {
let instant = std::time::Instant::now();
log::info!("rendering chapter {}", path);
// println!("RC = {:?}", rc);
let data = serde_json::to_value(self.book_meta.clone())
.map_err(map_string_err("render_chapter,convert_to<BookMeta>"))?;
let mut data: DataDict = serde_json::from_value(data)
Expand All @@ -397,7 +400,9 @@ impl Project {
// inject path_to_root
data.insert("path_to_root".to_owned(), json!(self.path_to_root));

Ok(self.hr.render_index(data, path))
let index_html = self.hr.render_index(data, path);
log::info!("rendering chapter {} in {:?}", path, instant.elapsed());
Ok(index_html)
}

// pub fn auto_order_section(&mut self) {
Expand Down
5 changes: 1 addition & 4 deletions cli/src/render/html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,10 @@ impl HelperDef for RenderToc {
rc: &mut RenderContext<'reg, 'rc>,
out: &mut dyn Output,
) -> Result<(), RenderError> {
println!("RC = {:?}", rc);

// get value from context data
// rc.get_path() is current json parent path, you should always use it like this
// param is the key of value you want to display
let chapters = rc.evaluate(ctx, "@root/chapters").and_then(|c| {
println!("scopedjson = {:?}", c);
serde_json::value::from_value::<Vec<BTreeMap<String, String>>>(c.as_json().clone())
.map_err(|_| RenderError::new("Could not decode the JSON data"))
})?;
Expand Down Expand Up @@ -222,7 +219,7 @@ impl HelperDef for RenderToc {
out.write(&tmp)?;
out.write("\"")?;

println!("compare path = {path:?}, current_path = {current_path:?}");
// println!("compare path = {path:?}, current_path = {current_path:?}");

if path == &current_path || is_first_chapter {
is_first_chapter = false;
Expand Down

0 comments on commit 140d0bf

Please sign in to comment.