add a lua version
This commit is contained in:
15
output.html
15
output.html
@@ -1,5 +1,6 @@
|
||||
<p>Here’s the pandoc README:</p>
|
||||
<div class="sourceCode" id="cb1" data-include="filter.hs"><pre
|
||||
<div class="sourceCode" id="cb1" data-include="filter.hs"
|
||||
style="background-color: red"><pre
|
||||
class="sourceCode haskell"><code class="sourceCode haskell"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="dt">Foo</span><span class="ot">::</span> <span class="dt">Div</span> <span class="ot">-></span> <span class="dt">Div</span></span></code></pre></div>
|
||||
<div data-include="filter.hs">
|
||||
#!/usr/bin/env runhaskell
|
||||
@@ -10,15 +11,15 @@ import qualified Data.Text as T
|
||||
|
||||
file2Block :: FilePath -> IO [Block]
|
||||
file2Block f = do
|
||||
contents <- TIO.readFile f
|
||||
return [Plain [Str contents]]
|
||||
contents <- TIO.readFile f
|
||||
return [Plain [Str contents]]
|
||||
|
||||
doInclude :: Block -> IO Block
|
||||
doInclude cb@(Div (id, classes, namevals) contents) =
|
||||
case lookup (T.pack "include") namevals of
|
||||
Just f -> Div (id, classes, namevals) <$>
|
||||
file2Block (T.unpack f)
|
||||
Nothing -> return cb
|
||||
case lookup (T.pack "include") namevals of
|
||||
Just f -> Div (id, classes, namevals) <$> file2Block
|
||||
(T.unpack f)
|
||||
Nothing -> return cb
|
||||
doInclude x = return x
|
||||
|
||||
main :: IO ()
|
||||
|
||||
Reference in New Issue
Block a user