diff options
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 "" | 
