From c268d41594fc6902dab42f20aaa281f3bfe379bb Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 2 Apr 2013 12:10:59 -0700 Subject: [PATCH] Handle CR when skipping newlines. --- src/main/java/com/samskivert/mustache/Mustache.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/samskivert/mustache/Mustache.java b/src/main/java/com/samskivert/mustache/Mustache.java index c758282..611e204 100644 --- a/src/main/java/com/samskivert/mustache/Mustache.java +++ b/src/main/java/com/samskivert/mustache/Mustache.java @@ -286,6 +286,9 @@ public class Mustache line++; // skip this newline character if we're configured to do so; TODO: handle CR if (skipNewline) { + // if the preceding character is '\r', strip that off too + int lastIdx = text.length()-1; + if (lastIdx >= 0 && text.charAt(lastIdx) == '\r') text.setLength(lastIdx); skipNewline = false; continue; }