You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by we...@apache.org on 2002/06/12 22:38:38 UTC
cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core JellyTag.java
werken 2002/06/12 13:38:38
Modified: jelly/src/java/org/apache/commons/jelly/tags/core
JellyTag.java
Log:
Somehow missed this. Compiler dumber than I thought. (else, maven/ant is)
Revision Changes Path
1.7 +6 -53 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/JellyTag.java
Index: JellyTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/JellyTag.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- JellyTag.java 17 May 2002 15:18:08 -0000 1.6
+++ JellyTag.java 12 Jun 2002 20:38:37 -0000 1.7
@@ -87,22 +87,13 @@
/** The Log to which logging calls will be made. */
private static final Log log = LogFactory.getLog( JellyTag.class );
- /** whether whitespace should be trimmed or not. */
- private boolean trim = false;
-
- /** Whether we've trimmed or not */
- private boolean hasTrimmed;
-
public JellyTag() {
}
// Tag interface
//-------------------------------------------------------------------------
public void doTag(XMLOutput output) throws Exception {
- if ( trim && ! hasTrimmed ) {
- trimBody();
- hasTrimmed = true;
- }
+
if ( log.isDebugEnabled() ) {
log.debug( "Running body: " + getBody() );
}
@@ -112,43 +103,5 @@
// Properties
//-------------------------------------------------------------------------
- /** Sets whether whitespace should be trimmed or not. */
- public void setTrim(boolean trim) {
- this.trim = trim;
- }
-
- public void setBody(Script body) {
- super.setBody( body );
- hasTrimmed = false;
- }
-
- // Implementation methods
- //-------------------------------------------------------------------------
-
- /**
- * Find all text nodes inside the top level of this body and
- * if they are just whitespace then remove them
- */
- protected void trimBody() throws Exception {
- Script body = getBody();
- if ( body instanceof ScriptBlock ) {
- ScriptBlock block = (ScriptBlock) body;
- List list = block.getScriptList();
- for ( int i = list.size() - 1; i >= 0; i-- ) {
- Script script = (Script) list.get(i);
- if ( script instanceof TextScript ) {
- TextScript textScript = (TextScript) script;
- String text = textScript.getText();
- text = text.trim();
- if ( text.length() == 0 ) {
- list.remove(i);
- }
- else {
- textScript.setText(text);
- }
- }
- }
- }
- }
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>