diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/generate_html.rs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/generate_html.rs b/src/generate_html.rs index 8f2ae62..8490379 100644 --- a/src/generate_html.rs +++ b/src/generate_html.rs @@ -223,7 +223,10 @@ pub fn document_to_html(document: &MarkdownDocument, page: &Page, website: &Webs Block::Table(table) => wrap!("div", "class='table'", wrap!("table", { wrap!("thead", wrap!("tr", for column in &table.columns { - tag!("th", column.name); + match column.border_right { + true => tag!("th", column.name, "class='border'"), + false => tag!("th", column.name), + } }) ); for section in &table.sections { @@ -235,19 +238,21 @@ pub fn document_to_html(document: &MarkdownDocument, page: &Page, website: &Webs "No" => "✗", other => other, }; - let align = match text { + let mut class = match text { "--" => "c", _ => match column.alignment { Alignment::Left => "l", Alignment::Center => "c", Alignment::Right => "r", }, + }.to_string(); + if ["No", "--", "0"].contains(&text_raw.as_str()) { + class.push_str(" dim"); }; - let class = match ["No", "--", "0"].contains(&text_raw.as_str()) { - true => format!("{align} dim"), - false => format!("{align}"), - }; - html!("<td class='{}'>{}</td>", class, text); + if column.border_right { + class.push_str(" border"); + } + html!("<td class='{class}'>{text}</td>"); }) }) }; |