diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/tex/context/third/rst/rst_parser.lua | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/mod/tex/context/third/rst/rst_parser.lua b/mod/tex/context/third/rst/rst_parser.lua index 38ccecd..8951542 100644 --- a/mod/tex/context/third/rst/rst_parser.lua +++ b/mod/tex/context/third/rst/rst_parser.lua @@ -34,7 +34,7 @@ else rst = require "rst_context" end -rst.stripBOM = false +rst.strip_BOM = false rst.expandtab = false rst.shiftwidth = 4 helpers.rst_debug = false @@ -1364,13 +1364,14 @@ end do local space = " " - - local tab = P"\t" - local eol = P"\n" - local indent = eol * tab function file_helpers.expandtab (raw) local spaces = space:rep(rst.shiftwidth) - local detabber = Cs(tab / spaces * (indent / "\n" .. spaces + 1)^0) + + local tab = P"\t" / spaces + local eol = P"\n" + local indent = eol * tab^1 + local detabber = Cs(tab^-1 * (indent + 1)^0) + return detabber:match(raw) end end @@ -1389,10 +1390,10 @@ local function load_file (name) f:close() local fh = file_helpers - if rst.strip_BOM then + if thirddata.rst.strip_BOM then tmp = fh.strip_BOM(tmp) end - if rst.expandtab then + if thirddata.rst.expandtab then tmp = fh.expandtab(tmp) end return fh.insert_blank(tmp) |