diff options
author | Philipp Gesang <pgesang@ix.urz.uni-heidelberg.de> | 2010-09-17 09:53:31 +0200 |
---|---|---|
committer | Philipp Gesang <pgesang@ix.urz.uni-heidelberg.de> | 2010-09-17 09:53:31 +0200 |
commit | ecf071dcc4f2447eee93c76d3c6e4201c97b3589 (patch) | |
tree | ae7e6247d62c0919d5ec9f8ef56d0ee5a53c3e10 /rst_context.lua | |
parent | 279c04787d18e186c6c1c6bed2eb9002f8f0ec92 (diff) | |
download | context-rst-ecf071dcc4f2447eee93c76d3c6e4201c97b3589.tar.gz |
sectioning redone
Diffstat (limited to 'rst_context.lua')
-rw-r--r-- | rst_context.lua | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/rst_context.lua b/rst_context.lua index 6ace513..05ed14f 100644 --- a/rst_context.lua +++ b/rst_context.lua @@ -501,15 +501,16 @@ function rst_context.section (...) -- TODO general cleanup; move validity local tab = { ... } -- checking to parser. local section, str = true, "" local adornchar + local ulen = unicode.utf8.len if #tab == 3 then -- TODO use unicode length with ConTeXt adornchar = tab[1]:sub(1,1) - section = tab[1] == tab[3] and #tab[1] >= #tab[2] - section = get_line_pattern(adornchar):match(tab[1]) ~= nil and section + section = ulen(tab[1]) >= ulen(tab[2]) + --section = get_line_pattern(adornchar):match(tab[1]) ~= nil and section str = string.strip(tab[2]) else -- no overline adornchar = tab[2]:sub(1,1) - section = #tab[1] <= #tab[2] - section = get_line_pattern(adornchar):match(tab[2]) ~= nil and section + section = ulen(tab[1]) <= ulen(tab[2]) + --section = get_line_pattern(adornchar):match(tab[2]) ~= nil and section str = tab[1] end @@ -527,6 +528,8 @@ function rst_context.section (...) -- TODO general cleanup; move validity ref = get_context_reference (str) str = string.format("\n\\\\%s[%s]{%s}\n", sectionlevels[level], ref, str) + else + return [[{\\bf fix your sectioning!}\\endgraf}]] end return section and str or "" |