Commit a40d6bfb authored by Andrew Gibiansky's avatar Andrew Gibiansky Committed by Adam Vogt

Fixing linting CSS/html to wrap when long code lines are used

parent 58401074
...@@ -73,38 +73,36 @@ plainSuggestion suggest = ...@@ -73,38 +73,36 @@ plainSuggestion suggest =
(whyNot suggest) (whyNot suggest)
htmlSuggestions :: [LintSuggestion] -> String htmlSuggestions :: [LintSuggestion] -> String
htmlSuggestions suggests = table (concatMap toHtml suggests) htmlSuggestions = concatMap toHtml
where where
toHtml :: LintSuggestion -> String toHtml :: LintSuggestion -> String
toHtml suggest = toHtml suggest = concat
row (el $ style "name" $ suggestion suggest) [
++ named $ suggestion suggest,
row ( floating "left" $ style severityClass "Found:" ++
el (style severityClass "Found:" ++ -- Things that look like this get highlighted.
-- Things that look like this get highlighted. styleId "highlight-code" "haskell" (found suggest),
styleId "highlight-code" "haskell" (found suggest)) floating "left" $ style severityClass "Why Not:" ++
++ -- Things that look like this get highlighted.
el (style severityClass "Why Not:" ++ styleId "highlight-code" "haskell" (whyNot suggest)
styleId "highlight-code" "haskell" (whyNot suggest))) ]
where where
severityClass = case severity suggest of severityClass = case severity suggest of
LintWarning -> "warning" LintWarning -> "warning"
LintError -> "error" LintError -> "error"
style :: String -> String -> String style :: String -> String -> String
style cls thing = [i| <div class="suggestion-${cls}">${thing}</div> |] style cls thing = [i| <div class="suggestion-${cls}">${thing}</div> |]
named :: String -> String
named thing = [i| <div class="suggestion-name" style="clear:both;">${thing}</div> |]
styleId :: String -> String -> String -> String styleId :: String -> String -> String -> String
styleId cls id thing = [i| <div class="${cls}" id="${id}">${thing}</div> |] styleId cls id thing = [i| <div class="${cls}" id="${id}">${thing}</div> |]
table :: String -> String floating :: String -> String -> String
table thing = [i| <table class="suggestion-table">${thing}</table> |] floating dir thing = [i| <div class="suggestion-row" style="float: ${dir};">${thing}</div> |]
row :: String -> String
row thing = [i| <tr class="suggestion-row">${thing}</tr> |]
el :: String -> String
el thing = [i| <td class="suggestion-cell">${thing}</td> |]
-- | Parse a suggestion from Hlint. The suggestions look like this: -- | Parse a suggestion from Hlint. The suggestions look like this:
-- .ihaskell/.hlintFile.hs:1:19: Warning: Redundant bracket -- .ihaskell/.hlintFile.hs:1:19: Warning: Redundant bracket
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment