summaryrefslogtreecommitdiff
path: root/mod/tex/context/third/rst
diff options
context:
space:
mode:
authorPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2011-08-28 19:57:57 +0200
committerPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2011-08-28 19:57:57 +0200
commitc3ffa786cf5f3520aa81e5ca8f0be87c416a4693 (patch)
treede4c4f15a325327d8e92d06f23af676f51d9111f /mod/tex/context/third/rst
parentfe1a1b46df8ef729b213bb48d9f413d0da51ba3a (diff)
downloadcontext-rst-c3ffa786cf5f3520aa81e5ca8f0be87c416a4693.tar.gz
automatic CRLF -> LF conversion
Diffstat (limited to 'mod/tex/context/third/rst')
-rw-r--r--mod/tex/context/third/rst/rst_parser.lua11
1 files changed, 11 insertions, 0 deletions
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