lhs2html 0.99999 → 0.999999
raw patch · 2 files changed
+13/−15 lines, 2 filesdep −nicifydep ~basedep ~directory
Dependencies removed: nicify
Dependency ranges changed: base, directory
Files
- lhs2html.cabal +5/−4
- src/lhs2html.hs +8/−11
lhs2html.cabal view
@@ -1,5 +1,5 @@ name: lhs2html-version: 0.99999+version: 0.999999 synopsis: Compile lhs in bird style to md, html, hs. license: PublicDomain license-file: LICENSE@@ -12,9 +12,10 @@ executable lhs2html main-is: lhs2html.hs- build-depends: base >=4.7 && <4.8, nicify, filepath, Glob, directory+ build-depends: base >=4 && <5+ , filepath+ , Glob+ , directory >= 1.2 hs-source-dirs: src default-language: Haskell2010--
src/lhs2html.hs view
@@ -1,18 +1,15 @@-{-# LANGUAGE Haskell2010, LambdaCase #-}- module Main where import Data.Functor import Data.List import Control.Monad import System.Environment-import Text.Nicify import System.Directory import System.FilePath import System.FilePath.Glob import Paths_lhs2html -main = getArgs >>= \case+main = getArgs >>= \x -> case x of m : args | m == "-m" || m == "--markdown" -> run lhs2md "md" args@@ -29,7 +26,7 @@ args -> run lhs2html "htm" args -run processor suffix = \case+run processor suffix = \x -> case x of [] -> processor <$> getContents >>= putStrLn @@ -52,7 +49,7 @@ mapM_ process args -lhs2txt = nicify . show . parse+lhs2txt = show . parse lhs2html = foldr toHTML "" . parse @@ -61,7 +58,7 @@ nl x y = x ++ '\n' : y infixr 5 `nl` - toMarkdown = \case+ toMarkdown = \x -> case x of Code xs -> unlines $ ("```haskell" : xs ++ ["```"]) Para xs -> unlines xs Quote xs -> unlines xs@@ -72,7 +69,7 @@ H3 x -> "### " ++ x `nl` "" _ -> [] -lhs2hs = unlines . concatMap (\case { Code xs -> xs; _ -> [] }) . parse+lhs2hs = unlines . concatMap (\x -> case x of { Code xs -> xs; _ -> [] }) . parse parse :: String -> [Object] parse = process . map identify . lines@@ -92,7 +89,7 @@ identify :: String -> Object-identify = \case+identify = \x -> case x of '>' : ' ' : xs -> Code [xs] '>' : xs -> Code [xs]@@ -120,7 +117,7 @@ xs -> Para [xs] process :: [Object] -> [Object]-process = \case+process = \x -> case x of Empty : xs@(Empty : _) -> process xs Para x : Para y : xs -> process (Para (x ++ y) : xs)@@ -168,7 +165,7 @@ htmlize = codify False . escape - escape = concatMap $ \case+ escape = concatMap $ \x -> case x of '<' -> "<" '>' -> ">" '&' -> "&"