packages feed

shakespeare-babel (empty) → 0.1.0.0

raw patch · 3 files changed

+73/−0 lines, 3 filesdep +basedep +classy-preludedep +shakespearesetup-changed

Dependencies added: base, classy-prelude, shakespeare, template-haskell

Files

+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ shakespeare-babel.cabal view
@@ -0,0 +1,24 @@+-- Initial shakespeare-babel.cabal generated by cabal init.  For further+-- documentation, see http://haskell.org/cabal/users-guide/++name:                shakespeare-babel+version:             0.1.0.0+synopsis:            compile es2015+license:             PublicDomain+author:              ncaq+maintainer:          ncaq@ncaq.net+category:            Web Yesod+build-type:          Simple+cabal-version:       >=1.10+source-repository head+  type:     git+  location: https://github.com/ncaq/shakespeare-babel++library+  exposed-modules:     Text.Babel+  build-depends:       base             >=4.8   && <4.9+                     , shakespeare      >=2.0   && <2.1+                     , classy-prelude   >=0.12  && <0.13+                     , template-haskell >=2.10  && <2.11+  hs-source-dirs:      src+  default-language:    Haskell2010
+ src/Text/Babel.hs view
@@ -0,0 +1,47 @@+-- | A Shakespearean module for Babel++module Text.Babel+    ( babel+    , babelFile+    , babelFileReload+    , babelSettings+    ) where++import           Language.Haskell.TH.Quote+import           Language.Haskell.TH.Syntax+import           Text.Julius+import           Text.Shakespeare++-- | es2015 compiles down to Javascript+babelSettings :: Q ShakespeareSettings+babelSettings = do+  jsettings <- javascriptSettings+  return $ jsettings { varChar = '#'+                     , preConversion = Just PreConvert+                                       { preConvert = ReadProcess "babel" ["--presets", "es2015"]+                                       , preEscapeIgnoreBalanced = "'\""+                                       , preEscapeIgnoreLine = "//"+                                       , wrapInsertion = Just WrapInsertion+                                                         { wrapInsertionIndent = Nothing+                                                         , wrapInsertionStartBegin = ";(function("+                                                         , wrapInsertionSeparator = ", "+                                                         , wrapInsertionStartClose = "){"+                                                         , wrapInsertionEnd = "})"+                                                         , wrapInsertionAddParens = False+                                                         }}}++-- | Read inline+babel :: QuasiQuoter+babel = QuasiQuoter { quoteExp = \s -> babelSettings >>= \rs -> quoteExp (shakespeare rs) s }++-- | Read in a es2015 file+babelFile :: FilePath -> Q Exp+babelFile fp = do+    rs <- babelSettings+    shakespeareFile rs fp++-- | Read in a es2015 file at develop+babelFileReload :: FilePath -> Q Exp+babelFileReload fp = do+    rs <- babelSettings+    shakespeareFileReload rs fp