"Fossies" - the Fresh Open Source Software Archive 
Member "pandoc-2.18/man/manfilter.lua" (4 Apr 2022, 951 Bytes) of package /linux/www/pandoc-2.18.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Lua source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
See also the last
Fossies "Diffs" side-by-side code changes report for "manfilter.lua":
2.17.0.1_vs_2.17.1.
1 -- we use preloaded text to get a UTF-8 aware 'upper' function
2 local text = require('text')
3
4 -- capitalize level 1 headers
5 function Header(el)
6 if el.level == 1 then
7 return pandoc.walk_block(el, {
8 Str = function(el)
9 return pandoc.Str(text.upper(el.text))
10 end })
11 end
12 end
13
14 -- unindent table content
15 function Table(el)
16 for _,body in ipairs(el.bodies) do
17 handleTableBody(body)
18 end
19 return el
20 end
21
22 local function handleCell(el)
23 if #el.contents > 0 and el.contents[1].t == "CodeBlock" then
24 table.insert(el.contents, 1, pandoc.RawBlock("man", ".RS -14n"))
25 table.insert(el.contents, pandoc.RawBlock("man", ".RE"))
26 end
27 end
28
29 function handleTableBody(el)
30 for _,row in ipairs(el.body) do
31 for _,cell in ipairs(row.cells) do
32 handleCell(cell)
33 end
34 end
35 end
36
37
38 -- replace links with link text
39 function Link(el)
40 return el.content
41 end
42
43 -- remove notes
44 function Note(el)
45 return {}
46 end