From 0040a616d26d9974ada7abb8c49643c505ef7e91 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 20 Aug 2011 23:10:25 +0200 Subject: fixed the tab-indent substitution --- mod/tex/context/third/rst/rst_parser.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'mod/tex') 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) -- cgit v1.2.3