Author: ltheussl
Date: Mon Jun 8 14:32:26 2009
New Revision: 782647
URL: http://svn.apache.org/viewvc?rev=782647&view=rev
Log:
Simplify attribute filtering
Modified:
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
Modified:
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
URL:
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java?rev=782647&r1=782646&r2=782647&view=diff
==============================================================================
---
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
(original)
+++
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
Mon Jun 8 14:32:26 2009
@@ -771,24 +771,13 @@
atts.addAttribute( Attribute.SRC.toString(), src );
// http://xmlgraphics.apache.org/fop/graphics.html#resolution
- if ( attributes != null && attributes.isDefined(
SinkEventAttributes.WIDTH ) )
- {
- atts.addAttribute( "width", attributes.getAttribute(
SinkEventAttributes.WIDTH ) );
- }
- if ( attributes != null && attributes.isDefined( "content-width" ) )
- {
- atts.removeAttribute( "content-width" );
- atts.addAttribute( "content-width", attributes.getAttribute(
"content-width" ) );
- }
- if ( attributes != null && attributes.isDefined(
SinkEventAttributes.HEIGHT ) )
- {
- atts.addAttribute( "height", attributes.getAttribute(
SinkEventAttributes.HEIGHT ) );
- }
- if ( attributes != null && attributes.isDefined( "content-height" ) )
+ final String[] valids = new String[] {"content-height",
"content-width", "height", "width"};
+ final MutableAttributeSet filtered = SinkUtils.filterAttributes(
attributes, valids );
+
+ if ( filtered != null )
{
- atts.removeAttribute( "content-height" );
- atts.addAttribute( "content-height", attributes.getAttribute(
"content-height" ) );
+ atts.addAttributes( filtered );
}
writeln( "<fo:external-graphic" + SinkUtils.getAttributeString( atts )
+ "/>" );