diff options
author | Philipp Gesang <pgesang@ix.urz.uni-heidelberg.de> | 2010-09-08 22:47:41 +0200 |
---|---|---|
committer | Philipp Gesang <pgesang@ix.urz.uni-heidelberg.de> | 2010-09-08 22:47:41 +0200 |
commit | 988814b6f26f4fbf54b70c66624cddece04d27bb (patch) | |
tree | 9a763aca0440e57943249d9e79e960bcec51b767 | |
parent | 875ca73b3e6d3f61097ae4c6ccae356743d6abef (diff) | |
download | context-rst-988814b6f26f4fbf54b70c66624cddece04d27bb.tar.gz |
small fix for sectioning
-rw-r--r-- | rst_context.lua | 16 | ||||
-rw-r--r-- | rst_parser.lua | 10 |
2 files changed, 16 insertions, 10 deletions
diff --git a/rst_context.lua b/rst_context.lua index 7a556ab..13e4522 100644 --- a/rst_context.lua +++ b/rst_context.lua @@ -468,7 +468,9 @@ function rst_context.table (str) end function rst_context.grid_table (tab) - local head = [[ + local head + if tab.has_head then + head = [[ \\setupTABLE[c][first] [background=color, backgroundcolor=grey, style=\tt] \\setupTABLE[c][each] [frame=on] \\setupTABLE[r][each] [frame=on] @@ -483,6 +485,14 @@ function rst_context.grid_table (tab) \\eTABLEhead \\bTABLEbody ]] + else + head = [[ +\\setupTABLE[c][each] [frame=on] +\\setupTABLE[r][each] [frame=on] +\\bTABLE[split=repeat,option=stretch] +\\bTABLEbody +]] + end local tail = [[ \\eTABLEbody @@ -498,8 +508,6 @@ function rst_context.grid_table (tab) end end - --if not ( r.sepline or - --r.sephead )then if not isempty then local row = [[\\bTR]] for n,c in ipairs(r) do @@ -519,13 +527,11 @@ function rst_context.grid_table (tab) end row = row .. "\n " .. [[\\bTC ]] .. celltext .. [[\\eTC]] - --print(c.parent) end end test = test .. row .. "\n" .. [[\\eTR]] .. "\n" end end - --return head .. test .. tail return head .. test .. tail end diff --git a/rst_parser.lua b/rst_parser.lua index 343b45c..768f689 100644 --- a/rst_parser.lua +++ b/rst_parser.lua @@ -203,8 +203,8 @@ local parser = P{ + Cs(V"section") / rst.escape + Cs(V"transition") --/ rst.escape + V"literal_block" - + Cs(V"list") / rst.escape + Cs(V"block_quote") / rst.escape + + Cs(V"list") / rst.escape + Cs(V"paragraph") / rst.escape , @@ -772,13 +772,13 @@ local parser = P{ -- Sectioning -------------------------------------------------------------------------------- - section_adorn = C(V"adornment_char"^1) * V"eol", + section_adorn = C(V"adornment_char"^1) * V"space"^0 * V"eol", -- The whitespace handling after the overline is necessary because headings -- without overline aren't allowed to be indented. - section = V"eol"^0 + section = V"blank_line"^0 * (V"section_adorn" * V"whitespace"^0)^-1 - * C((1 - V"whitespace") * (1 - V"eol" - V"adornment_char")^1) + * C((1 - V"whitespace") * (1 - V"eol")^1) * V"eol" * V"section_adorn" * V"eol"^-1 @@ -1110,7 +1110,7 @@ local parser = P{ table_header_hline = P"=", } -f = io.open("table.rst", "r") +f = io.open("inlinefmt.rst", "r") testdata = f:read("*all") f:close() |