diff options
author | Hans Hagen <pragma@wxs.nl> | 2011-01-23 20:36:00 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2011-01-23 20:36:00 +0100 |
commit | c0a0171425e8d8c2775d3b6de3b28740787fd3ee (patch) | |
tree | b044d532a7736a5c79a2c8dbd304e03c42037698 /tex/context/base/buff-ver.lua | |
parent | 94e8563927cb29baf940ea15f9f48c9e06e1f95c (diff) | |
download | context-c0a0171425e8d8c2775d3b6de3b28740787fd3ee.tar.gz |
beta 2011.01.23 20:36
Diffstat (limited to 'tex/context/base/buff-ver.lua')
-rw-r--r-- | tex/context/base/buff-ver.lua | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tex/context/base/buff-ver.lua b/tex/context/base/buff-ver.lua index 7427e1f86..91bf1c6a0 100644 --- a/tex/context/base/buff-ver.lua +++ b/tex/context/base/buff-ver.lua @@ -334,8 +334,11 @@ end local space_pattern = patterns.space^0 local name_pattern = R("az","AZ")^1 +-- the hack is needed in order to retain newlines when an escape happens at the +-- at the begin of a line; it also ensures proper line numbering; a bit messy + local function hack(pattern) - return Cs(pattern * Cc(signal)) -- hack to retain newlines + return Cs(pattern * Cc(signal)) end function visualizers.registerescapepattern(name,before,after,normalmethod,escapemethod) @@ -349,8 +352,7 @@ function visualizers.registerescapepattern(name,before,after,normalmethod,escape (before / "") * ((1 - after)^0 / (escapemethod or texmethod)) * (after / "") - -- + hack((1 - before)^1) / (normalmethod or defaultmethod) - + ((1 - before)^1) / (normalmethod or defaultmethod) + + hack((1 - before)^1) / (normalmethod or defaultmethod) )^0 escapepatterns[name] = escapepattern end @@ -601,7 +603,8 @@ local function filter(lines,settings) -- todo: inline or display in settings first, last = getrange(lines,first,last,range) first, last = getstrip(lines,first,last) end - local content = concat(lines,(settings.nature == "inline" and " ") or "\r",first,last) -- was \n + -- \r is \endlinechar but \n would is more generic so this choice is debatable + local content = concat(lines,(settings.nature == "inline" and " ") or "\n",first,last) return content, m end |