Working on DOXIA-227 I notice that the handling of images in BaseXhtmlSink and Parser is not what I expected. As I noted above, IMO figureCaption() should not write any alt or title attributes to the img tag. I think these sink events:
sink.figure();
sink.figureGraphics( "image.gif" );
sink.figureCaption();
sink.text( "Caption");
sink.figureCaption_();
sink.figure_();
should lead to something like the following HTML output:
<div class="figure">
<p><img src="image.gif"/></p>
<p>Caption</p>
</div>
while currently it's just
<img src="image.gif" alt="Caption"/>
IMO the figure() event should start a block-level, floating image with corresponding caption, while figureGraphics() alone can be used to insert in-line images. This change will not break any source document parsing and rendering, but there will be a backward problem for java classes where events are directly emitted into a sink. Eg the LinkcheckReport Mojo in maven-linkcheck-plugin has the following method for error icons (but I'm pretty sure this was copied from somewhere else):
private void iconError( Locale locale )
{
getSink().figure();
getSink().figureCaption();
getSink().text( i18n.getString( "linkcheck-report", locale, "report.linkcheck.icon.error" ) );
getSink().figureCaption_();
getSink().figureGraphics( "images/icon_error_sml.gif" );
getSink().figure_();
}
With DOXIA-204 this would have to be replaced by
private void iconError( Locale locale )
{
getSink().figureGraphics( AttributeSet );
}
where AttributeSet contains the src and alt (and other) attributes.
I think the best way is to add in the Sink API:
WDYT?