diff options
author | Philipp Gesang <megas.kapaneus@gmail.com> | 2011-08-20 23:10:25 +0200 |
---|---|---|
committer | Philipp Gesang <megas.kapaneus@gmail.com> | 2011-08-20 23:10:25 +0200 |
commit | 0040a616d26d9974ada7abb8c49643c505ef7e91 (patch) | |
tree | 6a94a7ff4ddf74092d57db3c9ec55bbe60969b74 | |
parent | ab0a580b61ae53c4d22cb93fd52006cb102b92e9 (diff) | |
download | context-rst-0040a616d26d9974ada7abb8c49643c505ef7e91.tar.gz |
fixed the tab-indent substitution
-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) |