Skip to content
Browse files

Update HPCs, point API docs to hackage

  • Loading branch information...
1 parent 27890e7 commit 9c670a69ac3488ba9ade372ca173e469931e83f7 @gregorycollins gregorycollins committed Jun 21, 2011
Showing with 2,339 additions and 37,189 deletions.
  1. +593 −495 static/docs/heist-hpc/Text.Templating.Heist.Internal.hs.html
  2. +64 −52 static/docs/heist-hpc/Text.Templating.Heist.Splices.Apply.hs.html
  3. +36 −34 static/docs/heist-hpc/Text.Templating.Heist.Splices.Bind.hs.html
  4. +157 −0 static/docs/heist-hpc/Text.Templating.Heist.Splices.Cache.hs.html
  5. +61 −0 static/docs/heist-hpc/Text.Templating.Heist.Splices.Html.hs.html
  6. +21 −23 static/docs/heist-hpc/Text.Templating.Heist.Splices.Ignore.hs.html
  7. +143 −130 static/docs/heist-hpc/Text.Templating.Heist.Splices.Markdown.hs.html
  8. +109 −111 static/docs/heist-hpc/Text.Templating.Heist.Splices.Static.hs.html
  9. +15 −11 static/docs/heist-hpc/Text.Templating.Heist.Splices.hs.html
  10. +612 −561 static/docs/heist-hpc/Text.Templating.Heist.Tests.hs.html
  11. +318 −302 static/docs/heist-hpc/Text.Templating.Heist.Types.hs.html
  12. +150 −136 static/docs/heist-hpc/Text.Templating.Heist.hs.html
  13. +15 −9 static/docs/heist-hpc/hpc_index.html
  14. +15 −9 static/docs/heist-hpc/hpc_index_alt.html
  15. +15 −9 static/docs/heist-hpc/hpc_index_exp.html
  16. +15 −9 static/docs/heist-hpc/hpc_index_fun.html
  17. +0 −225 static/docs/latest/heist/Text-Templating-Heist-Splices-Apply.html
  18. +0 −225 static/docs/latest/heist/Text-Templating-Heist-Splices-Bind.html
  19. +0 −183 static/docs/latest/heist/Text-Templating-Heist-Splices-Ignore.html
  20. +0 −600 static/docs/latest/heist/Text-Templating-Heist-Splices-Markdown.html
  21. +0 −258 static/docs/latest/heist/Text-Templating-Heist-Splices-Static.html
  22. +0 −132 static/docs/latest/heist/Text-Templating-Heist-Splices.html
  23. +0 −409 static/docs/latest/heist/Text-Templating-Heist-TemplateDirectory.html
  24. +0 −2,863 static/docs/latest/heist/Text-Templating-Heist.html
  25. +0 −534 static/docs/latest/heist/doc-index.html
  26. +0 −27 static/docs/latest/heist/frames.html
  27. +0 −139 static/docs/latest/heist/haddock-util.js
  28. +0 −436 static/docs/latest/heist/haddock.css
  29. BIN static/docs/latest/heist/haskell_icon.gif
  30. BIN static/docs/latest/heist/heist.haddock
  31. +0 −43 static/docs/latest/heist/index-frames.html
  32. +0 −191 static/docs/latest/heist/index.html
  33. +0 −33 static/docs/latest/heist/mini_Text-Templating-Heist-Splices-Apply.html
  34. +0 −33 static/docs/latest/heist/mini_Text-Templating-Heist-Splices-Bind.html
  35. +0 −29 static/docs/latest/heist/mini_Text-Templating-Heist-Splices-Ignore.html
  36. +0 −53 static/docs/latest/heist/mini_Text-Templating-Heist-Splices-Markdown.html
  37. +0 −35 static/docs/latest/heist/mini_Text-Templating-Heist-Splices-Static.html
  38. +0 −21 static/docs/latest/heist/mini_Text-Templating-Heist-Splices.html
  39. +0 −43 static/docs/latest/heist/mini_Text-Templating-Heist-TemplateDirectory.html
  40. +0 −193 static/docs/latest/heist/mini_Text-Templating-Heist.html
  41. BIN static/docs/latest/heist/minus.gif
  42. BIN static/docs/latest/heist/plus.gif
  43. +0 −613 static/docs/latest/heist/src/Text-Templating-Heist-Internal.html
  44. +0 −64 static/docs/latest/heist/src/Text-Templating-Heist-Splices-Apply.html
  45. +0 −48 static/docs/latest/heist/src/Text-Templating-Heist-Splices-Bind.html
  46. +0 −35 static/docs/latest/heist/src/Text-Templating-Heist-Splices-Ignore.html
  47. +0 −170 static/docs/latest/heist/src/Text-Templating-Heist-Splices-Markdown.html
  48. +0 −126 static/docs/latest/heist/src/Text-Templating-Heist-Splices-Static.html
  49. +0 −25 static/docs/latest/heist/src/Text-Templating-Heist-Splices.html
  50. +0 −95 static/docs/latest/heist/src/Text-Templating-Heist-TemplateDirectory.html
  51. +0 −367 static/docs/latest/heist/src/Text-Templating-Heist-Types.html
  52. +0 −171 static/docs/latest/heist/src/Text-Templating-Heist.html
  53. +0 −15 static/docs/latest/heist/src/hscolour.css
  54. +0 −367 static/docs/latest/snap-core/Data-CIByteString.html
  55. +0 −388 static/docs/latest/snap-core/Snap-Internal-Debug.html
  56. +0 −4,668 static/docs/latest/snap-core/Snap-Internal-Http-Types.html
  57. +0 −227 static/docs/latest/snap-core/Snap-Internal-Iteratee-Debug.html
  58. +0 −1,205 static/docs/latest/snap-core/Snap-Internal-Parsing.html
  59. +0 −4,284 static/docs/latest/snap-core/Snap-Iteratee.html
  60. +0 −7,994 static/docs/latest/snap-core/Snap-Types.html
  61. +0 −1,676 static/docs/latest/snap-core/Snap-Util-FileServe.html
  62. +0 −2,163 static/docs/latest/snap-core/Snap-Util-FileUploads.html
  63. +0 −332 static/docs/latest/snap-core/Snap-Util-GZip.html
  64. +0 −170 static/docs/latest/snap-core/doc-index-36.html
  65. +0 −170 static/docs/latest/snap-core/doc-index-60.html
  66. +0 −170 static/docs/latest/snap-core/doc-index-61.html
  67. +0 −178 static/docs/latest/snap-core/doc-index-62.html
  68. +0 −170 static/docs/latest/snap-core/doc-index-95.html
  69. +0 −208 static/docs/latest/snap-core/doc-index-A.html
  70. +0 −186 static/docs/latest/snap-core/doc-index-B.html
  71. +0 −376 static/docs/latest/snap-core/doc-index-C.html
  72. +0 −372 static/docs/latest/snap-core/doc-index-D.html
  73. +0 −270 static/docs/latest/snap-core/doc-index-E.html
  74. +0 −284 static/docs/latest/snap-core/doc-index-F.html
  75. +0 −306 static/docs/latest/snap-core/doc-index-G.html
  76. +0 −252 static/docs/latest/snap-core/doc-index-H.html
  77. +0 −270 static/docs/latest/snap-core/doc-index-I.html
  78. +0 −178 static/docs/latest/snap-core/doc-index-J.html
