From c3ffa786cf5f3520aa81e5ca8f0be87c416a4693 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 28 Aug 2011 19:57:57 +0200 Subject: automatic CRLF -> LF conversion --- mod/tex/context/third/rst/rst_parser.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (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 ab391b1..eeaa5fd 100644 --- a/mod/tex/context/third/rst/rst_parser.lua +++ b/mod/tex/context/third/rst/rst_parser.lua @@ -26,6 +26,7 @@ local optional_setups = thirddata.rst_setups rst.strip_BOM = false rst.expandtab = false rst.shiftwidth = 4 +rst.crlf = true helpers.rst_debug = false local iowrite = io.write @@ -1397,6 +1398,13 @@ function file_helpers.insert_blank (raw) return raw end +function file_helpers.crlf (raw) + if raw:find"\r\n" then + return raw:gsub("\r\n", "\n") + end + return raw +end + local function load_file (name) f = assert(io.open(name, "r"), "Not a file!") if not f then return 1 end @@ -1407,6 +1415,9 @@ local function load_file (name) if thirddata.rst.strip_BOM then tmp = fh.strip_BOM(tmp) end + if thirddata.rst.crlf then + tmp = fh.crlf(tmp) + end if thirddata.rst.expandtab then tmp = fh.expandtab(tmp) end -- cgit v1.2.3