diff options
author | Philipp Gesang <pgesang@ix.urz.uni-heidelberg.de> | 2010-09-21 22:05:49 +0200 |
---|---|---|
committer | Philipp Gesang <pgesang@ix.urz.uni-heidelberg.de> | 2010-09-21 22:05:49 +0200 |
commit | 6fca7b9582ac97d772152ad0bef822d37605b616 (patch) | |
tree | 002ef51fa1a6e2d4959be186a30994864f80fc79 /rst_helpers.lua | |
parent | 31bd1dd91c8d803a6c45ef9192b4ba11c7224501 (diff) | |
download | context-rst-6fca7b9582ac97d772152ad0bef822d37605b616.tar.gz |
error printing for formatter. whitespace issues.
Diffstat (limited to 'rst_helpers.lua')
-rw-r--r-- | rst_helpers.lua | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/rst_helpers.lua b/rst_helpers.lua index 92f41a2..d70e247 100644 --- a/rst_helpers.lua +++ b/rst_helpers.lua @@ -594,19 +594,22 @@ do whitespace = S" \t\v" + P"\n" / function() linelength = 0 end, nowhitespace = 1 - V"whitespace", ignore = P[[\\type{]] * (1 - P"}")^0 * P"}", + -- the initial whitespace of the “other” pattern must not be + -- enforced (“^1”) as it will break the exceptions (“ignore” + -- pattern)! In general it is better to have the wrapper ignore some + -- valid breaks than to not have it matching some valid strings at + -- all. other = Cmt(V"whitespace"^0 * (V"ignore" + (1 - V"whitespace")^1), function(s,i,w) linelength = linelength + ulen(w) return true end), wrapme = Cmt(V"whitespace"^1 * (1 - V"whitespace" - V"ignore")^1, function(s,i,w) local lw = ulen(w) - print(w) if linelength + lw > width then linelength = lw return true end return false - --end) / function (word) return "\n" .. match(V"whitespace"^1 * C((1 - V"whitespace")^1), word) end, end) / function (word) return "\n" .. word:match("[^%s]+") end, } |