Skip to content

Commit

Permalink
Option html_report_path to generate HTML report
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp committed Aug 10, 2024
1 parent b4ead7f commit f8638c0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/PlutoPages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ function generate(;
input_dir::String,
output_dir::String,
cache_dir::String,
html_report_path::Union{Nothing,String}=tempname()*"_generation_report.html",
)
app = run_plutopages_notebook(; input_dir, output_dir, cache_dir, run_server=false)
notebook = fetch(app.notebook_task)
Expand All @@ -178,16 +179,22 @@ function generate(;
for c in notebook.cells
if c.errored
bad = true
@error("Cell errored", c.code, c.output.body)
@error("Cell errored", c.code, c.cell_id, Text(c.output.body))
end
end
if bad
error("Error in notebook")

if html_report_path !== nothing
write(html_report_path, Pluto.generate_html(notebook))
@info "PlutoPages: 📄 HTML report written to:\n\n$(html_report_path)\n"
end

@info "PlutoPages: cleaning up..."
shutdown(app)

if bad
error("Error in notebook, see previous logs. $(html_report_path === nothing ? "You can debug this better with an HTML report, check out the `html_report_path` kwarg." : "Read more in the HTML report:\n$(html_report_path)\n")")
end

return output_dir
end

Expand Down

0 comments on commit f8638c0

Please sign in to comment.