| Summary: | Improve HTML rendering for Confluence markup language (e.g. table borders) | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Wojciech Seliga <wseliga> | ||||||
| Component: | Mylyn | Assignee: | Torkild Resheim <torkildr> | ||||||
| Status: | RESOLVED WONTFIX | QA Contact: | |||||||
| Severity: | enhancement | ||||||||
| Priority: | P3 | CC: | torkildr | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Wojciech Seliga
Created attachment 166183 [details]
Adding more info (CSS classes and additional wrappers) to built document
first approach
Created attachment 166185 [details]
sample CSS used on the client side
Sample CSS which I set in the client code in following way.
myRichTextEditor.setRenderingEngine(new AbstractRenderingEngine() {
@Override
public String renderAsHtml(TaskRepository repository, String text, IProgressMonitor monitor)
throws CoreException {
final Reader reader = getCrucibleDefaultStylesheetContent();
final HtmlDocumentBuilder.Stylesheet styleSheet = new HtmlDocumentBuilder.Stylesheet(reader);
try {
markupParser.setMarkupLanguage(markupLanguage);
final StringWriter writer = new StringWriter();
final HtmlDocumentBuilder builder = new HtmlDocumentBuilder(writer) {
public void beginDocument() {
super.beginDocument();
beginBlock(BlockType.DIV, new Attributes());
Attributes attributes = new Attributes();
attributes.setCssClass("markup");
beginBlock(BlockType.DIV, attributes);
}
@Override
public void endDocument() {
endBlock();
endBlock();
super.endDocument();
}
};
builder.addCssStylesheet(styleSheet);
markupParser.setBuilder(builder);
markupParser.parse(text);
return writer.toString();
} finally {
try {
reader.close();
} catch (IOException e) {
StatusHandler.log(new Status(IStatus.WARNING, CrucibleUiPlugin.PLUGIN_ID,
"Cannot close CSS reader"));
}
}
}
});
This CSS is directly taken from CSS file used by web UI (with removed irrelevant sections). Note additional CSS selectors, which made me wrap some content.
I wanted to avoid modifying this CSS, to make easier in the future keeping it in sync with web UI
Thanks for the bug and patch. It's a great start. Some things I'd like to see: * there should be no need to subclass HtmlDocumentBuilder: all of this should occur in the markup language. * unit tests must be provided to verify that all of your changes work. See the org.eclipse.mylyn.wikitext.tests bundle for examples, specifically @org.eclipse.mylyn.wikitext.confluence.core.ConfluenceLanguageTest@ ** your changes likely break some of the existing tests, so your patch should update those tests. Great work, I look forward to the next iteration. Thanks David, I did not notice ConfluenceLanguageTest, I incorrectly assumed that Confluence tests would be in some Confluence specific bundle. I'll add them and fix broken tests. To keep things simple we have all WikiText tests in a single bundle. With Atlassian removing the wiki markup format in their Confluence 4.0 release I think continuing supporting Confluence is a waste of time. Proposing to resolve as WONTFIX. http://blogs.atlassian.com/2011/11/why-we-removed-wiki-markup-editor-in-confluence-4/ Thanks for the suggestion Torkild. Since this affects many bugs and support for Confluence wiki markup in general, I've opened up the discussion on the mylyn-docs-dev mailing list. *** Bug 336905 has been marked as a duplicate of this bug. *** Closed as part of backlog clean-up. Please re-open if you'd like to see this revisited, perhaps with a contribution. |