File: gitlab-math.lua

package info (click to toggle)
olm 3.2.16%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,208 kB
  • sloc: cpp: 15,245; ansic: 10,894; java: 3,244; objc: 2,291; javascript: 1,882; python: 1,839; makefile: 439; sh: 245; asm: 7; xml: 1
file content (17 lines) | stat: -rw-r--r-- 542 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function Math(el)
    if el.mathtype == "InlineMath" then
        if el.text:sub(1,1) == '`' and el.text:sub(#el.text) == '`' then
            local text = el.text:sub(2,#el.text-1)
            return pandoc.Math(el.mathtype, text)
        else
            local cont = pandoc.read(el.text)
            return { pandoc.Str("$") } .. cont.blocks[1].content .. { pandoc.Str("$") }
        end
    end
end

function CodeBlock(el)
    if el.classes[1] == "math" then
        return pandoc.Para({ pandoc.Math("DisplayMath", el.text) })
    end
end