You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Sylwester Lachiewicz (JIRA)" <ji...@apache.org> on 2019/05/28 17:17:01 UTC
[jira] [Updated] (DOXIA-583) XhtmlBaseSink : Table caption is
escaped incorrectly
[ https://issues.apache.org/jira/browse/DOXIA-583?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sylwester Lachiewicz updated DOXIA-583:
---------------------------------------
Fix Version/s: 1.9
> 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
> Fix For: 1.9
>
> Attachments: table-caption-escape.patch
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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. '&#x548c;' ) and are displayed correctly in the browser.
> However, in a table caption, the first '&' is escaped into '&amp;'.
> So, for example, the actual output becomes '&amp;#x548c;' while the expected output is '&#x548c;'.
> 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 '&amp;' 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)