summaryrefslogtreecommitdiff
path: root/filters
diff options
context:
space:
mode:
Diffstat (limited to 'filters')
-rw-r--r--filters/section-numbers.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/filters/section-numbers.lua b/filters/section-numbers.lua
new file mode 100644
index 0000000..04c168d
--- /dev/null
+++ b/filters/section-numbers.lua
@@ -0,0 +1,18 @@
+sections_count = 0
+
+if FORMAT:match 'html' then
+ function Header(el)
+
+ if not (el.level == 2) then
+ return el
+ end
+ local numb = pandoc.Str(tostring(sections_count + 1)..".")
+ sections_count = sections_count + 1
+ local new_cont = {numb, pandoc.Space()}
+ for i,v in ipairs(el.content) do
+ new_cont[i+2]=el.content[i]
+ end
+ el.content = new_cont
+ return el
+ end
+end