[
https://issues.apache.org/jira/browse/DOXIA-583?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sylwester Lachiewicz reassigned DOXIA-583:
------------------------------------------
Assignee: Sylwester Lachiewicz
> XhtmlBaseSink : Table caption is escaped incorrectly
> ----------------------------------------------------
>
> Key: DOXIA-583
> URL: https://issues.apache.org/jira/browse/DOXIA-583
> Project: Maven Doxia
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.8
> Reporter: Iwao AVE!
> Assignee: Sylwester Lachiewicz
> Priority: Major
> Attachments: table-caption-escape.patch
>
>
> Background:
> We use maven-site-plugin to generate our documentation site (source is xdoc)
> and noticed that non-ASCII characters like Japanese or Chinese in table
> caption are not correctly displayed in the output html files.
> During generation, these characters are encoded to entities (e.g.
> '和' ) and are displayed correctly in the browser.
> However, in a table caption, the first '&' is escaped into '&'.
> So, for example, the actual output becomes '和' while the
> expected output is '和'.
> To verify the issue, modify
> org.apache.maven.doxia.sink.impl.XhtmlBaseSinkTest.testTableCaption() as
> follows.
> {code:java}
> public void testTableCaption()
> {
> try
> {
> sink = new XhtmlBaseSink( writer );
> sink.table();
> sink.tableRows( null, false );
> sink.tableCaption( attributes );
> // Insert '&'
> sink.text( "cap&tion" );
> sink.tableCaption_();
> sink.tableRows_();
> sink.table_();
> }
> finally
> {
> sink.close();
> }
> // the inserted '&' will become '&' instead of '&'
> assertEquals( "<table border=\"0\" class=\"bodyTable\">" +
> "<caption style=\"bold\">cap&tion</caption></table>",
> writer.toString() );
> }
> {code}
> Not sure if this is a proper fix, but I modified the following line in
> org.apache.maven.doxia.sink.impl.XhtmlBaseSink.write(String) ...
> {code:java}
> this.tableCaptionXMLWriterStack.getLast().writeText( unifyEOLs( text ) );
> {code}
> ... to ...
> {code:java}
> this.tableCaptionXMLWriterStack.getLast().writeMarkup( unifyEOLs( text ) );
> {code}
> ... and the issue was resolved without breaking existing tests.
> I have attached the above modification as a patch.
> Please let me know if you prefer a PR on GitHub or need more info.
> Thanks in advance,
> Iwao
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)