summaryrefslogtreecommitdiff
path: root/rst_context.lua
diff options
context:
space:
mode:
Diffstat (limited to 'rst_context.lua')
-rw-r--r--rst_context.lua39
1 files changed, 38 insertions, 1 deletions
diff --git a/rst_context.lua b/rst_context.lua
index 5ca5573..7d0ef28 100644
--- a/rst_context.lua
+++ b/rst_context.lua
@@ -53,7 +53,14 @@ function rst_context.strong_emphasis (str)
end
function rst_context.paragraph (str)
- return "\n" .. [[\\startparagraph]] .. "\n" .. str .. "\n".. [[\\stopparagraph]] .. "\n"
+ -- ugly as hell and probably slow too, but the alternative would be lots of
+ -- concatenation
+ return string.format([[
+
+\\startparagraph
+%s
+\\stopparagraph
+]], str)
end
function rst_context.literal (str)
@@ -312,4 +319,34 @@ function rst_context.deflist_def (str)
\\definitiondef{%]] .. str .. [[}]]
end
+--------------------------------------------------------------------------------
+-- Field lists
+--------------------------------------------------------------------------------
+
+function rst_context.field_list (str)
+ return [[
+
+\\startfieldlist]] .. str .. [[\\stopfieldlist
+]]
+end
+
+function rst_context.field_name (str)
+ return [[\\fieldname{]] .. str .. [[}]]
+end
+
+function rst_context.field_body (str)
+ return [[\\fieldbody{]] .. str .. [[}]]
+end
+
+function rst_context.field (tab)
+ local name, body = tab[1], tab[2]
+ return string.format([[
+
+ \\startfield
+ \\fieldname{%s}
+ \\fieldbody{%s}
+ \\stopfield
+]], name, body)
+end
+
return rst_context