diff --git a/gitea-markdown/src/Gitea/Preview/Markdown/Meta.hs b/gitea-markdown/src/Gitea/Preview/Markdown/Meta.hs index ebb995b..b57cbe7 100644 --- a/gitea-markdown/src/Gitea/Preview/Markdown/Meta.hs +++ b/gitea-markdown/src/Gitea/Preview/Markdown/Meta.hs @@ -14,21 +14,23 @@ renderMeta :: MetaValue -> [Block] renderMeta (MetaMap metaMap) = singleton $ plainTable (map (singleton . Plain . singleton . Str . fst)) (singleton . plainRow . map (renderMeta . snd)) + length (toList metaMap) renderMeta (MetaList metaValues) = singleton $ plainTable (const []) (map (plainRow . singleton . renderMeta)) + (const 1) metaValues renderMeta (MetaBool bool) = [Plain [Str $ if bool then "true" else "false"]] renderMeta (MetaString text) = [Plain [Str text]] renderMeta (MetaInlines inlines) = [Plain inlines] renderMeta (MetaBlocks blocks) = blocks -plainTable :: ([a] -> [[Block]]) -> ([a] -> [Row]) -> [a] -> Block -plainTable mkHead mkBody xs = Table +plainTable :: ([a] -> [[Block]]) -> ([a] -> [Row]) -> ([a] -> Int) -> [a] -> Block +plainTable mkHead mkBody columns xs = Table nullAttr (Caption Nothing []) - (map (const $ (AlignDefault, ColWidthDefault)) xs) + (replicate (columns xs) (AlignDefault, ColWidthDefault)) (plainHead $ mkHead xs) [plainBody $ mkBody xs] (TableFoot nullAttr [])