Community
Participate
Working Groups
Build ID: CVS Head I extended the class org.eclipse.mylyn.wikitext.core.parser.builder.HtmlDocumentBuilder to create my own HTML Variation. Specifically I want to parameterize style sheets and include some javascript links. I found that the only ways to influence the <head>...<head/> contents at all are the calls to setTitle(...) and addCssStyleSheet(...). For me this is insufficient because I want to add some more attributes to the style sheet link. I also want to include a link to some Javascript file. The only way to make this work is to override beginDocument() and not call super.beginDocument(). So I have to write everything until <body> myself. Please provide a hook in HtmlDocumentBuilder.beginDocument() to allow subclasses adding own stuff to the HTML head.
Matthias, Thanks for the bug posting. Great idea. Feel free to post a patch to this bug, and I'll take a look in January.
Created attachment 121017 [details] mylyn/context/zip
Created attachment 121053 [details] patch for HtmlDocumentBuilder I added a patch that includes all the changes that I thought interesting for subclasses: - allow to add custom attributes for style sheets - provide a hook for subclasses appending custom elements in the HTML head section - defined body start and body end in own methods that may be overridden in subclasses (sometimes I want to do things like <div class="presentation"> and </div> inside the body but around everything that actually is in the body).
Created attachment 121324 [details] patch with changes Matthias, Thanks for the patch. I've attached a new patch based on yours with some notable changes: * eliminated @addToHead()@ in favor of @emitHeadContents()@ * altered @addCssStylesheet()@ to return a @Stylesheet@. This allows for attributes to be added without overloading the addCssStylesheet method * changes to corresponding Ant tasks to enable attributes there * a JUnit test Please take a look and let me know what you think.
Created attachment 121325 [details] mylyn/context/zip
I think the changes you made are good. They will do what I need. I couldn't apply it against a copy of the current cvs head, though, it seems it's already too far away.
Thanks for the feedback. Integrated into CVS with some minor changes. Please reopen this bug if there are any issues.
Created attachment 124030 [details] mylyn/context/zip