Skip to content

Commit

Permalink
Rename HtmlToBlaze to BlazeFromHtml
Browse files Browse the repository at this point in the history
This name allows better consistency with the
package names on Hackage.
  • Loading branch information
jaspervdj committed Jul 19, 2010
1 parent 6fc8821 commit 0fd1a35
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions Makefile
Expand Up @@ -49,6 +49,6 @@ blaze-html: hide-cabal-files
mv blaze-html.cabal.blaze-html blaze-html.cabal mv blaze-html.cabal.blaze-html blaze-html.cabal
mv Setup.hs.blaze-html Setup.hs mv Setup.hs.blaze-html Setup.hs


blaze-html-to-blaze: hide-cabal-files blaze-from-html: hide-cabal-files
mv blaze-html-to-blaze.cabal.blaze-html-to-blaze blaze-html-to-blaze.cabal mv blaze-from-html.cabal.blaze-from-html blaze-from-html.cabal
mv Setup.hs.blaze-html-to-blaze Setup.hs mv Setup.hs.blaze-from-html Setup.hs
File renamed without changes.
18 changes: 9 additions & 9 deletions Util/HtmlToBlaze.hs → Util/BlazeFromHtml.hs
Expand Up @@ -138,11 +138,11 @@ fromHtml variant (Parent tag attrs inner) = case combinatorType variant tag of


-- | Convert the HTML to blaze code. -- | Convert the HTML to blaze code.
-- --
htmlToBlaze :: HtmlVariant -- ^ Variant to use blazeFromHtml :: HtmlVariant -- ^ Variant to use
-> String -- ^ Template name -> String -- ^ Template name
-> String -- ^ HTML code -> String -- ^ HTML code
-> String -- ^ Resulting code -> String -- ^ Resulting code
htmlToBlaze variant name = blazeFromHtml variant name =
addSignature . unlines . fromHtml variant addSignature . unlines . fromHtml variant
. minimizeBlocks . removeEmptyText . fst . makeTree [] . minimizeBlocks . removeEmptyText . fst . makeTree []
. parseTagsOptions parseOptions { optTagPosition = True } . parseTagsOptions parseOptions { optTagPosition = True }
Expand All @@ -162,12 +162,12 @@ main = do
Just variant -> main' variant xs Just variant -> main' variant xs
where where
-- No files given, work with stdin -- No files given, work with stdin
main' variant [] = interact $ htmlToBlaze variant "template" main' variant [] = interact $ blazeFromHtml variant "template"


-- Handle all files -- Handle all files
main' variant files = forM_ files $ \file -> do main' variant files = forM_ files $ \file -> do
body <- readFile file body <- readFile file
putStrLn $ htmlToBlaze variant (dropExtension file) body putStrLn $ blazeFromHtml variant (dropExtension file) body


-- | Show some help information. -- | Show some help information.
-- --
Expand All @@ -178,7 +178,7 @@ help = mapM_ putStrLn $
, "" , ""
, "Usage:" , "Usage:"
, "" , ""
, " html-to-blaze html-version [FILES ...]" , " blaze-from-html html-version [FILES ...]"
, "" , ""
, "When no files are given, it works as a filter. The HTML version should" , "When no files are given, it works as a filter. The HTML version should"
, "be one of:" , "be one of:"
Expand All @@ -188,6 +188,6 @@ help = mapM_ putStrLn $
[ "" [ ""
, "Example:" , "Example:"
, "" , ""
, " html-to-blaze html4-strict index.html" , " blaze-from-html html4-strict index.html"
, "" , ""
] ]
@@ -1,4 +1,4 @@
Name: blaze-html-to-blaze Name: blaze-from-html
Version: 0.2.0 Version: 0.2.0
Synopsis: Tool to convert HTML to BlazeHtml code. Synopsis: Tool to convert HTML to BlazeHtml code.
Description: Tool that converts HTML files to Haskell code, ready to be Description: Tool that converts HTML files to Haskell code, ready to be
Expand All @@ -14,9 +14,9 @@ Category: Text
Build-type: Simple Build-type: Simple
Cabal-version: >= 1.2 Cabal-version: >= 1.2


Executable html-to-blaze Executable blaze-from-html
Ghc-Options: -Wall Ghc-Options: -Wall
Main-Is: Util/HtmlToBlaze.hs Main-Is: Util/BlazeFromHtml.hs
Build-depends: base >= 4 && < 5, Build-depends: base >= 4 && < 5,
containers >= 0.3, containers >= 0.3,
filepath >= 1.1, filepath >= 1.1,
Expand Down

0 comments on commit 0fd1a35

Please sign in to comment.