Sorry, we could not display the entire diff because it was too big.
View
1,088 static/docs/heist-hpc/Text.Templating.Heist.Internal.hs.html
593 additions, 495 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
116 static/docs/heist-hpc/Text.Templating.Heist.Splices.Apply.hs.html
@@ -9,59 +9,71 @@
span.spaces { background: white }
</style>
<pre>
-<span class="lineno"> 1 </span>{-# LANGUAGE OverloadedStrings #-}
+<span class="lineno"> 1 </span>module Text.Templating.Heist.Splices.Apply where
<span class="lineno"> 2 </span>
-<span class="lineno"> 3 </span>module Text.Templating.Heist.Splices.Apply where
-<span class="lineno"> 4 </span>
-<span class="lineno"> 5 </span>------------------------------------------------------------------------------
-<span class="lineno"> 6 </span>import Data.Maybe
-<span class="lineno"> 7 </span>import Data.Text (Text)
-<span class="lineno"> 8 </span>import qualified Data.Text as T
-<span class="lineno"> 9 </span>import qualified Data.Text.Encoding as T
-<span class="lineno"> 10 </span>import qualified Text.XmlHtml as X
-<span class="lineno"> 11 </span>
-<span class="lineno"> 12 </span>------------------------------------------------------------------------------
-<span class="lineno"> 13 </span>import Text.Templating.Heist.Internal
-<span class="lineno"> 14 </span>import Text.Templating.Heist.Types
-<span class="lineno"> 15 </span>
-<span class="lineno"> 16 </span>------------------------------------------------------------------------------
-<span class="lineno"> 17 </span>-- | Default name for the apply splice.
-<span class="lineno"> 18 </span>applyTag :: Text
-<span class="lineno"> 19 </span><span class="decl"><span class="istickedoff">applyTag = &quot;apply&quot;</span></span>
-<span class="lineno"> 20 </span>
-<span class="lineno"> 21 </span>
-<span class="lineno"> 22 </span>------------------------------------------------------------------------------
-<span class="lineno"> 23 </span>-- | Default attribute name for the apply tag.
-<span class="lineno"> 24 </span>applyAttr :: Text
-<span class="lineno"> 25 </span><span class="decl"><span class="istickedoff">applyAttr = &quot;template&quot;</span></span>
-<span class="lineno"> 26 </span>
-<span class="lineno"> 27 </span>
-<span class="lineno"> 28 </span>------------------------------------------------------------------------------
-<span class="lineno"> 29 </span>-- | Implementation of the apply splice.
-<span class="lineno"> 30 </span>applyImpl :: Monad m =&gt; Splice m
-<span class="lineno"> 31 </span><span class="decl"><span class="istickedoff">applyImpl = do</span>
-<span class="lineno"> 32 </span><span class="spaces"> </span><span class="istickedoff">node &lt;- getParamNode</span>
-<span class="lineno"> 33 </span><span class="spaces"> </span><span class="istickedoff">case X.getAttribute applyAttr node of</span>
-<span class="lineno"> 34 </span><span class="spaces"> </span><span class="istickedoff">Nothing -&gt; return [] -- TODO: error handling</span>
-<span class="lineno"> 35 </span><span class="spaces"> </span><span class="istickedoff">Just attr -&gt; do</span>
-<span class="lineno"> 36 </span><span class="spaces"> </span><span class="istickedoff">st &lt;- getTS</span>
-<span class="lineno"> 37 </span><span class="spaces"> </span><span class="istickedoff">maybe (return []) -- TODO: error handling</span>
-<span class="lineno"> 38 </span><span class="spaces"> </span><span class="istickedoff">(\(t,ctx) -&gt; do</span>
-<span class="lineno"> 39 </span><span class="spaces"> </span><span class="istickedoff">addDoctype $ maybeToList $ X.docType t</span>
-<span class="lineno"> 40 </span><span class="spaces"> </span><span class="istickedoff">processedChildren &lt;- runNodeList $ X.childNodes node</span>
-<span class="lineno"> 41 </span><span class="spaces"> </span><span class="istickedoff">modifyTS (bindSplice &quot;content&quot; $</span>
-<span class="lineno"> 42 </span><span class="spaces"> </span><span class="istickedoff">return processedChildren)</span>
-<span class="lineno"> 43 </span><span class="spaces"> </span><span class="istickedoff">setContext <span class="nottickedoff">ctx</span></span>
-<span class="lineno"> 44 </span><span class="spaces"> </span><span class="istickedoff">result &lt;- runNodeList $ X.docContent t</span>
-<span class="lineno"> 45 </span><span class="spaces"> </span><span class="istickedoff">restoreTS st</span>
-<span class="lineno"> 46 </span><span class="spaces"> </span><span class="istickedoff">return result)</span>
-<span class="lineno"> 47 </span><span class="spaces"> </span><span class="istickedoff">(lookupTemplate (T.encodeUtf8 attr)</span>
-<span class="lineno"> 48 </span><span class="spaces"> </span><span class="istickedoff">(st {_curContext = nextCtx attr st}))</span>
-<span class="lineno"> 49 </span><span class="spaces"> </span><span class="istickedoff">where nextCtx name st</span>
-<span class="lineno"> 50 </span><span class="spaces"> </span><span class="istickedoff">| T.isPrefixOf &quot;/&quot; name = []</span>
-<span class="lineno"> 51 </span><span class="spaces"> </span><span class="istickedoff">| <span class="tickonlytrue">otherwise</span> = _curContext st</span></span>
-<span class="lineno"> 52 </span>
-<span class="lineno"> 53 </span>
+<span class="lineno"> 3 </span>------------------------------------------------------------------------------
+<span class="lineno"> 4 </span>import Data.Maybe
+<span class="lineno"> 5 </span>import Data.Text (Text)
+<span class="lineno"> 6 </span>import qualified Data.Text.Encoding as T
+<span class="lineno"> 7 </span>import qualified Text.XmlHtml as X
+<span class="lineno"> 8 </span>
+<span class="lineno"> 9 </span>------------------------------------------------------------------------------
+<span class="lineno"> 10 </span>import Text.Templating.Heist.Internal
+<span class="lineno"> 11 </span>import Text.Templating.Heist.Types
+<span class="lineno"> 12 </span>
+<span class="lineno"> 13 </span>------------------------------------------------------------------------------
+<span class="lineno"> 14 </span>-- | Default name for the apply splice.
+<span class="lineno"> 15 </span>applyTag :: Text
+<span class="lineno"> 16 </span><span class="decl"><span class="istickedoff">applyTag = &quot;apply&quot;</span></span>
+<span class="lineno"> 17 </span>
+<span class="lineno"> 18 </span>
+<span class="lineno"> 19 </span>------------------------------------------------------------------------------
+<span class="lineno"> 20 </span>-- | Default attribute name for the apply tag.
+<span class="lineno"> 21 </span>applyAttr :: Text
+<span class="lineno"> 22 </span><span class="decl"><span class="istickedoff">applyAttr = &quot;template&quot;</span></span>
+<span class="lineno"> 23 </span>
+<span class="lineno"> 24 </span>
+<span class="lineno"> 25 </span>------------------------------------------------------------------------------
+<span class="lineno"> 26 </span>-- | Raw core of apply functionality. This is abstracted for use in other
+<span class="lineno"> 27 </span>-- places like an enhanced (from the original) bind
+<span class="lineno"> 28 </span>rawApply :: (Monad m)
+<span class="lineno"> 29 </span> =&gt; [X.Node]
+<span class="lineno"> 30 </span> -&gt; TPath
+<span class="lineno"> 31 </span> -&gt; [X.Node]
+<span class="lineno"> 32 </span> -&gt; HeistT m Template
+<span class="lineno"> 33 </span><span class="decl"><span class="istickedoff">rawApply calledNodes newContext paramNodes = do</span>
+<span class="lineno"> 34 </span><span class="spaces"> </span><span class="istickedoff">st &lt;- getTS -- Can't use localTS here because the modifier is not pure</span>
+<span class="lineno"> 35 </span><span class="spaces"> </span><span class="istickedoff">processedParams &lt;- runNodeList paramNodes</span>
+<span class="lineno"> 36 </span><span class="spaces"> </span><span class="istickedoff">modifyTS (bindSplice &quot;content&quot; $ return processedParams)</span>
+<span class="lineno"> 37 </span><span class="spaces"> </span><span class="istickedoff">setContext <span class="nottickedoff">newContext</span></span>
+<span class="lineno"> 38 </span><span class="spaces"> </span><span class="istickedoff">result &lt;- runNodeList calledNodes</span>
+<span class="lineno"> 39 </span><span class="spaces"> </span><span class="istickedoff">restoreTS st</span>
+<span class="lineno"> 40 </span><span class="spaces"> </span><span class="istickedoff">return result</span></span>
+<span class="lineno"> 41 </span>
+<span class="lineno"> 42 </span>
+<span class="lineno"> 43 </span>------------------------------------------------------------------------------
+<span class="lineno"> 44 </span>-- | Applies a template as if the supplied nodes were the children of the
+<span class="lineno"> 45 </span>-- &lt;apply&gt; tag.
+<span class="lineno"> 46 </span>applyNodes :: Monad m =&gt; Template -&gt; Text -&gt; Splice m
+<span class="lineno"> 47 </span><span class="decl"><span class="istickedoff">applyNodes nodes template = do</span>
+<span class="lineno"> 48 </span><span class="spaces"> </span><span class="istickedoff">st &lt;- getTS</span>
+<span class="lineno"> 49 </span><span class="spaces"> </span><span class="istickedoff">maybe (return []) -- TODO: error handling</span>
+<span class="lineno"> 50 </span><span class="spaces"> </span><span class="istickedoff">(\(t,ctx) -&gt; do</span>
+<span class="lineno"> 51 </span><span class="spaces"> </span><span class="istickedoff">addDoctype $ maybeToList $ X.docType $ dfDoc t</span>
+<span class="lineno"> 52 </span><span class="spaces"> </span><span class="istickedoff">rawApply (X.docContent $ dfDoc t) <span class="nottickedoff">ctx</span> nodes)</span>
+<span class="lineno"> 53 </span><span class="spaces"> </span><span class="istickedoff">(lookupTemplate (T.encodeUtf8 template) st)</span></span>
+<span class="lineno"> 54 </span>
+<span class="lineno"> 55 </span>
+<span class="lineno"> 56 </span>------------------------------------------------------------------------------
+<span class="lineno"> 57 </span>-- | Implementation of the apply splice.
+<span class="lineno"> 58 </span>applyImpl :: Monad m =&gt; Splice m
+<span class="lineno"> 59 </span><span class="decl"><span class="istickedoff">applyImpl = do</span>
+<span class="lineno"> 60 </span><span class="spaces"> </span><span class="istickedoff">node &lt;- getParamNode</span>
+<span class="lineno"> 61 </span><span class="spaces"> </span><span class="istickedoff">case X.getAttribute applyAttr node of</span>
+<span class="lineno"> 62 </span><span class="spaces"> </span><span class="istickedoff">Nothing -&gt; return [] -- TODO: error handling</span>
+<span class="lineno"> 63 </span><span class="spaces"> </span><span class="istickedoff">Just template -&gt; applyNodes (X.childNodes node) template</span></span>
+<span class="lineno"> 64 </span>
+<span class="lineno"> 65 </span>
</pre>
</html>
View
70 static/docs/heist-hpc/Text.Templating.Heist.Splices.Bind.hs.html
@@ -9,43 +9,45 @@
span.spaces { background: white }
</style>
<pre>
-<span class="lineno"> 1 </span>{-# LANGUAGE OverloadedStrings #-}
+<span class="lineno"> 1 </span>module Text.Templating.Heist.Splices.Bind where
<span class="lineno"> 2 </span>
-<span class="lineno"> 3 </span>module Text.Templating.Heist.Splices.Bind where
-<span class="lineno"> 4 </span>
-<span class="lineno"> 5 </span>------------------------------------------------------------------------------
-<span class="lineno"> 6 </span>import Data.Text (Text)
-<span class="lineno"> 7 </span>import qualified Text.XmlHtml as X
-<span class="lineno"> 8 </span>
-<span class="lineno"> 9 </span>------------------------------------------------------------------------------
-<span class="lineno"> 10 </span>import Text.Templating.Heist.Internal
-<span class="lineno"> 11 </span>import Text.Templating.Heist.Types
-<span class="lineno"> 12 </span>
-<span class="lineno"> 13 </span>-- | Default name for the bind splice.
-<span class="lineno"> 14 </span>bindTag :: Text
-<span class="lineno"> 15 </span><span class="decl"><span class="istickedoff">bindTag = &quot;bind&quot;</span></span>
+<span class="lineno"> 3 </span>------------------------------------------------------------------------------
+<span class="lineno"> 4 </span>import Data.Text (Text)
+<span class="lineno"> 5 </span>import qualified Text.XmlHtml as X
+<span class="lineno"> 6 </span>
+<span class="lineno"> 7 </span>------------------------------------------------------------------------------
+<span class="lineno"> 8 </span>import Text.Templating.Heist.Internal
+<span class="lineno"> 9 </span>import Text.Templating.Heist.Splices.Apply
+<span class="lineno"> 10 </span>import Text.Templating.Heist.Types
+<span class="lineno"> 11 </span>
+<span class="lineno"> 12 </span>-- | Default name for the bind splice.
+<span class="lineno"> 13 </span>bindTag :: Text
+<span class="lineno"> 14 </span><span class="decl"><span class="istickedoff">bindTag = &quot;bind&quot;</span></span>
+<span class="lineno"> 15 </span>
<span class="lineno"> 16 </span>
-<span class="lineno"> 17 </span>
-<span class="lineno"> 18 </span>------------------------------------------------------------------------------
-<span class="lineno"> 19 </span>-- | Default attribute name for the bind tag.
-<span class="lineno"> 20 </span>bindAttr :: Text
-<span class="lineno"> 21 </span><span class="decl"><span class="istickedoff">bindAttr = &quot;tag&quot;</span></span>
+<span class="lineno"> 17 </span>------------------------------------------------------------------------------
+<span class="lineno"> 18 </span>-- | Default attribute name for the bind tag.
+<span class="lineno"> 19 </span>bindAttr :: Text
+<span class="lineno"> 20 </span><span class="decl"><span class="istickedoff">bindAttr = &quot;tag&quot;</span></span>
+<span class="lineno"> 21 </span>
<span class="lineno"> 22 </span>
-<span class="lineno"> 23 </span>
-<span class="lineno"> 24 </span>------------------------------------------------------------------------------
-<span class="lineno"> 25 </span>-- | Implementation of the bind splice.
-<span class="lineno"> 26 </span>bindImpl :: Monad m =&gt; Splice m
-<span class="lineno"> 27 </span><span class="decl"><span class="istickedoff">bindImpl = do</span>
-<span class="lineno"> 28 </span><span class="spaces"> </span><span class="istickedoff">node &lt;- getParamNode</span>
-<span class="lineno"> 29 </span><span class="spaces"> </span><span class="istickedoff">maybe <span class="nottickedoff">(return ())</span></span>
-<span class="lineno"> 30 </span><span class="spaces"> </span><span class="istickedoff">(add node)</span>
-<span class="lineno"> 31 </span><span class="spaces"> </span><span class="istickedoff">(X.getAttribute bindAttr node)</span>
-<span class="lineno"> 32 </span><span class="spaces"> </span><span class="istickedoff">return []</span>
-<span class="lineno"> 33 </span><span class="spaces"></span><span class="istickedoff"></span>
-<span class="lineno"> 34 </span><span class="spaces"> </span><span class="istickedoff">where</span>
-<span class="lineno"> 35 </span><span class="spaces"> </span><span class="istickedoff">add node nm = modifyTS $ bindSplice nm (return $ X.childNodes node)</span></span>
-<span class="lineno"> 36 </span>
-<span class="lineno"> 37 </span>
+<span class="lineno"> 23 </span>------------------------------------------------------------------------------
+<span class="lineno"> 24 </span>-- | Implementation of the bind splice.
+<span class="lineno"> 25 </span>bindImpl :: Monad m =&gt; Splice m
+<span class="lineno"> 26 </span><span class="decl"><span class="istickedoff">bindImpl = do</span>
+<span class="lineno"> 27 </span><span class="spaces"> </span><span class="istickedoff">node &lt;- getParamNode</span>
+<span class="lineno"> 28 </span><span class="spaces"> </span><span class="istickedoff">maybe <span class="nottickedoff">(return ())</span></span>
+<span class="lineno"> 29 </span><span class="spaces"> </span><span class="istickedoff">(add node)</span>
+<span class="lineno"> 30 </span><span class="spaces"> </span><span class="istickedoff">(X.getAttribute bindAttr node)</span>
+<span class="lineno"> 31 </span><span class="spaces"> </span><span class="istickedoff">return []</span>
+<span class="lineno"> 32 </span><span class="spaces"></span><span class="istickedoff"></span>
+<span class="lineno"> 33 </span><span class="spaces"> </span><span class="istickedoff">where</span>
+<span class="lineno"> 34 </span><span class="spaces"> </span><span class="istickedoff">add node nm = modifyTS $ bindSplice nm $ do</span>
+<span class="lineno"> 35 </span><span class="spaces"> </span><span class="istickedoff">caller &lt;- getParamNode</span>
+<span class="lineno"> 36 </span><span class="spaces"> </span><span class="istickedoff">ctx &lt;- getContext</span>
+<span class="lineno"> 37 </span><span class="spaces"> </span><span class="istickedoff">rawApply (X.childNodes node) <span class="nottickedoff">ctx</span> (X.childNodes caller)</span></span>
+<span class="lineno"> 38 </span>
+<span class="lineno"> 39 </span>
</pre>
</html>
View
157 static/docs/heist-hpc/Text.Templating.Heist.Splices.Cache.hs.html
@@ -0,0 +1,157 @@
+<html><style type="text/css">
+span.lineno { color: white; background: #aaaaaa; border-right: solid white 12px }
+span.nottickedoff { background: yellow}
+span.istickedoff { background: white }
+span.tickonlyfalse { margin: -1px; border: 1px solid #f20913; background: #f20913 }
+span.tickonlytrue { margin: -1px; border: 1px solid #60de51; background: #60de51 }
+span.funcount { font-size: small; color: orange; z-index: 2; position: absolute; right: 20 }
+span.decl { font-weight: bold }
+span.spaces { background: white }
+</style>
+<pre>
+<span class="lineno"> 1 </span>module Text.Templating.Heist.Splices.Cache
+<span class="lineno"> 2 </span> ( CacheTagState
+<span class="lineno"> 3 </span> , mkCacheTag
+<span class="lineno"> 4 </span> , clearCacheTagState
+<span class="lineno"> 5 </span> ) where
+<span class="lineno"> 6 </span>
+<span class="lineno"> 7 </span>------------------------------------------------------------------------------
+<span class="lineno"> 8 </span>import Control.Concurrent
+<span class="lineno"> 9 </span>import Control.Monad
+<span class="lineno"> 10 </span>import Control.Monad.Trans
+<span class="lineno"> 11 </span>import Data.IORef
+<span class="lineno"> 12 </span>import qualified Data.Map as Map
+<span class="lineno"> 13 </span>import Data.Map (Map)
+<span class="lineno"> 14 </span>import Data.Maybe
+<span class="lineno"> 15 </span>import qualified Data.Set as Set
+<span class="lineno"> 16 </span>import Data.Text (Text)
+<span class="lineno"> 17 </span>import qualified Data.Text as T
+<span class="lineno"> 18 </span>import Data.Text.Read
+<span class="lineno"> 19 </span>import Data.Time.Clock
+<span class="lineno"> 20 </span>import System.Random
+<span class="lineno"> 21 </span>import Text.XmlHtml.Cursor
+<span class="lineno"> 22 </span>import Text.XmlHtml hiding (Node)
+<span class="lineno"> 23 </span>
+<span class="lineno"> 24 </span>
+<span class="lineno"> 25 </span>------------------------------------------------------------------------------
+<span class="lineno"> 26 </span>import Text.Templating.Heist.Internal
+<span class="lineno"> 27 </span>import Text.Templating.Heist.Types
+<span class="lineno"> 28 </span>
+<span class="lineno"> 29 </span>
+<span class="lineno"> 30 </span>cacheTagName :: Text
+<span class="lineno"> 31 </span><span class="decl"><span class="nottickedoff">cacheTagName = &quot;cache&quot;</span></span>
+<span class="lineno"> 32 </span>
+<span class="lineno"> 33 </span>------------------------------------------------------------------------------
+<span class="lineno"> 34 </span>-- | State for storing cache tag information
+<span class="lineno"> 35 </span>newtype CacheTagState = CTS (MVar (Map Text (UTCTime, Template)))
+<span class="lineno"> 36 </span>
+<span class="lineno"> 37 </span>
+<span class="lineno"> 38 </span>------------------------------------------------------------------------------
+<span class="lineno"> 39 </span>-- | Clears the cache tag state.
+<span class="lineno"> 40 </span>clearCacheTagState :: CacheTagState -&gt; IO ()
+<span class="lineno"> 41 </span><span class="decl"><span class="nottickedoff">clearCacheTagState (CTS cacheMVar) =</span>
+<span class="lineno"> 42 </span><span class="spaces"> </span><span class="nottickedoff">modifyMVar_ cacheMVar (const $ return Map.empty)</span></span>
+<span class="lineno"> 43 </span>
+<span class="lineno"> 44 </span>
+<span class="lineno"> 45 </span>------------------------------------------------------------------------------
+<span class="lineno"> 46 </span>-- | Converts a TTL string into an integer number of seconds.
+<span class="lineno"> 47 </span>parseTTL :: Text -&gt; Int
+<span class="lineno"> 48 </span><span class="decl"><span class="nottickedoff">parseTTL s = value * multiplier</span>
+<span class="lineno"> 49 </span><span class="spaces"> </span><span class="nottickedoff">where</span>
+<span class="lineno"> 50 </span><span class="spaces"> </span><span class="nottickedoff">value = either (const 0) fst $ decimal s</span>
+<span class="lineno"> 51 </span><span class="spaces"> </span><span class="nottickedoff">multiplier = case T.last s of</span>
+<span class="lineno"> 52 </span><span class="spaces"> </span><span class="nottickedoff">'s' -&gt; 1</span>
+<span class="lineno"> 53 </span><span class="spaces"> </span><span class="nottickedoff">'m' -&gt; 60</span>
+<span class="lineno"> 54 </span><span class="spaces"> </span><span class="nottickedoff">'h' -&gt; 3600</span>
+<span class="lineno"> 55 </span><span class="spaces"> </span><span class="nottickedoff">'d' -&gt; 86400</span>
+<span class="lineno"> 56 </span><span class="spaces"> </span><span class="nottickedoff">'w' -&gt; 604800</span>
+<span class="lineno"> 57 </span><span class="spaces"> </span><span class="nottickedoff">_ -&gt; 0</span></span>
+<span class="lineno"> 58 </span>
+<span class="lineno"> 59 </span>------------------------------------------------------------------------------
+<span class="lineno"> 60 </span>-- | The \&quot;cache\&quot; splice ensures that its contents are cached and only
+<span class="lineno"> 61 </span>-- evaluated periodically. The cached contents are returned every time the
+<span class="lineno"> 62 </span>-- splice is referenced.
+<span class="lineno"> 63 </span>--
+<span class="lineno"> 64 </span>-- Use the ttl attribute to set the amount of time between reloads. The ttl
+<span class="lineno"> 65 </span>-- value should be a positive integer followed by a single character
+<span class="lineno"> 66 </span>-- specifying the units. Valid units are seconds, minutes, hours, days, and
+<span class="lineno"> 67 </span>-- weeks. If the ttl string is invalid or the ttl attribute is not specified,
+<span class="lineno"> 68 </span>-- the cache is never refreshed unless explicitly cleared with
+<span class="lineno"> 69 </span>-- clearCacheTagState.
+<span class="lineno"> 70 </span>cacheImpl :: (MonadIO m)
+<span class="lineno"> 71 </span> =&gt; CacheTagState
+<span class="lineno"> 72 </span> -&gt; HeistT m Template
+<span class="lineno"> 73 </span><span class="decl"><span class="nottickedoff">cacheImpl (CTS mv) = do</span>
+<span class="lineno"> 74 </span><span class="spaces"> </span><span class="nottickedoff">tree &lt;- getParamNode</span>
+<span class="lineno"> 75 </span><span class="spaces"> </span><span class="nottickedoff">let i = fromJust $ getAttribute &quot;id&quot; tree</span>
+<span class="lineno"> 76 </span><span class="spaces"> </span><span class="nottickedoff">ttl = maybe 0 parseTTL $ getAttribute &quot;ttl&quot; tree</span>
+<span class="lineno"> 77 </span><span class="spaces"> </span><span class="nottickedoff">mp &lt;- liftIO $ readMVar mv</span>
+<span class="lineno"> 78 </span><span class="spaces"></span><span class="nottickedoff"></span>
+<span class="lineno"> 79 </span><span class="spaces"> </span><span class="nottickedoff">(mp',ns) &lt;- do</span>
+<span class="lineno"> 80 </span><span class="spaces"> </span><span class="nottickedoff">curTime &lt;- liftIO getCurrentTime</span>
+<span class="lineno"> 81 </span><span class="spaces"> </span><span class="nottickedoff">let mbn = Map.lookup i mp</span>
+<span class="lineno"> 82 </span><span class="spaces"> </span><span class="nottickedoff">reload = do</span>
+<span class="lineno"> 83 </span><span class="spaces"> </span><span class="nottickedoff">nodes' &lt;- runNodeList $ childNodes tree</span>
+<span class="lineno"> 84 </span><span class="spaces"> </span><span class="nottickedoff">return $! (Map.insert i (curTime,nodes') mp, nodes')</span>
+<span class="lineno"> 85 </span><span class="spaces"> </span><span class="nottickedoff">case mbn of</span>
+<span class="lineno"> 86 </span><span class="spaces"> </span><span class="nottickedoff">Nothing -&gt; reload</span>
+<span class="lineno"> 87 </span><span class="spaces"> </span><span class="nottickedoff">(Just (lastUpdate,n)) -&gt; do</span>
+<span class="lineno"> 88 </span><span class="spaces"> </span><span class="nottickedoff">if ttl &gt; 0 &amp;&amp;</span>
+<span class="lineno"> 89 </span><span class="spaces"> </span><span class="nottickedoff">diffUTCTime curTime lastUpdate &gt; fromIntegral ttl</span>
+<span class="lineno"> 90 </span><span class="spaces"> </span><span class="nottickedoff">then reload</span>
+<span class="lineno"> 91 </span><span class="spaces"> </span><span class="nottickedoff">else do</span>
+<span class="lineno"> 92 </span><span class="spaces"> </span><span class="nottickedoff">stopRecursion</span>
+<span class="lineno"> 93 </span><span class="spaces"> </span><span class="nottickedoff">return $! (mp,n)</span>
+<span class="lineno"> 94 </span><span class="spaces"></span><span class="nottickedoff"></span>
+<span class="lineno"> 95 </span><span class="spaces"> </span><span class="nottickedoff">liftIO $ modifyMVar_ mv (const $ return mp')</span>
+<span class="lineno"> 96 </span><span class="spaces"></span><span class="nottickedoff"></span>
+<span class="lineno"> 97 </span><span class="spaces"> </span><span class="nottickedoff">return ns</span></span>
+<span class="lineno"> 98 </span>
+<span class="lineno"> 99 </span>
+<span class="lineno"> 100 </span>------------------------------------------------------------------------------
+<span class="lineno"> 101 </span>-- | Modifies a TemplateState to include a \&quot;cache\&quot; tag. The cache tag is
+<span class="lineno"> 102 </span>-- not bound automatically with the other default Heist tags. This is because
+<span class="lineno"> 103 </span>-- this function also returns CacheTagState, so the user will be able to
+<span class="lineno"> 104 </span>-- clear it with the 'clearCacheTagState' function.
+<span class="lineno"> 105 </span>mkCacheTag :: MonadIO m
+<span class="lineno"> 106 </span> =&gt; IO (TemplateState m -&gt; TemplateState m, CacheTagState)
+<span class="lineno"> 107 </span><span class="decl"><span class="nottickedoff">mkCacheTag = do</span>
+<span class="lineno"> 108 </span><span class="spaces"> </span><span class="nottickedoff">sr &lt;- newIORef $ Set.empty</span>
+<span class="lineno"> 109 </span><span class="spaces"> </span><span class="nottickedoff">mv &lt;- liftM CTS $ newMVar Map.empty</span>
+<span class="lineno"> 110 </span><span class="spaces"></span><span class="nottickedoff"></span>
+<span class="lineno"> 111 </span><span class="spaces"> </span><span class="nottickedoff">return $ (addOnLoadHook (assignIds sr) .</span>
+<span class="lineno"> 112 </span><span class="spaces"> </span><span class="nottickedoff">bindSplice cacheTagName (cacheImpl mv), mv)</span>
+<span class="lineno"> 113 </span><span class="spaces"></span><span class="nottickedoff"></span>
+<span class="lineno"> 114 </span><span class="spaces"> </span><span class="nottickedoff">where</span>
+<span class="lineno"> 115 </span><span class="spaces"> </span><span class="nottickedoff">generateId :: IO Int</span>
+<span class="lineno"> 116 </span><span class="spaces"> </span><span class="nottickedoff">generateId = getStdRandom random</span>
+<span class="lineno"> 117 </span><span class="spaces"></span><span class="nottickedoff"></span>
+<span class="lineno"> 118 </span><span class="spaces"> </span><span class="nottickedoff">assignIds setref = mapM f</span>
+<span class="lineno"> 119 </span><span class="spaces"> </span><span class="nottickedoff">where</span>
+<span class="lineno"> 120 </span><span class="spaces"> </span><span class="nottickedoff">f node = g $ fromNode node</span>
+<span class="lineno"> 121 </span><span class="spaces"></span><span class="nottickedoff"></span>
+<span class="lineno"> 122 </span><span class="spaces"> </span><span class="nottickedoff">getId = do</span>
+<span class="lineno"> 123 </span><span class="spaces"> </span><span class="nottickedoff">i &lt;- liftM (T.pack . show) generateId</span>
+<span class="lineno"> 124 </span><span class="spaces"> </span><span class="nottickedoff">st &lt;- readIORef setref</span>
+<span class="lineno"> 125 </span><span class="spaces"> </span><span class="nottickedoff">if Set.member i st</span>
+<span class="lineno"> 126 </span><span class="spaces"> </span><span class="nottickedoff">then getId</span>
+<span class="lineno"> 127 </span><span class="spaces"> </span><span class="nottickedoff">else do</span>
+<span class="lineno"> 128 </span><span class="spaces"> </span><span class="nottickedoff">writeIORef setref $ Set.insert i st</span>
+<span class="lineno"> 129 </span><span class="spaces"> </span><span class="nottickedoff">return $ T.append &quot;cache-id-&quot; i</span>
+<span class="lineno"> 130 </span><span class="spaces"></span><span class="nottickedoff"></span>
+<span class="lineno"> 131 </span><span class="spaces"> </span><span class="nottickedoff">g curs = do</span>
+<span class="lineno"> 132 </span><span class="spaces"> </span><span class="nottickedoff">let node = current curs</span>
+<span class="lineno"> 133 </span><span class="spaces"> </span><span class="nottickedoff">curs' &lt;- if tagName node == Just cacheTagName</span>
+<span class="lineno"> 134 </span><span class="spaces"> </span><span class="nottickedoff">then do</span>
+<span class="lineno"> 135 </span><span class="spaces"> </span><span class="nottickedoff">i &lt;- getId</span>
+<span class="lineno"> 136 </span><span class="spaces"> </span><span class="nottickedoff">return $ modifyNode (setAttribute &quot;id&quot; i) curs</span>
+<span class="lineno"> 137 </span><span class="spaces"> </span><span class="nottickedoff">else return curs</span>
+<span class="lineno"> 138 </span><span class="spaces"> </span><span class="nottickedoff">let mbc = nextDF curs'</span>
+<span class="lineno"> 139 </span><span class="spaces"> </span><span class="nottickedoff">maybe (return $ topNode curs') g mbc</span></span>
+<span class="lineno"> 140 </span>
+<span class="lineno"> 141 </span>
+<span class="lineno"> 142 </span>
+<span class="lineno"> 143 </span>
+
+</pre>
+</html>
View
61 static/docs/heist-hpc/Text.Templating.Heist.Splices.Html.hs.html
@@ -0,0 +1,61 @@
+<html><style type="text/css">
+span.lineno { color: white; background: #aaaaaa; border-right: solid white 12px }
+span.nottickedoff { background: yellow}
+span.istickedoff { background: white }
+span.tickonlyfalse { margin: -1px; border: 1px solid #f20913; background: #f20913 }
+span.tickonlytrue { margin: -1px; border: 1px solid #60de51; background: #60de51 }
+span.funcount { font-size: small; color: orange; z-index: 2; position: absolute; right: 20 }
+span.decl { font-weight: bold }
+span.spaces { background: white }
+</style>
+<pre>
+<span class="lineno"> 1 </span>module Text.Templating.Heist.Splices.Html where
+<span class="lineno"> 2 </span>
+<span class="lineno"> 3 </span>------------------------------------------------------------------------------
+<span class="lineno"> 4 </span>import Data.Maybe
+<span class="lineno"> 5 </span>import Data.Text (Text)
+<span class="lineno"> 6 </span>import qualified Text.XmlHtml as X
+<span class="lineno"> 7 </span>
+<span class="lineno"> 8 </span>------------------------------------------------------------------------------
+<span class="lineno"> 9 </span>import Text.Templating.Heist.Internal
+<span class="lineno"> 10 </span>import Text.Templating.Heist.Types
+<span class="lineno"> 11 </span>
+<span class="lineno"> 12 </span>
+<span class="lineno"> 13 </span>------------------------------------------------------------------------------
+<span class="lineno"> 14 </span>-- | Name for the html splice.
+<span class="lineno"> 15 </span>htmlTag :: Text
+<span class="lineno"> 16 </span><span class="decl"><span class="nottickedoff">htmlTag = &quot;html&quot;</span></span>
+<span class="lineno"> 17 </span>
+<span class="lineno"> 18 </span>
+<span class="lineno"> 19 </span>------------------------------------------------------------------------------
+<span class="lineno"> 20 </span>-- | The html splice runs all children and then traverses the returned node
+<span class="lineno"> 21 </span>-- forest removing all head nodes. Then it merges them all and prepends it to
+<span class="lineno"> 22 </span>-- the html tag's child list.
+<span class="lineno"> 23 </span>htmlImpl :: Monad m =&gt; Splice m
+<span class="lineno"> 24 </span><span class="decl"><span class="nottickedoff">htmlImpl = do</span>
+<span class="lineno"> 25 </span><span class="spaces"> </span><span class="nottickedoff">node &lt;- getParamNode</span>
+<span class="lineno"> 26 </span><span class="spaces"> </span><span class="nottickedoff">children &lt;- runNodeList $ X.childNodes node</span>
+<span class="lineno"> 27 </span><span class="spaces"> </span><span class="nottickedoff">let (heads, mnode) = extractHeads $ node { X.elementChildren = children }</span>
+<span class="lineno"> 28 </span><span class="spaces"> </span><span class="nottickedoff">new (X.Element t a c) = X.Element t a $</span>
+<span class="lineno"> 29 </span><span class="spaces"> </span><span class="nottickedoff">X.Element &quot;head&quot; [] heads : c</span>
+<span class="lineno"> 30 </span><span class="spaces"> </span><span class="nottickedoff">new n = n</span>
+<span class="lineno"> 31 </span><span class="spaces"> </span><span class="nottickedoff">stopRecursion</span>
+<span class="lineno"> 32 </span><span class="spaces"> </span><span class="nottickedoff">return [maybe node new mnode]</span></span>
+<span class="lineno"> 33 </span>
+<span class="lineno"> 34 </span>------------------------------------------------------------------------------
+<span class="lineno"> 35 </span>-- | Extracts all heads from a node tree.
+<span class="lineno"> 36 </span>extractHeads :: X.Node
+<span class="lineno"> 37 </span> -- ^ The root (html) node
+<span class="lineno"> 38 </span> -&gt; ([X.Node], Maybe X.Node)
+<span class="lineno"> 39 </span> -- ^ A tuple of a list of head nodes and the original tree with
+<span class="lineno"> 40 </span> -- heads removed.
+<span class="lineno"> 41 </span><span class="decl"><span class="nottickedoff">extractHeads (X.Element t a c)</span>
+<span class="lineno"> 42 </span><span class="spaces"> </span><span class="nottickedoff">| t == &quot;head&quot; = (c, Nothing)</span>
+<span class="lineno"> 43 </span><span class="spaces"> </span><span class="nottickedoff">| otherwise = (concat heads, Just $ X.Element t a (catMaybes mcs))</span>
+<span class="lineno"> 44 </span><span class="spaces"> </span><span class="nottickedoff">where</span>
+<span class="lineno"> 45 </span><span class="spaces"> </span><span class="nottickedoff">(heads, mcs) = unzip $ map extractHeads c</span>
+<span class="lineno"> 46 </span><span class="spaces"></span><span class="nottickedoff">extractHeads n = ([], Just n)</span></span>
+<span class="lineno"> 47 </span>
+
+</pre>
+</html>
View
44 static/docs/heist-hpc/Text.Templating.Heist.Splices.Ignore.hs.html
@@ -9,30 +9,28 @@
span.spaces { background: white }
</style>
<pre>
-<span class="lineno"> 1 </span>{-# LANGUAGE OverloadedStrings #-}
+<span class="lineno"> 1 </span>module Text.Templating.Heist.Splices.Ignore where
<span class="lineno"> 2 </span>
-<span class="lineno"> 3 </span>module Text.Templating.Heist.Splices.Ignore where
-<span class="lineno"> 4 </span>
-<span class="lineno"> 5 </span>------------------------------------------------------------------------------
-<span class="lineno"> 6 </span>import Data.Text (Text)
-<span class="lineno"> 7 </span>
-<span class="lineno"> 8 </span>------------------------------------------------------------------------------
-<span class="lineno"> 9 </span>import Text.Templating.Heist.Types
-<span class="lineno"> 10 </span>
-<span class="lineno"> 11 </span>
-<span class="lineno"> 12 </span>------------------------------------------------------------------------------
-<span class="lineno"> 13 </span>-- | Default name for the ignore splice.
-<span class="lineno"> 14 </span>ignoreTag :: Text
-<span class="lineno"> 15 </span><span class="decl"><span class="istickedoff">ignoreTag = &quot;ignore&quot;</span></span>
-<span class="lineno"> 16 </span>
-<span class="lineno"> 17 </span>
-<span class="lineno"> 18 </span>------------------------------------------------------------------------------
-<span class="lineno"> 19 </span>-- | The ignore tag and everything it surrounds disappears in the
-<span class="lineno"> 20 </span>-- rendered output.
-<span class="lineno"> 21 </span>ignoreImpl :: Monad m =&gt; Splice m
-<span class="lineno"> 22 </span><span class="decl"><span class="istickedoff">ignoreImpl = return []</span></span>
-<span class="lineno"> 23 </span>
-<span class="lineno"> 24 </span>
+<span class="lineno"> 3 </span>------------------------------------------------------------------------------
+<span class="lineno"> 4 </span>import Data.Text (Text)
+<span class="lineno"> 5 </span>
+<span class="lineno"> 6 </span>------------------------------------------------------------------------------
+<span class="lineno"> 7 </span>import Text.Templating.Heist.Types
+<span class="lineno"> 8 </span>
+<span class="lineno"> 9 </span>
+<span class="lineno"> 10 </span>------------------------------------------------------------------------------
+<span class="lineno"> 11 </span>-- | Default name for the ignore splice.
+<span class="lineno"> 12 </span>ignoreTag :: Text
+<span class="lineno"> 13 </span><span class="decl"><span class="istickedoff">ignoreTag = &quot;ignore&quot;</span></span>
+<span class="lineno"> 14 </span>
+<span class="lineno"> 15 </span>
+<span class="lineno"> 16 </span>------------------------------------------------------------------------------
+<span class="lineno"> 17 </span>-- | The ignore tag and everything it surrounds disappears in the
+<span class="lineno"> 18 </span>-- rendered output.
+<span class="lineno"> 19 </span>ignoreImpl :: Monad m =&gt; Splice m
+<span class="lineno"> 20 </span><span class="decl"><span class="istickedoff">ignoreImpl = return []</span></span>
+<span class="lineno"> 21 </span>
+<span class="lineno"> 22 </span>
</pre>
</html>
View
273 static/docs/heist-hpc/Text.Templating.Heist.Splices.Markdown.hs.html
@@ -9,7 +9,7 @@
span.spaces { background: white }
</style>
<pre>
-<span class="lineno"> 1 </span>{-# LANGUAGE OverloadedStrings, DeriveDataTypeable #-}
+<span class="lineno"> 1 </span>{-# LANGUAGE DeriveDataTypeable #-}
<span class="lineno"> 2 </span>
<span class="lineno"> 3 </span>module Text.Templating.Heist.Splices.Markdown where
<span class="lineno"> 4 </span>
@@ -36,138 +36,151 @@
<span class="lineno"> 25 </span>import Text.XmlHtml
<span class="lineno"> 26 </span>
<span class="lineno"> 27 </span>------------------------------------------------------------------------------
-<span class="lineno"> 28 </span>import Text.Templating.Heist.Types
-<span class="lineno"> 29 </span>
-<span class="lineno"> 30 </span>data PandocMissingException = PandocMissingException
-<span class="lineno"> 31 </span> deriving (<span class="decl"><span class="nottickedoff">Typeable</span></span>)
-<span class="lineno"> 32 </span>
-<span class="lineno"> 33 </span>instance Show PandocMissingException where
-<span class="lineno"> 34 </span> <span class="decl"><span class="nottickedoff">show PandocMissingException =</span>
-<span class="lineno"> 35 </span><span class="spaces"> </span><span class="nottickedoff">&quot;Cannot find the \&quot;pandoc\&quot; executable; is it on your $PATH?&quot;</span></span>
-<span class="lineno"> 36 </span>
-<span class="lineno"> 37 </span>instance Exception PandocMissingException
-<span class="lineno"> 38 </span>
+<span class="lineno"> 28 </span>import Text.Templating.Heist.Internal
+<span class="lineno"> 29 </span>import Text.Templating.Heist.Types
+<span class="lineno"> 30 </span>
+<span class="lineno"> 31 </span>data PandocMissingException = PandocMissingException
+<span class="lineno"> 32 </span> deriving (<span class="decl"><span class="nottickedoff">Typeable</span></span>)
+<span class="lineno"> 33 </span>
+<span class="lineno"> 34 </span>instance Show PandocMissingException where
+<span class="lineno"> 35 </span> <span class="decl"><span class="nottickedoff">show PandocMissingException =</span>
+<span class="lineno"> 36 </span><span class="spaces"> </span><span class="nottickedoff">&quot;Cannot find the \&quot;pandoc\&quot; executable; is it on your $PATH?&quot;</span></span>
+<span class="lineno"> 37 </span>
+<span class="lineno"> 38 </span>instance Exception PandocMissingException
<span class="lineno"> 39 </span>
-<span class="lineno"> 40 </span>data MarkdownException = MarkdownException ByteString
-<span class="lineno"> 41 </span> deriving (<span class="decl"><span class="nottickedoff">Typeable</span></span>)
-<span class="lineno"> 42 </span>
-<span class="lineno"> 43 </span>instance Show MarkdownException where
-<span class="lineno"> 44 </span> <span class="decl"><span class="nottickedoff">show (MarkdownException e) =</span>
-<span class="lineno"> 45 </span><span class="spaces"> </span><span class="nottickedoff">&quot;Markdown error: pandoc replied:\n\n&quot; ++ BC.unpack e</span></span>
-<span class="lineno"> 46 </span>
-<span class="lineno"> 47 </span>instance Exception MarkdownException
-<span class="lineno"> 48 </span>
+<span class="lineno"> 40 </span>
+<span class="lineno"> 41 </span>data MarkdownException = MarkdownException ByteString
+<span class="lineno"> 42 </span> deriving (<span class="decl"><span class="nottickedoff">Typeable</span></span>)
+<span class="lineno"> 43 </span>
+<span class="lineno"> 44 </span>instance Show MarkdownException where
+<span class="lineno"> 45 </span> <span class="decl"><span class="nottickedoff">show (MarkdownException e) =</span>
+<span class="lineno"> 46 </span><span class="spaces"> </span><span class="nottickedoff">&quot;Markdown error: pandoc replied:\n\n&quot; ++ BC.unpack e</span></span>
+<span class="lineno"> 47 </span>
+<span class="lineno"> 48 </span>instance Exception MarkdownException
<span class="lineno"> 49 </span>
-<span class="lineno"> 50 </span>------------------------------------------------------------------------------
-<span class="lineno"> 51 </span>-- | Default name for the markdown splice.
-<span class="lineno"> 52 </span>markdownTag :: Text
-<span class="lineno"> 53 </span><span class="decl"><span class="istickedoff">markdownTag = &quot;markdown&quot;</span></span>
-<span class="lineno"> 54 </span>
-<span class="lineno"> 55 </span>------------------------------------------------------------------------------
-<span class="lineno"> 56 </span>-- | Implementation of the markdown splice.
-<span class="lineno"> 57 </span>markdownSplice :: MonadIO m =&gt; FilePath -&gt; Splice m
-<span class="lineno"> 58 </span><span class="istickedoff"><span class="decl"><span class="istickedoff">markdownSplice templatePath = do</span>
-<span class="lineno"> 59 </span><span class="spaces"> </span><span class="istickedoff">pdMD &lt;- liftIO $ findExecutable &quot;pandoc&quot;</span>
-<span class="lineno"> 60 </span><span class="spaces"></span><span class="istickedoff"></span>
-<span class="lineno"> 61 </span><span class="spaces"> </span><span class="istickedoff">when (isNothing pdMD) $ <span class="nottickedoff">liftIO $ throwIO PandocMissingException</span></span>
-<span class="lineno"> 62 </span><span class="spaces"></span><span class="istickedoff"></span>
-<span class="lineno"> 63 </span><span class="spaces"> </span><span class="istickedoff">tree &lt;- getParamNode</span>
-<span class="lineno"> 64 </span><span class="spaces"> </span><span class="istickedoff">(source,markup) &lt;- liftIO $</span>
-<span class="lineno"> 65 </span><span class="spaces"> </span><span class="istickedoff">case getAttribute &quot;file&quot; tree of</span>
-<span class="lineno"> 66 </span><span class="spaces"> </span><span class="istickedoff">Just f -&gt; do</span>
-<span class="lineno"> 67 </span><span class="spaces"> </span><span class="istickedoff">m &lt;- pandoc (fromJust pdMD) templatePath $ T.unpack f</span>
-<span class="lineno"> 68 </span><span class="spaces"> </span><span class="istickedoff">return (<span class="nottickedoff">T.unpack f</span>,m)</span>
-<span class="lineno"> 69 </span><span class="spaces"> </span><span class="istickedoff">Nothing -&gt; do</span>
-<span class="lineno"> 70 </span><span class="spaces"> </span><span class="istickedoff">m &lt;- pandocBS (fromJust pdMD) $ T.encodeUtf8 $ nodeText tree</span>
-<span class="lineno"> 71 </span><span class="spaces"> </span><span class="istickedoff">return (<span class="nottickedoff">&quot;inline_splice&quot;</span>,m)</span>
-<span class="lineno"> 72 </span><span class="spaces"></span><span class="istickedoff"></span>
-<span class="lineno"> 73 </span><span class="spaces"> </span><span class="istickedoff">let ee = parseHTML <span class="nottickedoff">source</span> markup</span>
-<span class="lineno"> 74 </span><span class="spaces"> </span><span class="istickedoff">case ee of</span>
-<span class="lineno"> 75 </span><span class="spaces"> </span><span class="istickedoff">Left e -&gt; <span class="nottickedoff">throw $ MarkdownException</span></span>
-<span class="lineno"> 76 </span><span class="spaces"> </span><span class="istickedoff"><span class="nottickedoff">$ BC.pack (&quot;Error parsing markdown output: &quot; ++ e)</span></span>
-<span class="lineno"> 77 </span><span class="spaces"> </span><span class="istickedoff">Right d -&gt; return (docContent d)</span></span></span>
-<span class="lineno"> 78 </span>
-<span class="lineno"> 79 </span>
-<span class="lineno"> 80 </span>pandoc :: FilePath -&gt; FilePath -&gt; FilePath -&gt; IO ByteString
-<span class="lineno"> 81 </span><span class="decl"><span class="istickedoff">pandoc pandocPath templatePath inputFile = do</span>
-<span class="lineno"> 82 </span><span class="spaces"> </span><span class="istickedoff">(ex, sout, serr) &lt;- readProcessWithExitCode' pandocPath args &quot;&quot;</span>
-<span class="lineno"> 83 </span><span class="spaces"></span><span class="istickedoff"></span>
-<span class="lineno"> 84 </span><span class="spaces"> </span><span class="istickedoff">when (isFail ex) $ <span class="nottickedoff">throw $ MarkdownException serr</span></span>
-<span class="lineno"> 85 </span><span class="spaces"> </span><span class="istickedoff">return $ BC.concat [ &quot;&lt;div class=\&quot;markdown\&quot;&gt;\n&quot;</span>
-<span class="lineno"> 86 </span><span class="spaces"> </span><span class="istickedoff">, sout</span>
-<span class="lineno"> 87 </span><span class="spaces"> </span><span class="istickedoff">, &quot;\n&lt;/div&gt;&quot; ]</span>
-<span class="lineno"> 88 </span><span class="spaces"></span><span class="istickedoff"></span>
-<span class="lineno"> 89 </span><span class="spaces"> </span><span class="istickedoff">where</span>
-<span class="lineno"> 90 </span><span class="spaces"> </span><span class="istickedoff">isFail ExitSuccess = False</span>
-<span class="lineno"> 91 </span><span class="spaces"> </span><span class="istickedoff">isFail _ = <span class="nottickedoff">True</span></span>
-<span class="lineno"> 92 </span><span class="spaces"></span><span class="istickedoff"></span>
-<span class="lineno"> 93 </span><span class="spaces"> </span><span class="istickedoff">args = [ &quot;-S&quot;, &quot;--no-wrap&quot;, templatePath &lt;/&gt; inputFile ]</span></span>
-<span class="lineno"> 94 </span>
-<span class="lineno"> 95 </span>
-<span class="lineno"> 96 </span>pandocBS :: FilePath -&gt; ByteString -&gt; IO ByteString
-<span class="lineno"> 97 </span><span class="decl"><span class="istickedoff">pandocBS pandocPath s = do</span>
-<span class="lineno"> 98 </span><span class="spaces"> </span><span class="istickedoff">-- using the crummy string functions for convenience here</span>
-<span class="lineno"> 99 </span><span class="spaces"> </span><span class="istickedoff">(ex, sout, serr) &lt;- readProcessWithExitCode' pandocPath args s</span>
-<span class="lineno"> 100 </span><span class="spaces"></span><span class="istickedoff"></span>
-<span class="lineno"> 101 </span><span class="spaces"> </span><span class="istickedoff">when (isFail ex) $ <span class="nottickedoff">throw $ MarkdownException serr</span></span>
-<span class="lineno"> 102 </span><span class="spaces"> </span><span class="istickedoff">return $ BC.concat [ &quot;&lt;div class=\&quot;markdown\&quot;&gt;\n&quot;</span>
-<span class="lineno"> 103 </span><span class="spaces"> </span><span class="istickedoff">, sout</span>
-<span class="lineno"> 104 </span><span class="spaces"> </span><span class="istickedoff">, &quot;\n&lt;/div&gt;&quot; ]</span>
+<span class="lineno"> 50 </span>
+<span class="lineno"> 51 </span>data NoMarkdownFileException = NoMarkdownFileException
+<span class="lineno"> 52 </span> deriving (<span class="decl"><span class="nottickedoff">Typeable</span></span>)
+<span class="lineno"> 53 </span>
+<span class="lineno"> 54 </span>instance Show NoMarkdownFileException where
+<span class="lineno"> 55 </span> <span class="decl"><span class="nottickedoff">show NoMarkdownFileException =</span>
+<span class="lineno"> 56 </span><span class="spaces"> </span><span class="nottickedoff">&quot;Markdown error: no file or template in context during processing of markdown tag&quot;</span></span>
+<span class="lineno"> 57 </span>
+<span class="lineno"> 58 </span>instance Exception NoMarkdownFileException where
+<span class="lineno"> 59 </span>
+<span class="lineno"> 60 </span>------------------------------------------------------------------------------
+<span class="lineno"> 61 </span>-- | Default name for the markdown splice.
+<span class="lineno"> 62 </span>markdownTag :: Text
+<span class="lineno"> 63 </span><span class="decl"><span class="istickedoff">markdownTag = &quot;markdown&quot;</span></span>
+<span class="lineno"> 64 </span>
+<span class="lineno"> 65 </span>------------------------------------------------------------------------------
+<span class="lineno"> 66 </span>-- | Implementation of the markdown splice.
+<span class="lineno"> 67 </span>markdownSplice :: MonadIO m =&gt; Splice m
+<span class="lineno"> 68 </span><span class="decl"><span class="istickedoff">markdownSplice = do</span>
+<span class="lineno"> 69 </span><span class="spaces"> </span><span class="istickedoff">templateDir &lt;- liftM (fmap takeDirectory) getTemplateFilePath</span>
+<span class="lineno"> 70 </span><span class="spaces"> </span><span class="istickedoff">pdMD &lt;- liftIO $ findExecutable &quot;pandoc&quot;</span>
+<span class="lineno"> 71 </span><span class="spaces"></span><span class="istickedoff"></span>
+<span class="lineno"> 72 </span><span class="spaces"> </span><span class="istickedoff">when (isNothing pdMD) $ <span class="nottickedoff">liftIO $ throwIO PandocMissingException</span></span>
+<span class="lineno"> 73 </span><span class="spaces"></span><span class="istickedoff"></span>
+<span class="lineno"> 74 </span><span class="spaces"> </span><span class="istickedoff">tree &lt;- getParamNode</span>
+<span class="lineno"> 75 </span><span class="spaces"> </span><span class="istickedoff">(source,markup) &lt;- liftIO $</span>
+<span class="lineno"> 76 </span><span class="spaces"> </span><span class="istickedoff">case getAttribute &quot;file&quot; tree of</span>
+<span class="lineno"> 77 </span><span class="spaces"> </span><span class="istickedoff">Just f -&gt; do</span>
+<span class="lineno"> 78 </span><span class="spaces"> </span><span class="istickedoff">m &lt;- maybe <span class="nottickedoff">(liftIO $ throwIO NoMarkdownFileException )</span></span>
+<span class="lineno"> 79 </span><span class="spaces"> </span><span class="istickedoff">(\tp -&gt; pandoc (fromJust pdMD) tp $ T.unpack f)</span>
+<span class="lineno"> 80 </span><span class="spaces"> </span><span class="istickedoff">templateDir</span>
+<span class="lineno"> 81 </span><span class="spaces"> </span><span class="istickedoff">return (<span class="nottickedoff">T.unpack f</span>,m)</span>
+<span class="lineno"> 82 </span><span class="spaces"> </span><span class="istickedoff">Nothing -&gt; do</span>
+<span class="lineno"> 83 </span><span class="spaces"> </span><span class="istickedoff">m &lt;- pandocBS (fromJust pdMD) $ T.encodeUtf8 $ nodeText tree</span>
+<span class="lineno"> 84 </span><span class="spaces"> </span><span class="istickedoff">return (<span class="nottickedoff">&quot;inline_splice&quot;</span>,m)</span>
+<span class="lineno"> 85 </span><span class="spaces"></span><span class="istickedoff"></span>
+<span class="lineno"> 86 </span><span class="spaces"> </span><span class="istickedoff">let ee = parseHTML <span class="nottickedoff">source</span> markup</span>
+<span class="lineno"> 87 </span><span class="spaces"> </span><span class="istickedoff">case ee of</span>
+<span class="lineno"> 88 </span><span class="spaces"> </span><span class="istickedoff">Left e -&gt; <span class="nottickedoff">throw $ MarkdownException</span></span>
+<span class="lineno"> 89 </span><span class="spaces"> </span><span class="istickedoff"><span class="nottickedoff">$ BC.pack (&quot;Error parsing markdown output: &quot; ++ e)</span></span>
+<span class="lineno"> 90 </span><span class="spaces"> </span><span class="istickedoff">Right d -&gt; return (docContent d)</span></span>
+<span class="lineno"> 91 </span>
+<span class="lineno"> 92 </span>
+<span class="lineno"> 93 </span>pandoc :: FilePath -&gt; FilePath -&gt; FilePath -&gt; IO ByteString
+<span class="lineno"> 94 </span><span class="decl"><span class="istickedoff">pandoc pandocPath templateDir inputFile = do</span>
+<span class="lineno"> 95 </span><span class="spaces"> </span><span class="istickedoff">(ex, sout, serr) &lt;- readProcessWithExitCode' pandocPath args &quot;&quot;</span>
+<span class="lineno"> 96 </span><span class="spaces"></span><span class="istickedoff"></span>
+<span class="lineno"> 97 </span><span class="spaces"> </span><span class="istickedoff">when (isFail ex) $ <span class="nottickedoff">throw $ MarkdownException serr</span></span>
+<span class="lineno"> 98 </span><span class="spaces"> </span><span class="istickedoff">return $ BC.concat [ &quot;&lt;div class=\&quot;markdown\&quot;&gt;\n&quot;</span>
+<span class="lineno"> 99 </span><span class="spaces"> </span><span class="istickedoff">, sout</span>
+<span class="lineno"> 100 </span><span class="spaces"> </span><span class="istickedoff">, &quot;\n&lt;/div&gt;&quot; ]</span>
+<span class="lineno"> 101 </span><span class="spaces"></span><span class="istickedoff"></span>
+<span class="lineno"> 102 </span><span class="spaces"> </span><span class="istickedoff">where</span>
+<span class="lineno"> 103 </span><span class="spaces"> </span><span class="istickedoff">isFail ExitSuccess = False</span>
+<span class="lineno"> 104 </span><span class="spaces"> </span><span class="istickedoff">isFail _ = <span class="nottickedoff">True</span></span>
<span class="lineno"> 105 </span><span class="spaces"></span><span class="istickedoff"></span>
-<span class="lineno"> 106 </span><span class="spaces"> </span><span class="istickedoff">where</span>
-<span class="lineno"> 107 </span><span class="spaces"> </span><span class="istickedoff">isFail ExitSuccess = False</span>
-<span class="lineno"> 108 </span><span class="spaces"> </span><span class="istickedoff">isFail _ = <span class="nottickedoff">True</span></span>
-<span class="lineno"> 109 </span><span class="spaces"> </span><span class="istickedoff">args = [ &quot;-S&quot;, &quot;--no-wrap&quot; ]</span></span>
-<span class="lineno"> 110 </span>
-<span class="lineno"> 111 </span>
-<span class="lineno"> 112 </span>-- a version of readProcessWithExitCode that does I/O properly
-<span class="lineno"> 113 </span>readProcessWithExitCode'
-<span class="lineno"> 114 </span> :: FilePath -- ^ command to run
-<span class="lineno"> 115 </span> -&gt; [String] -- ^ any arguments
-<span class="lineno"> 116 </span> -&gt; ByteString -- ^ standard input
-<span class="lineno"> 117 </span> -&gt; IO (ExitCode,ByteString,ByteString) -- ^ exitcode, stdout, stderr
-<span class="lineno"> 118 </span><span class="decl"><span class="istickedoff">readProcessWithExitCode' cmd args input = do</span>
-<span class="lineno"> 119 </span><span class="spaces"> </span><span class="istickedoff">(Just inh, Just outh, Just errh, pid) &lt;-</span>
-<span class="lineno"> 120 </span><span class="spaces"> </span><span class="istickedoff">createProcess (proc cmd args){ std_in = CreatePipe,</span>
-<span class="lineno"> 121 </span><span class="spaces"> </span><span class="istickedoff">std_out = CreatePipe,</span>
-<span class="lineno"> 122 </span><span class="spaces"> </span><span class="istickedoff">std_err = CreatePipe }</span>
-<span class="lineno"> 123 </span><span class="spaces"> </span><span class="istickedoff">outMVar &lt;- newEmptyMVar</span>
-<span class="lineno"> 124 </span><span class="spaces"></span><span class="istickedoff"></span>
-<span class="lineno"> 125 </span><span class="spaces"> </span><span class="istickedoff">outM &lt;- newEmptyMVar</span>
-<span class="lineno"> 126 </span><span class="spaces"> </span><span class="istickedoff">errM &lt;- newEmptyMVar</span>
-<span class="lineno"> 127 </span><span class="spaces"></span><span class="istickedoff"></span>
-<span class="lineno"> 128 </span><span class="spaces"> </span><span class="istickedoff">-- fork off a thread to start consuming stdout</span>
-<span class="lineno"> 129 </span><span class="spaces"> </span><span class="istickedoff">forkIO $ do</span>
-<span class="lineno"> 130 </span><span class="spaces"> </span><span class="istickedoff">out &lt;- B.hGetContents outh</span>
-<span class="lineno"> 131 </span><span class="spaces"> </span><span class="istickedoff">putMVar outM out</span>
-<span class="lineno"> 132 </span><span class="spaces"> </span><span class="istickedoff">putMVar outMVar <span class="nottickedoff">()</span></span>
-<span class="lineno"> 133 </span><span class="spaces"></span><span class="istickedoff"></span>
-<span class="lineno"> 134 </span><span class="spaces"> </span><span class="istickedoff">-- fork off a thread to start consuming stderr</span>
-<span class="lineno"> 135 </span><span class="spaces"> </span><span class="istickedoff">forkIO $ do</span>
-<span class="lineno"> 136 </span><span class="spaces"> </span><span class="istickedoff">err &lt;- B.hGetContents errh</span>
-<span class="lineno"> 137 </span><span class="spaces"> </span><span class="istickedoff">putMVar errM <span class="nottickedoff">err</span></span>
-<span class="lineno"> 138 </span><span class="spaces"> </span><span class="istickedoff">putMVar outMVar <span class="nottickedoff">()</span></span>
-<span class="lineno"> 139 </span><span class="spaces"></span><span class="istickedoff"></span>
-<span class="lineno"> 140 </span><span class="spaces"> </span><span class="istickedoff">-- now write and flush any input</span>
-<span class="lineno"> 141 </span><span class="spaces"> </span><span class="istickedoff">when (not (B.null input)) $ do B.hPutStr inh input; hFlush inh</span>
-<span class="lineno"> 142 </span><span class="spaces"> </span><span class="istickedoff">hClose inh -- done with stdin</span>
-<span class="lineno"> 143 </span><span class="spaces"></span><span class="istickedoff"></span>
-<span class="lineno"> 144 </span><span class="spaces"> </span><span class="istickedoff">-- wait on the output</span>
-<span class="lineno"> 145 </span><span class="spaces"> </span><span class="istickedoff">takeMVar outMVar</span>
-<span class="lineno"> 146 </span><span class="spaces"> </span><span class="istickedoff">takeMVar outMVar</span>
-<span class="lineno"> 147 </span><span class="spaces"> </span><span class="istickedoff">hClose outh</span>
-<span class="lineno"> 148 </span><span class="spaces"></span><span class="istickedoff"></span>
-<span class="lineno"> 149 </span><span class="spaces"> </span><span class="istickedoff">-- wait on the process</span>
-<span class="lineno"> 150 </span><span class="spaces"> </span><span class="istickedoff">ex &lt;- waitForProcess pid</span>
-<span class="lineno"> 151 </span><span class="spaces"></span><span class="istickedoff"></span>
-<span class="lineno"> 152 </span><span class="spaces"> </span><span class="istickedoff">out &lt;- readMVar outM</span>
-<span class="lineno"> 153 </span><span class="spaces"> </span><span class="istickedoff">err &lt;- readMVar errM</span>
-<span class="lineno"> 154 </span><span class="spaces"></span><span class="istickedoff"></span>
-<span class="lineno"> 155 </span><span class="spaces"> </span><span class="istickedoff">return (ex, out, <span class="nottickedoff">err</span>)</span></span>
-<span class="lineno"> 156 </span>
-<span class="lineno"> 157 </span>
-<span class="lineno"> 158 </span>
-<span class="lineno"> 159 </span>
+<span class="lineno"> 106 </span><span class="spaces"> </span><span class="istickedoff">args = [ &quot;-S&quot;, &quot;--no-wrap&quot;, templateDir &lt;/&gt; inputFile ]</span></span>
+<span class="lineno"> 107 </span>
+<span class="lineno"> 108 </span>
+<span class="lineno"> 109 </span>pandocBS :: FilePath -&gt; ByteString -&gt; IO ByteString
+<span class="lineno"> 110 </span><span class="decl"><span class="istickedoff">pandocBS pandocPath s = do</span>
+<span class="lineno"> 111 </span><span class="spaces"> </span><span class="istickedoff">-- using the crummy string functions for convenience here</span>
+<span class="lineno"> 112 </span><span class="spaces"> </span><span class="istickedoff">(ex, sout, serr) &lt;- readProcessWithExitCode' pandocPath args s</span>
+<span class="lineno"> 113 </span><span class="spaces"></span><span class="istickedoff"></span>
+<span class="lineno"> 114 </span><span class="spaces"> </span><span class="istickedoff">when (isFail ex) $ <span class="nottickedoff">throw $ MarkdownException serr</span></span>
+<span class="lineno"> 115 </span><span class="spaces"> </span><span class="istickedoff">return $ BC.concat [ &quot;&lt;div class=\&quot;markdown\&quot;&gt;\n&quot;</span>
+<span class="lineno"> 116 </span><span class="spaces"> </span><span class="istickedoff">, sout</span>
+<span class="lineno"> 117 </span><span class="spaces"> </span><span class="istickedoff">, &quot;\n&lt;/div&gt;&quot; ]</span>
+<span class="lineno"> 118 </span><span class="spaces"></span><span class="istickedoff"></span>
+<span class="lineno"> 119 </span><span class="spaces"> </span><span class="istickedoff">where</span>
+<span class="lineno"> 120 </span><span class="spaces"> </span><span class="istickedoff">isFail ExitSuccess = False</span>
+<span class="lineno"> 121 </span><span class="spaces"> </span><span class="istickedoff">isFail _ = <span class="nottickedoff">True</span></span>
+<span class="lineno"> 122 </span><span class="spaces"> </span><span class="istickedoff">args = [ &quot;-S&quot;, &quot;--no-wrap&quot; ]</span></span>
+<span class="lineno"> 123 </span>
+<span class="lineno"> 124 </span>
+<span class="lineno"> 125 </span>-- a version of readProcessWithExitCode that does I/O properly
+<span class="lineno"> 126 </span>readProcessWithExitCode'
+<span class="lineno"> 127 </span> :: FilePath -- ^ command to run
+<span class="lineno"> 128 </span> -&gt; [String] -- ^ any arguments
+<span class="lineno"> 129 </span> -&gt; ByteString -- ^ standard input
+<span class="lineno"> 130 </span> -&gt; IO (ExitCode,ByteString,ByteString) -- ^ exitcode, stdout, stderr
+<span class="lineno"> 131 </span><span class="decl"><span class="istickedoff">readProcessWithExitCode' cmd args input = do</span>
+<span class="lineno"> 132 </span><span class="spaces"> </span><span class="istickedoff">(Just inh, Just outh, Just errh, pid) &lt;-</span>
+<span class="lineno"> 133 </span><span class="spaces"> </span><span class="istickedoff">createProcess (proc cmd args){ std_in = CreatePipe,</span>
+<span class="lineno"> 134 </span><span class="spaces"> </span><span class="istickedoff">std_out = CreatePipe,</span>
+<span class="lineno"> 135 </span><span class="spaces"> </span><span class="istickedoff">std_err = CreatePipe }</span>
+<span class="lineno"> 136 </span><span class="spaces"> </span><span class="istickedoff">outMVar &lt;- newEmptyMVar</span>
+<span class="lineno"> 137 </span><span class="spaces"></span><span class="istickedoff"></span>
+<span class="lineno"> 138 </span><span class="spaces"> </span><span class="istickedoff">outM &lt;- newEmptyMVar</span>
+<span class="lineno"> 139 </span><span class="spaces"> </span><span class="istickedoff">errM &lt;- newEmptyMVar</span>
+<span class="lineno"> 140 </span><span class="spaces"></span><span class="istickedoff"></span>
+<span class="lineno"> 141 </span><span class="spaces"> </span><span class="istickedoff">-- fork off a thread to start consuming stdout</span>
+<span class="lineno"> 142 </span><span class="spaces"> </span><span class="istickedoff">forkIO $ do</span>
+<span class="lineno"> 143 </span><span class="spaces"> </span><span class="istickedoff">out &lt;- B.hGetContents outh</span>
+<span class="lineno"> 144 </span><span class="spaces"> </span><span class="istickedoff">putMVar outM out</span>
+<span class="lineno"> 145 </span><span class="spaces"> </span><span class="istickedoff">putMVar outMVar <span class="nottickedoff">()</span></span>
+<span class="lineno"> 146 </span><span class="spaces"></span><span class="istickedoff"></span>
+<span class="lineno"> 147 </span><span class="spaces"> </span><span class="istickedoff">-- fork off a thread to start consuming stderr</span>
+<span class="lineno"> 148 </span><span class="spaces"> </span><span class="istickedoff">forkIO $ do</span>
+<span class="lineno"> 149 </span><span class="spaces"> </span><span class="istickedoff">err &lt;- B.hGetContents errh</span>
+<span class="lineno"> 150 </span><span class="spaces"> </span><span class="istickedoff">putMVar errM <span class="nottickedoff">err</span></span>
+<span class="lineno"> 151 </span><span class="spaces"> </span><span class="istickedoff">putMVar outMVar <span class="nottickedoff">()</span></span>
+<span class="lineno"> 152 </span><span class="spaces"></span><span class="istickedoff"></span>
+<span class="lineno"> 153 </span><span class="spaces"> </span><span class="istickedoff">-- now write and flush any input</span>
+<span class="lineno"> 154 </span><span class="spaces"> </span><span class="istickedoff">when (not (B.null input)) $ do B.hPutStr inh input; hFlush inh</span>
+<span class="lineno"> 155 </span><span class="spaces"> </span><span class="istickedoff">hClose inh -- done with stdin</span>
+<span class="lineno"> 156 </span><span class="spaces"></span><span class="istickedoff"></span>
+<span class="lineno"> 157 </span><span class="spaces"> </span><span class="istickedoff">-- wait on the output</span>
+<span class="lineno"> 158 </span><span class="spaces"> </span><span class="istickedoff">takeMVar outMVar</span>
+<span class="lineno"> 159 </span><span class="spaces"> </span><span class="istickedoff">takeMVar outMVar</span>
+<span class="lineno"> 160 </span><span class="spaces"> </span><span class="istickedoff">hClose outh</span>
+<span class="lineno"> 161 </span><span class="spaces"></span><span class="istickedoff"></span>
+<span class="lineno"> 162 </span><span class="spaces"> </span><span class="istickedoff">-- wait on the process</span>
+<span class="lineno"> 163 </span><span class="spaces"> </span><span class="istickedoff">ex &lt;- waitForProcess pid</span>
+<span class="lineno"> 164 </span><span class="spaces"></span><span class="istickedoff"></span>
+<span class="lineno"> 165 </span><span class="spaces"> </span><span class="istickedoff">out &lt;- readMVar outM</span>
+<span class="lineno"> 166 </span><span class="spaces"> </span><span class="istickedoff">err &lt;- readMVar errM</span>
+<span class="lineno"> 167 </span><span class="spaces"></span><span class="istickedoff"></span>
+<span class="lineno"> 168 </span><span class="spaces"> </span><span class="istickedoff">return (ex, out, <span class="nottickedoff">err</span>)</span></span>
+<span class="lineno"> 169 </span>
+<span class="lineno"> 170 </span>
+<span class="lineno"> 171 </span>
+<span class="lineno"> 172 </span>
</pre>
</html>
View
220 static/docs/heist-hpc/Text.Templating.Heist.Splices.Static.hs.html
@@ -9,121 +9,119 @@
span.spaces { background: white }
</style>
<pre>
-<span class="lineno"> 1 </span>{-# LANGUAGE OverloadedStrings #-}
-<span class="lineno"> 2 </span>
-<span class="lineno"> 3 </span>module Text.Templating.Heist.Splices.Static
-<span class="lineno"> 4 </span> ( StaticTagState
-<span class="lineno"> 5 </span> , bindStaticTag
-<span class="lineno"> 6 </span> , clearStaticTagCache
-<span class="lineno"> 7 </span> ) where
-<span class="lineno"> 8 </span>
-<span class="lineno"> 9 </span>------------------------------------------------------------------------------
-<span class="lineno"> 10 </span>import Control.Concurrent
-<span class="lineno"> 11 </span>import Control.Monad
-<span class="lineno"> 12 </span>import Control.Monad.Trans
-<span class="lineno"> 13 </span>import Data.IORef
-<span class="lineno"> 14 </span>import qualified Data.Map as Map
-<span class="lineno"> 15 </span>import Data.Map (Map)
-<span class="lineno"> 16 </span>import Data.Maybe
-<span class="lineno"> 17 </span>import qualified Data.Set as Set
-<span class="lineno"> 18 </span>import Data.Text (Text)
-<span class="lineno"> 19 </span>import qualified Data.Text as T
-<span class="lineno"> 20 </span>import System.Random
-<span class="lineno"> 21 </span>import Text.XmlHtml.Cursor
-<span class="lineno"> 22 </span>import Text.XmlHtml hiding (Node)
-<span class="lineno"> 23 </span>
-<span class="lineno"> 24 </span>
-<span class="lineno"> 25 </span>------------------------------------------------------------------------------
-<span class="lineno"> 26 </span>import Text.Templating.Heist.Internal
-<span class="lineno"> 27 </span>import Text.Templating.Heist.Types
-<span class="lineno"> 28 </span>
-<span class="lineno"> 29 </span>
-<span class="lineno"> 30 </span>------------------------------------------------------------------------------
-<span class="lineno"> 31 </span>-- | State for storing static tag information
-<span class="lineno"> 32 </span>newtype StaticTagState = STS (MVar (Map Text Template))
-<span class="lineno"> 33 </span>
-<span class="lineno"> 34 </span>
-<span class="lineno"> 35 </span>------------------------------------------------------------------------------
-<span class="lineno"> 36 </span>-- | Clears the static tag state.
-<span class="lineno"> 37 </span>clearStaticTagCache :: StaticTagState -&gt; IO ()
-<span class="lineno"> 38 </span><span class="decl"><span class="nottickedoff">clearStaticTagCache (STS staticMVar) =</span>
-<span class="lineno"> 39 </span><span class="spaces"> </span><span class="nottickedoff">modifyMVar_ staticMVar (const $ return Map.empty)</span></span>
-<span class="lineno"> 40 </span>
-<span class="lineno"> 41 </span>
-<span class="lineno"> 42 </span>------------------------------------------------------------------------------
-<span class="lineno"> 43 </span>-- | The \&quot;static\&quot; splice ensures that its contents are evaluated once and
-<span class="lineno"> 44 </span>-- then cached. The cached contents are returned every time the splice is
-<span class="lineno"> 45 </span>-- referenced.
-<span class="lineno"> 46 </span>staticImpl :: (MonadIO m)
-<span class="lineno"> 47 </span> =&gt; StaticTagState
-<span class="lineno"> 48 </span> -&gt; TemplateMonad m Template
-<span class="lineno"> 49 </span><span class="nottickedoff"><span class="decl"><span class="nottickedoff">staticImpl (STS mv) = do</span>
-<span class="lineno"> 50 </span><span class="spaces"> </span><span class="nottickedoff">tree &lt;- getParamNode</span>
-<span class="lineno"> 51 </span><span class="spaces"> </span><span class="nottickedoff">let i = fromJust $ getAttribute &quot;id&quot; tree</span>
+<span class="lineno"> 1 </span>module Text.Templating.Heist.Splices.Static
+<span class="lineno"> 2 </span> ( StaticTagState
+<span class="lineno"> 3 </span> , bindStaticTag
+<span class="lineno"> 4 </span> , clearStaticTagCache
+<span class="lineno"> 5 </span> ) where
+<span class="lineno"> 6 </span>
+<span class="lineno"> 7 </span>------------------------------------------------------------------------------
+<span class="lineno"> 8 </span>import Control.Concurrent
+<span class="lineno"> 9 </span>import Control.Monad
+<span class="lineno"> 10 </span>import Control.Monad.Trans
+<span class="lineno"> 11 </span>import Data.IORef
+<span class="lineno"> 12 </span>import qualified Data.Map as Map
+<span class="lineno"> 13 </span>import Data.Map (Map)
+<span class="lineno"> 14 </span>import Data.Maybe
+<span class="lineno"> 15 </span>import qualified Data.Set as Set
+<span class="lineno"> 16 </span>import Data.Text (Text)
+<span class="lineno"> 17 </span>import qualified Data.Text as T
+<span class="lineno"> 18 </span>import System.Random
+<span class="lineno"> 19 </span>import Text.XmlHtml.Cursor
+<span class="lineno"> 20 </span>import Text.XmlHtml hiding (Node)
+<span class="lineno"> 21 </span>
+<span class="lineno"> 22 </span>
+<span class="lineno"> 23 </span>------------------------------------------------------------------------------
+<span class="lineno"> 24 </span>import Text.Templating.Heist.Internal
+<span class="lineno"> 25 </span>import Text.Templating.Heist.Types
+<span class="lineno"> 26 </span>
+<span class="lineno"> 27 </span>
+<span class="lineno"> 28 </span>------------------------------------------------------------------------------
+<span class="lineno"> 29 </span>-- | State for storing static tag information
+<span class="lineno"> 30 </span>newtype StaticTagState = STS (MVar (Map Text Template))
+<span class="lineno"> 31 </span>
+<span class="lineno"> 32 </span>
+<span class="lineno"> 33 </span>------------------------------------------------------------------------------
+<span class="lineno"> 34 </span>-- | Clears the static tag state.
+<span class="lineno"> 35 </span>clearStaticTagCache :: StaticTagState -&gt; IO ()
+<span class="lineno"> 36 </span><span class="decl"><span class="nottickedoff">clearStaticTagCache (STS staticMVar) =</span>
+<span class="lineno"> 37 </span><span class="spaces"> </span><span class="nottickedoff">modifyMVar_ staticMVar (const $ return Map.empty)</span></span>
+<span class="lineno"> 38 </span>
+<span class="lineno"> 39 </span>
+<span class="lineno"> 40 </span>------------------------------------------------------------------------------
+<span class="lineno"> 41 </span>-- | The \&quot;static\&quot; splice ensures that its contents are evaluated once and
+<span class="lineno"> 42 </span>-- then cached. The cached contents are returned every time the splice is
+<span class="lineno"> 43 </span>-- referenced.
+<span class="lineno"> 44 </span>staticImpl :: (MonadIO m)
+<span class="lineno"> 45 </span> =&gt; StaticTagState
+<span class="lineno"> 46 </span> -&gt; HeistT m Template
+<span class="lineno"> 47 </span><span class="decl"><span class="nottickedoff">staticImpl (STS mv) = do</span>
+<span class="lineno"> 48 </span><span class="spaces"> </span><span class="nottickedoff">tree &lt;- getParamNode</span>
+<span class="lineno"> 49 </span><span class="spaces"> </span><span class="nottickedoff">let i = fromJust $ getAttribute &quot;id&quot; tree</span>
+<span class="lineno"> 50 </span><span class="spaces"></span><span class="nottickedoff"></span>
+<span class="lineno"> 51 </span><span class="spaces"> </span><span class="nottickedoff">mp &lt;- liftIO $ readMVar mv</span>
<span class="lineno"> 52 </span><span class="spaces"></span><span class="nottickedoff"></span>
-<span class="lineno"> 53 </span><span class="spaces"> </span><span class="nottickedoff">mp &lt;- liftIO $ readMVar mv</span>
-<span class="lineno"> 54 </span><span class="spaces"></span><span class="nottickedoff"></span>
-<span class="lineno"> 55 </span><span class="spaces"> </span><span class="nottickedoff">(mp',ns) &lt;- do</span>
-<span class="lineno"> 56 </span><span class="spaces"> </span><span class="nottickedoff">let mbn = Map.lookup i mp</span>
-<span class="lineno"> 57 </span><span class="spaces"> </span><span class="nottickedoff">case mbn of</span>
-<span class="lineno"> 58 </span><span class="spaces"> </span><span class="nottickedoff">Nothing -&gt; do</span>
-<span class="lineno"> 59 </span><span class="spaces"> </span><span class="nottickedoff">nodes' &lt;- runNodeList $ childNodes tree</span>
-<span class="lineno"> 60 </span><span class="spaces"> </span><span class="nottickedoff">return $! (Map.insert i nodes' mp, nodes')</span>
-<span class="lineno"> 61 </span><span class="spaces"> </span><span class="nottickedoff">(Just n) -&gt; do</span>
-<span class="lineno"> 62 </span><span class="spaces"> </span><span class="nottickedoff">stopRecursion</span>
-<span class="lineno"> 63 </span><span class="spaces"> </span><span class="nottickedoff">return $! (mp,n)</span>
+<span class="lineno"> 53 </span><span class="spaces"> </span><span class="nottickedoff">(mp',ns) &lt;- do</span>
+<span class="lineno"> 54 </span><span class="spaces"> </span><span class="nottickedoff">let mbn = Map.lookup i mp</span>
+<span class="lineno"> 55 </span><span class="spaces"> </span><span class="nottickedoff">case mbn of</span>
+<span class="lineno"> 56 </span><span class="spaces"> </span><span class="nottickedoff">Nothing -&gt; do</span>
+<span class="lineno"> 57 </span><span class="spaces"> </span><span class="nottickedoff">nodes' &lt;- runNodeList $ childNodes tree</span>
+<span class="lineno"> 58 </span><span class="spaces"> </span><span class="nottickedoff">return $! (Map.insert i nodes' mp, nodes')</span>
+<span class="lineno"> 59 </span><span class="spaces"> </span><span class="nottickedoff">(Just n) -&gt; do</span>
+<span class="lineno"> 60 </span><span class="spaces"> </span><span class="nottickedoff">stopRecursion</span>
+<span class="lineno"> 61 </span><span class="spaces"> </span><span class="nottickedoff">return $! (mp,n)</span>
+<span class="lineno"> 62 </span><span class="spaces"></span><span class="nottickedoff"></span>
+<span class="lineno"> 63 </span><span class="spaces"> </span><span class="nottickedoff">liftIO $ modifyMVar_ mv (const $ return mp')</span>
<span class="lineno"> 64 </span><span class="spaces"></span><span class="nottickedoff"></span>
-<span class="lineno"> 65 </span><span class="spaces"> </span><span class="nottickedoff">liftIO $ modifyMVar_ mv (const $ return mp')</span>
-<span class="lineno"> 66 </span><span class="spaces"></span><span class="nottickedoff"></span>
-<span class="lineno"> 67 </span><span class="spaces"> </span><span class="nottickedoff">return ns</span></span></span>
-<span class="lineno"> 68 </span>
-<span class="lineno"> 69 </span>
-<span class="lineno"> 70 </span>------------------------------------------------------------------------------
-<span class="lineno"> 71 </span>-- | Modifies a TemplateState to include a \&quot;static\&quot; tag. The static tag is
-<span class="lineno"> 72 </span>-- not bound automatically with the other default Heist tags. This is because
-<span class="lineno"> 73 </span>-- this function also returns StaticTagState, so the user will be able to
-<span class="lineno"> 74 </span>-- clear it with the 'clearStaticTagCache' function.
-<span class="lineno"> 75 </span>bindStaticTag :: MonadIO m
-<span class="lineno"> 76 </span> =&gt; TemplateState m
-<span class="lineno"> 77 </span> -&gt; IO (TemplateState m, StaticTagState)
-<span class="lineno"> 78 </span><span class="decl"><span class="nottickedoff">bindStaticTag ts = do</span>
-<span class="lineno"> 79 </span><span class="spaces"> </span><span class="nottickedoff">sr &lt;- newIORef $ Set.empty</span>
-<span class="lineno"> 80 </span><span class="spaces"> </span><span class="nottickedoff">mv &lt;- liftM STS $ newMVar Map.empty</span>
-<span class="lineno"> 81 </span><span class="spaces"></span><span class="nottickedoff"></span>
-<span class="lineno"> 82 </span><span class="spaces"> </span><span class="nottickedoff">return $ (addOnLoadHook (assignIds sr) $</span>
-<span class="lineno"> 83 </span><span class="spaces"> </span><span class="nottickedoff">bindSplice &quot;static&quot; (staticImpl mv) ts,</span>
-<span class="lineno"> 84 </span><span class="spaces"> </span><span class="nottickedoff">mv)</span>
-<span class="lineno"> 85 </span><span class="spaces"></span><span class="nottickedoff"></span>
-<span class="lineno"> 86 </span><span class="spaces"> </span><span class="nottickedoff">where</span>
-<span class="lineno"> 87 </span><span class="spaces"> </span><span class="nottickedoff">generateId :: IO Int</span>
-<span class="lineno"> 88 </span><span class="spaces"> </span><span class="nottickedoff">generateId = getStdRandom random</span>
-<span class="lineno"> 89 </span><span class="spaces"></span><span class="nottickedoff"></span>
-<span class="lineno"> 90 </span><span class="spaces"> </span><span class="nottickedoff">assignIds setref = mapM f</span>
-<span class="lineno"> 91 </span><span class="spaces"> </span><span class="nottickedoff">where</span>
-<span class="lineno"> 92 </span><span class="spaces"> </span><span class="nottickedoff">f node = g $ fromNode node</span>
-<span class="lineno"> 93 </span><span class="spaces"></span><span class="nottickedoff"></span>
-<span class="lineno"> 94 </span><span class="spaces"> </span><span class="nottickedoff">getId = do</span>
-<span class="lineno"> 95 </span><span class="spaces"> </span><span class="nottickedoff">i &lt;- liftM (T.pack . show) generateId</span>
-<span class="lineno"> 96 </span><span class="spaces"> </span><span class="nottickedoff">st &lt;- readIORef setref</span>
-<span class="lineno"> 97 </span><span class="spaces"> </span><span class="nottickedoff">if Set.member i st</span>
-<span class="lineno"> 98 </span><span class="spaces"> </span><span class="nottickedoff">then getId</span>
-<span class="lineno"> 99 </span><span class="spaces"> </span><span class="nottickedoff">else do</span>
-<span class="lineno"> 100 </span><span class="spaces"> </span><span class="nottickedoff">writeIORef setref $ Set.insert i st</span>
-<span class="lineno"> 101 </span><span class="spaces"> </span><span class="nottickedoff">return i</span>
-<span class="lineno"> 102 </span><span class="spaces"></span><span class="nottickedoff"></span>
-<span class="lineno"> 103 </span><span class="spaces"> </span><span class="nottickedoff">g curs = do</span>
-<span class="lineno"> 104 </span><span class="spaces"> </span><span class="nottickedoff">let node = current curs</span>
-<span class="lineno"> 105 </span><span class="spaces"> </span><span class="nottickedoff">curs' &lt;- if tagName node == Just &quot;static&quot;</span>
-<span class="lineno"> 106 </span><span class="spaces"> </span><span class="nottickedoff">then do</span>
-<span class="lineno"> 107 </span><span class="spaces"> </span><span class="nottickedoff">i &lt;- getId</span>
-<span class="lineno"> 108 </span><span class="spaces"> </span><span class="nottickedoff">return $ modifyNode (setAttribute &quot;id&quot; i) curs</span>
-<span class="lineno"> 109 </span><span class="spaces"> </span><span class="nottickedoff">else return curs</span>
-<span class="lineno"> 110 </span><span class="spaces"> </span><span class="nottickedoff">let mbc = nextDF curs'</span>
-<span class="lineno"> 111 </span><span class="spaces"> </span><span class="nottickedoff">maybe (return $ topNode curs') g mbc</span></span>
+<span class="lineno"> 65 </span><span class="spaces"> </span><span class="nottickedoff">return ns</span></span>
+<span class="lineno"> 66 </span>
+<span class="lineno"> 67 </span>
+<span class="lineno"> 68 </span>------------------------------------------------------------------------------
+<span class="lineno"> 69 </span>-- | Modifies a TemplateState to include a \&quot;static\&quot; tag. The static tag is
+<span class="lineno"> 70 </span>-- not bound automatically with the other default Heist tags. This is because
+<span class="lineno"> 71 </span>-- this function also returns StaticTagState, so the user will be able to
+<span class="lineno"> 72 </span>-- clear it with the 'clearStaticTagCache' function.
+<span class="lineno"> 73 </span>bindStaticTag :: MonadIO m
+<span class="lineno"> 74 </span> =&gt; TemplateState m
+<span class="lineno"> 75 </span> -&gt; IO (TemplateState m, StaticTagState)
+<span class="lineno"> 76 </span><span class="decl"><span class="nottickedoff">bindStaticTag ts = do</span>
+<span class="lineno"> 77 </span><span class="spaces"> </span><span class="nottickedoff">sr &lt;- newIORef $ Set.empty</span>
+<span class="lineno"> 78 </span><span class="spaces"> </span><span class="nottickedoff">mv &lt;- liftM STS $ newMVar Map.empty</span>
+<span class="lineno"> 79 </span><span class="spaces"></span><span class="nottickedoff"></span>
+<span class="lineno"> 80 </span><span class="spaces"> </span><span class="nottickedoff">return $ (addOnLoadHook (assignIds sr) $</span>
+<span class="lineno"> 81 </span><span class="spaces"> </span><span class="nottickedoff">bindSplice &quot;static&quot; (staticImpl mv) ts,</span>
+<span class="lineno"> 82 </span><span class="spaces"> </span><span class="nottickedoff">mv)</span>
+<span class="lineno"> 83 </span><span class="spaces"></span><span class="nottickedoff"></span>
+<span class="lineno"> 84 </span><span class="spaces"> </span><span class="nottickedoff">where</span>
+<span class="lineno"> 85 </span><span class="spaces"> </span><span class="nottickedoff">generateId :: IO Int</span>
+<span class="lineno"> 86 </span><span class="spaces"> </span><span class="nottickedoff">generateId = getStdRandom random</span>
+<span class="lineno"> 87 </span><span class="spaces"></span><span class="nottickedoff"></span>
+<span class="lineno"> 88 </span><span class="spaces"> </span><span class="nottickedoff">assignIds setref = mapM f</span>
+<span class="lineno"> 89 </span><span class="spaces"> </span><span class="nottickedoff">where</span>
+<span class="lineno"> 90 </span><span class="spaces"> </span><span class="nottickedoff">f node = g $ fromNode node</span>
+<span class="lineno"> 91 </span><span class="spaces"></span><span class="nottickedoff"></span>
+<span class="lineno"> 92 </span><span class="spaces"> </span><span class="nottickedoff">getId = do</span>
+<span class="lineno"> 93 </span><span class="spaces"> </span><span class="nottickedoff">i &lt;- liftM (T.pack . show) generateId</span>
+<span class="lineno"> 94 </span><span class="spaces"> </span><span class="nottickedoff">st &lt;- readIORef setref</span>
+<span class="lineno"> 95 </span><span class="spaces"> </span><span class="nottickedoff">if Set.member i st</span>
+<span class="lineno"> 96 </span><span class="spaces"> </span><span class="nottickedoff">then getId</span>
+<span class="lineno"> 97 </span><span class="spaces"> </span><span class="nottickedoff">else do</span>
+<span class="lineno"> 98 </span><span class="spaces"> </span><span class="nottickedoff">writeIORef setref $ Set.insert i st</span>
+<span class="lineno"> 99 </span><span class="spaces"> </span><span class="nottickedoff">return i</span>
+<span class="lineno"> 100 </span><span class="spaces"></span><span class="nottickedoff"></span>
+<span class="lineno"> 101 </span><span class="spaces"> </span><span class="nottickedoff">g curs = do</span>
+<span class="lineno"> 102 </span><span class="spaces"> </span><span class="nottickedoff">let node = current curs</span>
+<span class="lineno"> 103 </span><span class="spaces"> </span><span class="nottickedoff">curs' &lt;- if tagName node == Just &quot;static&quot;</span>
+<span class="lineno"> 104 </span><span class="spaces"> </span><span class="nottickedoff">then do</span>
+<span class="lineno"> 105 </span><span class="spaces"> </span><span class="nottickedoff">i &lt;- getId</span>
+<span class="lineno"> 106 </span><span class="spaces"> </span><span class="nottickedoff">return $ modifyNode (setAttribute &quot;id&quot; i) curs</span>
+<span class="lineno"> 107 </span><span class="spaces"> </span><span class="nottickedoff">else return curs</span>
+<span class="lineno"> 108 </span><span class="spaces"> </span><span class="nottickedoff">let mbc = nextDF curs'</span>
+<span class="lineno"> 109 </span><span class="spaces"> </span><span class="nottickedoff">maybe (return $ topNode curs') g mbc</span></span>
+<span class="lineno"> 110 </span>
+<span class="lineno"> 111 </span>
<span class="lineno"> 112 </span>
<span class="lineno"> 113 </span>
-<span class="lineno"> 114 </span>
-<span class="lineno"> 115 </span>
</pre>
</html>
View
26 static/docs/heist-hpc/Text.Templating.Heist.Splices.hs.html
@@ -12,17 +12,21 @@
<span class="lineno"> 1 </span>module Text.Templating.Heist.Splices
<span class="lineno"> 2 </span> ( module Text.Templating.Heist.Splices.Apply
<span class="lineno"> 3 </span> , module Text.Templating.Heist.Splices.Bind
-<span class="lineno"> 4 </span> , module Text.Templating.Heist.Splices.Ignore
-<span class="lineno"> 5 </span> , module Text.Templating.Heist.Splices.Markdown
-<span class="lineno"> 6 </span> , module Text.Templating.Heist.Splices.Static
-<span class="lineno"> 7 </span> ) where
-<span class="lineno"> 8 </span>
-<span class="lineno"> 9 </span>import Text.Templating.Heist.Splices.Apply
-<span class="lineno"> 10 </span>import Text.Templating.Heist.Splices.Bind
-<span class="lineno"> 11 </span>import Text.Templating.Heist.Splices.Ignore
-<span class="lineno"> 12 </span>import Text.Templating.Heist.Splices.Markdown
-<span class="lineno"> 13 </span>import Text.Templating.Heist.Splices.Static
-<span class="lineno"> 14 </span>
+<span class="lineno"> 4 </span> , module Text.Templating.Heist.Splices.Cache
+<span class="lineno"> 5 </span> , module Text.Templating.Heist.Splices.Html
+<span class="lineno"> 6 </span> , module Text.Templating.Heist.Splices.Ignore
+<span class="lineno"> 7 </span> , module Text.Templating.Heist.Splices.Markdown
+<span class="lineno"> 8 </span> , module Text.Templating.Heist.Splices.Static
+<span class="lineno"> 9 </span> ) where
+<span class="lineno"> 10 </span>
+<span class="lineno"> 11 </span>import Text.Templating.Heist.Splices.Apply
+<span class="lineno"> 12 </span>import Text.Templating.Heist.Splices.Bind
+<span class="lineno"> 13 </span>import Text.Templating.Heist.Splices.Cache
+<span class="lineno"> 14 </span>import Text.Templating.Heist.Splices.Html
+<span class="lineno"> 15 </span>import Text.Templating.Heist.Splices.Ignore
+<span class="lineno"> 16 </span>import Text.Templating.Heist.Splices.Markdown
+<span class="lineno"> 17 </span>import Text.Templating.Heist.Splices.Static
+<span class="lineno"> 18 </span>
</pre>
</html>
View
1,173 static/docs/heist-hpc/Text.Templating.Heist.Tests.hs.html
612 additions, 561 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
620 static/docs/heist-hpc/Text.Templating.Heist.Types.hs.html
@@ -12,28 +12,28 @@
<span class="lineno"> 1 </span>{-# LANGUAGE FlexibleInstances #-}
<span class="lineno"> 2 </span>{-# LANGUAGE GeneralizedNewtypeDeriving #-}
<span class="lineno"> 3 </span>{-# LANGUAGE MultiParamTypeClasses #-}
-<span class="lineno"> 4 </span>{-# LANGUAGE OverloadedStrings #-}
-<span class="lineno"> 5 </span>{-# LANGUAGE PackageImports #-}
-<span class="lineno"> 6 </span>{-# LANGUAGE ScopedTypeVariables #-}
-<span class="lineno"> 7 </span>{-# LANGUAGE UndecidableInstances #-}
-<span class="lineno"> 8 </span>
-<span class="lineno"> 9 </span>{-|
-<span class="lineno"> 10 </span>
-<span class="lineno"> 11 </span>This module contains the core Heist data types. TemplateMonad intentionally
-<span class="lineno"> 12 </span>does not expose any of its functionality via MonadState or MonadReader
-<span class="lineno"> 13 </span>functions. We define passthrough instances for the most common types of
-<span class="lineno"> 14 </span>monads. These instances allow the user to use TemplateMonad in a monad stack
-<span class="lineno"> 15 </span>without needing calls to `lift`.
-<span class="lineno"> 16 </span>
-<span class="lineno"> 17 </span>Edward Kmett wrote most of the TemplateMonad code and associated instances,
-<span class="lineno"> 18 </span>liberating us from the unused writer portion of RWST.
-<span class="lineno"> 19 </span>
-<span class="lineno"> 20 </span>-}
-<span class="lineno"> 21 </span>
-<span class="lineno"> 22 </span>module Text.Templating.Heist.Types where
-<span class="lineno"> 23 </span>
-<span class="lineno"> 24 </span>------------------------------------------------------------------------------
-<span class="lineno"> 25 </span>import Control.Applicative
+<span class="lineno"> 4 </span>{-# LANGUAGE PackageImports #-}
+<span class="lineno"> 5 </span>{-# LANGUAGE ScopedTypeVariables #-}
+<span class="lineno"> 6 </span>{-# LANGUAGE UndecidableInstances #-}
+<span class="lineno"> 7 </span>
+<span class="lineno"> 8 </span>{-|
+<span class="lineno"> 9 </span>
+<span class="lineno"> 10 </span>This module contains the core Heist data types. TemplateMonad intentionally
+<span class="lineno"> 11 </span>does not expose any of its functionality via MonadState or MonadReader
+<span class="lineno"> 12 </span>functions. We define passthrough instances for the most common types of
+<span class="lineno"> 13 </span>monads. These instances allow the user to use TemplateMonad in a monad stack
+<span class="lineno"> 14 </span>without needing calls to `lift`.
+<span class="lineno"> 15 </span>
+<span class="lineno"> 16 </span>Edward Kmett wrote most of the TemplateMonad code and associated instances,
+<span class="lineno"> 17 </span>liberating us from the unused writer portion of RWST.
+<span class="lineno"> 18 </span>
+<span class="lineno"> 19 </span>-}
+<span class="lineno"> 20 </span>
+<span class="lineno"> 21 </span>module Text.Templating.Heist.Types where
+<span class="lineno"> 22 </span>
+<span class="lineno"> 23 </span>------------------------------------------------------------------------------
+<span class="lineno"> 24 </span>import Control.Applicative
+<span class="lineno"> 25 </span>import Control.Arrow
<span class="lineno"> 26 </span>import Control.Monad.Cont
<span class="lineno"> 27 </span>import Control.Monad.Error
<span class="lineno"> 28 </span>import Control.Monad.Reader
@@ -66,305 +66,321 @@
<span class="lineno"> 55 </span>type TPath = [ByteString]
<span class="lineno"> 56 </span>
<span class="lineno"> 57 </span>
-<span class="lineno"> 58 </span>------------------------------------------------------------------------------
-<span class="lineno"> 59 </span>-- | All documents representing templates are stored in a map.
-<span class="lineno"> 60 </span>type TemplateMap = Map TPath X.Document
-<span class="lineno"> 61 </span>
+<span class="lineno"> 58 </span>data <span class="istickedoff">DocumentFile</span> = DocumentFile
+<span class="lineno"> 59 </span> { dfDoc :: X.Document
+<span class="lineno"> 60 </span> , dfFile :: Maybe FilePath
+<span class="lineno"> 61 </span> } deriving (<span class="decl"><span class="nottickedoff"><span class="decl"><span class="nottickedoff">Eq</span></span></span></span>)
<span class="lineno"> 62 </span>
<span class="lineno"> 63 </span>------------------------------------------------------------------------------
-<span class="lineno"> 64 </span>-- | A Splice is a TemplateMonad computation that returns a 'Template'.
-<span class="lineno"> 65 </span>type Splice m = TemplateMonad m Template
+<span class="lineno"> 64 </span>-- | All documents representing templates are stored in a map.
+<span class="lineno"> 65 </span>type TemplateMap = Map TPath DocumentFile
<span class="lineno"> 66 </span>
<span class="lineno"> 67 </span>
<span class="lineno"> 68 </span>------------------------------------------------------------------------------
-<span class="lineno"> 69 </span>-- | SpliceMap associates a name and a Splice.
-<span class="lineno"> 70 </span>type SpliceMap m = Map Text (Splice m)
+<span class="lineno"> 69 </span>-- | A Splice is a TemplateMonad computation that returns a 'Template'.
+<span class="lineno"> 70 </span>type Splice m = TemplateMonad m Template
<span class="lineno"> 71 </span>
<span class="lineno"> 72 </span>
<span class="lineno"> 73 </span>------------------------------------------------------------------------------
-<span class="lineno"> 74 </span>-- | Holds all the state information needed for template processing. You will
-<span class="lineno"> 75 </span>-- build a @TemplateState@ using any of Heist's @TemplateState m -&gt;
-<span class="lineno"> 76 </span>-- TemplateState m@ \&quot;filter\&quot; functions. Then you use the resulting
-<span class="lineno"> 77 </span>-- @TemplateState@ in calls to @renderTemplate@.
-<span class="lineno"> 78 </span>data <span class="istickedoff">TemplateState</span> m = TemplateState {
-<span class="lineno"> 79 </span> -- | A mapping of splice names to splice actions
-<span class="lineno"> 80 </span> _spliceMap :: SpliceMap m
-<span class="lineno"> 81 </span> -- | A mapping of template names to templates
-<span class="lineno"> 82 </span> , _templateMap :: TemplateMap
-<span class="lineno"> 83 </span> -- | A flag to control splice recursion
-<span class="lineno"> 84 </span> , _recurse :: Bool
-<span class="lineno"> 85 </span> -- | The path to the template currently being processed.
-<span class="lineno"> 86 </span> , _curContext :: TPath
-<span class="lineno"> 87 </span> -- | A counter keeping track of the current recursion depth to prevent
-<span class="lineno"> 88 </span> -- infinite loops.
-<span class="lineno"> 89 </span> , _recursionDepth :: Int
-<span class="lineno"> 90 </span> -- | A hook run on all templates at load time.
-<span class="lineno"> 91 </span> , _onLoadHook :: Template -&gt; IO Template
-<span class="lineno"> 92 </span> -- | A hook run on all templates just before they are rendered.
-<span class="lineno"> 93 </span> , _preRunHook :: Template -&gt; m Template
-<span class="lineno"> 94 </span> -- | A hook run on all templates just after they are rendered.
-<span class="lineno"> 95 </span> , _postRunHook :: Template -&gt; m Template
-<span class="lineno"> 96 </span> -- | The doctypes encountered during template processing.
-<span class="lineno"> 97 </span> , _doctypes :: [X.DocType]
-<span class="lineno"> 98 </span>}
-<span class="lineno"> 99 </span>
-<span class="lineno"> 100 </span>
-<span class="lineno"> 101 </span>------------------------------------------------------------------------------
-<span class="lineno"> 102 </span>instance <span class="istickedoff">(Monad m) =&gt; Monoid (TemplateState m)</span> where
-<span class="lineno"> 103 </span> <span class="decl"><span class="istickedoff">mempty = TemplateState Map.empty Map.empty True [] <span class="nottickedoff">0</span></span>
-<span class="lineno"> 104 </span><span class="spaces"> </span><span class="istickedoff"><span class="nottickedoff">return</span> <span class="nottickedoff">return</span> <span class="nottickedoff">return</span> <span class="nottickedoff">[]</span></span></span>
-<span class="lineno"> 105 </span>
-<span class="lineno"> 106 </span> <span class="decl"><span class="istickedoff">(TemplateState s1 t1 r1 _ d1 o1 b1 a1 dt1) `mappend`</span>
-<span class="lineno"> 107 </span><span class="spaces"> </span><span class="istickedoff">(TemplateState s2 t2 r2 c2 d2 o2 b2 a2 dt2) =</span>
-<span class="lineno"> 108 </span><span class="spaces"> </span><span class="istickedoff">TemplateState <span class="nottickedoff">s</span> t r c2 <span class="nottickedoff">d</span> <span class="nottickedoff">(o1 &gt;=&gt; o2)</span> <span class="nottickedoff">(b1 &gt;=&gt; b2)</span> <span class="nottickedoff">(a1 &gt;=&gt; a2)</span></span>
-<span class="lineno"> 109 </span><span class="spaces"> </span><span class="istickedoff"><span class="nottickedoff">(dt1 `mappend` dt2)</span></span>
-<span class="lineno"> 110 </span><span class="spaces"> </span><span class="istickedoff">where</span>
-<span class="lineno"> 111 </span><span class="spaces"> </span><span class="istickedoff"><span class="nottickedoff">s = s1 `mappend` s2</span></span>
-<span class="lineno"> 112 </span><span class="spaces"> </span><span class="istickedoff">t = t1 `mappend` t2</span>
-<span class="lineno"> 113 </span><span class="spaces"> </span><span class="istickedoff">r = r1 &amp;&amp; r2</span>
-<span class="lineno"> 114 </span><span class="spaces"> </span><span class="istickedoff"><span class="nottickedoff">d = max d1 d2</span></span></span>
-<