#import "modules/model.typ": report-model #let report-file = sys.inputs.at("report", default: none) #if report-file == none { panic( "Missing report input.\n" + "Usage: typst compile --input report=reports/foo.yaml report.typ foo.pdf" ) } #let report = if sys.inputs.at("format", default: "yaml") == "json" { json(report-file) } else { yaml(report-file) } #let metadata = report.at("metadata", default: (:)) #if "Author" not in metadata or str.trim(str(metadata.at("Author", default: ""))) == "" { panic( "Missing required report field: metadata.Author.\n" + "Add this to the report YAML:\n\n" + "metadata:\n Author: \"Your name\"" ) } #if "Date" not in metadata or str.trim(str(metadata.at("Date", default: ""))) == "" { panic( "Missing required report field: metadata.Date.\n" + "Add this to the report YAML:\n\n" + "metadata:\n Date: \"YYYY-MM-DD\"" ) } #let themes = yaml("config/themes.yaml") #let theme-choice = report.at("theme", default: report.at("branding", default: (:)).at("theme", default: "default")) #let theme-name = if type(theme-choice) == str { lower(theme-choice) } else { "custom" } #if theme-name != "custom" and theme-name not in themes { panic( "Unknown report theme: \"" + theme-name + "\".\n" + "Set theme to one of: " + themes.keys().join(", ") + ".\n" + "Example: theme: default" ) } #let theme = if theme-name == "custom" { themes.default + theme-choice } else { themes.at(theme-name) } #show: report-model.with( report: report, theme: theme, logo: "/assets/beffroi.png", )