~ubuntu-branches/ubuntu/raring/haskell-shakespeare-js/raring-proposed

« back to all changes in this revision

Viewing changes to Text/Coffee.hs

  • Committer: Package Import Robot
  • Author(s): Clint Adams
  • Date: 2012-05-14 23:24:33 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120514232433-566e8c2qdpfcxcyt
Tags: 1.0.0.2-1
* New upstream version.
* Bump to Standards-Version 3.9.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
import Text.Shakespeare
40
40
import Text.Julius
41
41
 
 
42
-- | The Roy language compiles down to Javascript.
 
43
-- We do this once at compile time to avoid needing to do it during the request.
 
44
-- We call this a preConversion because other shakespeare modules like Lucius use Haskell to compile during the request rather than a system call.
42
45
-- During the pre-conversion we first modify all Haskell insertions
43
46
-- so that they will be ignored by the Coffeescript compiler (backticks).
44
47
-- So %{var} is change to `%{var}` using the preEscapeBegin and preEscapeEnd.
59
52
  jsettings <- javascriptSettings
60
53
  return $ jsettings { varChar = '%'
61
54
  , preConversion = Just PreConvert {
62
 
      preConvert = ReadProcess "coffee" ["-epb"]
 
55
      preConvert = ReadProcess "coffee" ["-sp"]
63
56
    , preEscapeBegin = "`"
64
57
    , preEscapeEnd = "`"
65
 
    , preEscapeIgnore = "'\"`"
 
58
    , preEscapeIgnoreBalanced = "'\"`"
 
59
    , preEscapeIgnoreLine = "#"
66
60
    }
67
61
  }
68
62
 
86
80
coffeeFileReload :: FilePath -> Q Exp
87
81
coffeeFileReload fp = do
88
82
    rs <- coffeeSettings
89
 
    shakespeareFileDebug rs fp
 
83
    shakespeareFileReload rs fp
90
84
 
91
85
-- | Deprecated synonym for 'coffeeFileReload'
92
86
coffeeFileDebug :: FilePath -> Q Exp