diff options
author | Philipp Gesang <pgesang@ix.urz.uni-heidelberg.de> | 2010-09-04 01:07:17 +0200 |
---|---|---|
committer | Philipp Gesang <pgesang@ix.urz.uni-heidelberg.de> | 2010-09-04 01:07:17 +0200 |
commit | 1cc2bd29d90b5f8e60e3e51976666999dfbeabfa (patch) | |
tree | a34178da5d803bcab83a414627cfcd23c82ef09d /rst_context.lua | |
parent | b4b0dcb09b3c78cd5726477d5f83f71971b45d71 (diff) | |
download | context-rst-1cc2bd29d90b5f8e60e3e51976666999dfbeabfa.tar.gz |
generic field lists
Diffstat (limited to 'rst_context.lua')
-rw-r--r-- | rst_context.lua | 39 |
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 |