From 2a88b794d2d899a5cf9de2c346d663b894c51768 Mon Sep 17 00:00:00 2001 From: remm Date: Thu, 8 Mar 2007 15:52:15 +0000 Subject: [PATCH] - Use the trim property and trim directive, which should be equivalent to Jasper's own attribute. git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@516081 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/jasper/compiler/TextOptimizer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/java/org/apache/jasper/compiler/TextOptimizer.java b/java/org/apache/jasper/compiler/TextOptimizer.java index a53866ea3..82df5216f 100644 --- a/java/org/apache/jasper/compiler/TextOptimizer.java +++ b/java/org/apache/jasper/compiler/TextOptimizer.java @@ -29,6 +29,7 @@ public class TextOptimizer { static class TextCatVisitor extends Node.Visitor { private Options options; + private PageInfo pageInfo; private int textNodeCount = 0; private Node.TemplateText firstTextNode = null; private StringBuffer textBuffer; @@ -36,6 +37,7 @@ public class TextOptimizer { public TextCatVisitor(Compiler compiler) { options = compiler.getCompilationContext().getOptions(); + pageInfo = compiler.getPageInfo(); } public void doVisit(Node n) throws JasperException { @@ -70,8 +72,8 @@ public class TextOptimizer { } public void visit(Node.TemplateText n) throws JasperException { - - if (options.getTrimSpaces() && n.isAllSpace()) { + if ((options.getTrimSpaces() || pageInfo.isTrimDirectiveWhitespaces()) + && n.isAllSpace()) { n.setText(emptyText); return; } -- 2.11.0