///|
pub fn html_escape(value : String) -> String {
  let output = StringBuilder()
  for character in value {
    match character {
      '&' => output <+ "&"
      '<' => output <+ "<"
      '>' => output <+ ">"
      '"' => output <+ """
      '\'' => output <+ "'"
      _ => output <+ "\{character}"
    }
  }
  output.to_string()
}

///|
pub fn render_html(report : AuditReport) -> String {
  let output = StringBuilder()
  output <+
    #|
  output <+
    #|
  output <+
    #|
  output <+
    #|  
  output <+
    #|  
  output <+
    #|  片盒点检 · 素材交付报告
  output <+
    #|  
  output <+
    #|
  output <+
    #|
output <+ #|
MEDIA HANDOFF · PREFLIGHT
output <+ #|

片盒点检

output <+ #|
素材目录: output.write_string(html_escape(report.asset_dir)) output <+ #|
output <+ #|
规格清单 SHA-256: output.write_string(html_escape(report.manifest_sha256)) output <+ #|
output <+ #|
output <+ "
检查项
\{report.checked}
\n" output <+ "
通过
\{report.passed}
\n" output <+ "
需处理
\{report.failed}
\n" output <+ #|
output <+ #|
output <+ #| output <+ #| for result in report.results { let status_class = if result.status == "PASS" { "good" } else { "bad" } let label = match result.label { Some(value) => html_escape(value) None => "—" } output <+ " \n" } output <+ #| output <+ #|
素材用途状态检测到SHA-256结果
\{html_escape(result.file)}\{label}\{html_escape(result.status)}\{html_escape(result.observed)}\{html_escape(result.sha256)}\{html_escape(result.details)}
output <+ #| output <+ #|
output.to_string() }