File tree 3 files changed +76
-0
lines changed
3 files changed +76
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ title : Hello world
3
+ name : Lucas
4
+ dia : hoje
5
+ ---
6
+
7
+ # %title%
8
+
9
+ Hello, %name%
10
+
11
+ Hoje é %dia%
12
+
13
+ ``` brainfuck
14
+ ???
15
+ %title%
16
+ ```
17
+
18
+ ``` evalme
19
+ return pandoc.Para(tostring(2 + 2))
20
+ ```
Original file line number Diff line number Diff line change
1
+ local pandoc = require ' pandoc'
2
+ local utils = require ' pandoc.utils'
3
+ local stringify = utils .stringify
4
+
5
+ local gdoc = {}
6
+ local meta = {}
7
+
8
+ function Str (el ) do
9
+ -- print("chegou aqui = ", el.text)
10
+ local text = el .text
11
+ local rep = meta [text ]
12
+ if rep ~= nil then
13
+ text = rep
14
+ end
15
+ return pandoc .Str (text )
16
+ end
17
+ end
18
+
19
+ function Pandoc (doc ) do
20
+ gdoc = doc
21
+ for k , v in pairs (doc .meta ) do
22
+ meta [" %" .. k .. " %" ] = stringify (v )
23
+ -- print(k, " = ", stringify(v))
24
+ end
25
+ return doc
26
+ end
27
+ end
28
+
29
+ function CodeBlock (el ) do
30
+ local lang = el .attr .classes [1 ]
31
+ local text = el .text
32
+ if lang == " evalme" then
33
+ fn = load (text )
34
+ return fn ()
35
+ else
36
+ -- return pandoc.Para(text .. ":" .. lang)
37
+ end
38
+ end
39
+ end
40
+
41
+ return {
42
+ { Pandoc = Pandoc },
43
+ { Str = Str },
44
+ { CodeBlock = CodeBlock },
45
+ }
Original file line number Diff line number Diff line change
1
+ { pkgs ? import <nixpkgs> { } } :
2
+ pkgs . mkShell {
3
+ buildInputs = with pkgs ; [
4
+ pandoc
5
+ ] ;
6
+ shellHook = ''
7
+ function run {
8
+ pandoc demo.md -f markdown -t html --lua-filter filter.lua "$@"
9
+ }
10
+ '' ;
11
+ }
You can’t perform that action at this time.
0 commit comments