Skip to content
Snippets Groups Projects

nofib-compare: Fix header of Markdown output

Merged Sebastian Graf requested to merge wip/fix-markdown-header into master
1 file
+ 3
3
Compare changes
  • Side-by-side
  • Inline
+ 3
3
@@ -63,12 +63,12 @@ args =
@@ -63,12 +63,12 @@ args =
renderGitLabMarkdown :: (rh -> String) -> (ch -> String) -> (a -> String) -> Table rh ch a -> String
renderGitLabMarkdown :: (rh -> String) -> (ch -> String) -> (a -> String) -> Table rh ch a -> String
renderGitLabMarkdown renderRow renderCol renderCell (Table rows cols cells) =
renderGitLabMarkdown renderRow renderCol renderCell (Table rows cols cells) =
unlines $ [header, headerSep] ++ cells'
unlines $ [joinCols header, joinCols headerSep] ++ cells'
where
where
prepend x = (x :)
prepend x = (x :)
joinCols xs = "| " ++ intercalate " | " xs ++ " |"
joinCols xs = "| " ++ intercalate " | " xs ++ " |"
header = joinCols $ prepend "" $ map renderRow (headerContents rows)
header = prepend "" $ map renderCol (headerContents cols)
headerSep = joinCols $ map (const " -------- ") header
headerSep = map (const " -------- ") header
emphasize x = "*"++x++"*"
emphasize x = "*"++x++"*"
cells' = zipWith (\rh row -> joinCols
cells' = zipWith (\rh row -> joinCols
$ prepend (emphasize $ renderRow rh)
$ prepend (emphasize $ renderRow rh)
Loading