Maven Doxia

Invalid XHTML because of wrong position of table caption

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0-alpha-9
  • Fix Version/s: 1.1
  • Component/s: Module - Xhtml
  • Labels:
    None
  • Number of attachments :
    1

Description

Currently a table caption is most of the time emitted after the table body (mainly because apt puts the caption after the table). However, for a valid xhtml-1.0, the table caption has to come before the first table row.

Since we don't have a mechanism yet to enforce the order of parsing events (see DOXIA-132), and I am not sure if this can be achieved in general, any sink should be flexible enough to deal with any reasonable order of events, to produce some valid output.

Issue Links

Activity

Hide
Vincent Siveton added a comment -

Here is a proposal. Please review!

Show
Vincent Siveton added a comment - Here is a proposal. Please review!
Hide
Vincent Siveton added a comment -

fixed in r707842

Show
Vincent Siveton added a comment - fixed in r707842
Hide
Lukas Theussl added a comment -

Vincent, I just noticed that this patch creates a backward compat problem because it is not possible anymore to create nested tables.
Eg the following snippet from generateDependencyDetails method in PIR's DependencyConvergenceReport causes an Exception:

sink.table();
        sink.tableRow();
        ...
        sink.tableCell();
        sink.table();
        ...
        sink.table_();
        sink.tableCell_();
        sink.tableRow_();
        sink.table_();

because the tableWriter is closed in the first table_() call. I think this is more severe than the original problem of invalid xhtml, so if it's not easily fixed, I'd prefer to revert this.

Show
Lukas Theussl added a comment - Vincent, I just noticed that this patch creates a backward compat problem because it is not possible anymore to create nested tables. Eg the following snippet from generateDependencyDetails method in PIR's DependencyConvergenceReport causes an Exception:
sink.table();
        sink.tableRow();
        ...
        sink.tableCell();
        sink.table();
        ...
        sink.table_();
        sink.tableCell_();
        sink.tableRow_();
        sink.table_();
because the tableWriter is closed in the first table_() call. I think this is more severe than the original problem of invalid xhtml, so if it's not easily fixed, I'd prefer to revert this.
Hide
Vincent Siveton added a comment -

I think that we need to fix the code instead of revert it.

The XhtmlBaseSink uses PrintWriter and 2 StringBuffer (one for the events and one for the current table) to write each events.
IMHO an idea is to use a unique StringBuffer to collect every event and write the content in the close():

public void close()
    {
        writer.write( buffer.toString() );
        writer.close();
    }
Show
Vincent Siveton added a comment - I think that we need to fix the code instead of revert it. The XhtmlBaseSink uses PrintWriter and 2 StringBuffer (one for the events and one for the current table) to write each events. IMHO an idea is to use a unique StringBuffer to collect every event and write the content in the close():
public void close()
    {
        writer.write( buffer.toString() );
        writer.close();
    }
Hide
Vincent Siveton added a comment -

Fixed it in r735478

Show
Vincent Siveton added a comment - Fixed it in r735478

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: