You are viewing a plain text version of this content. The canonical link for it is here.
Posted to doxia-commits@maven.apache.org by lt...@apache.org on 2009/02/25 08:54:22 UTC
svn commit: r747699 -
/maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java
Author: ltheussl
Date: Wed Feb 25 07:54:22 2009
New Revision: 747699
URL: http://svn.apache.org/viewvc?rev=747699&view=rev
Log:
Replace String by AttributeSet for text decoration attributes.
Modified:
maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java
Modified: maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java?rev=747699&r1=747698&r2=747699&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java (original)
+++ maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java Wed Feb 25 07:54:22 2009
@@ -61,9 +61,8 @@
/** Used to recognize the case of img inside figure. */
private boolean inFigure;
- // TODO: replace by AttributeSet
/** Decoration properties, eg for texts. */
- private String decoration;
+ private final SinkEventAttributeSet decoration = new SinkEventAttributeSet();;
/**
* <p>
@@ -143,21 +142,21 @@
}
else if ( parser.getName().equals( Tag.U.toString() ) )
{
- this.decoration = "underline";
+ decoration.addAttribute( SinkEventAttributes.DECORATION, "underline" );
}
else if ( parser.getName().equals( Tag.S.toString() )
|| parser.getName().equals( Tag.STRIKE.toString() )
|| parser.getName().equals( "del" ) )
{
- this.decoration = "line-through";
+ decoration.addAttribute( SinkEventAttributes.DECORATION, "line-through" );
}
else if ( parser.getName().equals( Tag.SUB.toString() ) )
{
- this.decoration = "sub";
+ decoration.addAttribute( SinkEventAttributes.VALIGN, "sub" );
}
else if ( parser.getName().equals( Tag.SUP.toString() ) )
{
- this.decoration = "sup";
+ decoration.addAttribute( SinkEventAttributes.VALIGN, "sup" );
}
else if ( parser.getName().equals( Tag.P.toString() ) )
{
@@ -446,11 +445,14 @@
else if ( parser.getName().equals( Tag.U.toString() )
|| parser.getName().equals( Tag.S.toString() )
|| parser.getName().equals( Tag.STRIKE.toString() )
- || parser.getName().equals( "del" )
- || parser.getName().equals( Tag.SUB.toString() )
+ || parser.getName().equals( "del" ) )
+ {
+ decoration.removeAttribute( SinkEventAttributes.DECORATION );
+ }
+ else if ( parser.getName().equals( Tag.SUB.toString() )
|| parser.getName().equals( Tag.SUP.toString() ) )
{
- this.decoration = null;
+ decoration.removeAttribute( SinkEventAttributes.VALIGN );
}
else if ( parser.getName().equals( Tag.DIV.toString() ) )
{
@@ -641,21 +643,7 @@
*/
if ( StringUtils.isNotEmpty( text ) )
{
- SinkEventAttributeSet atts = new SinkEventAttributeSet();
-
- if ( StringUtils.isNotEmpty( decoration ) )
- {
- if ( "underline".equals( decoration ) || "line-through".equals( decoration ) )
- {
- atts.addAttribute( SinkEventAttributes.DECORATION, decoration );
- }
- else if ( "sub".equals( decoration ) || "sup".equals( decoration ) )
- {
- atts.addAttribute( SinkEventAttributes.VALIGN, decoration );
- }
- }
-
- sink.text( text, atts );
+ sink.text( text, decoration );
}
}