Search in sources :

Example 6 with XmlStreamWriter

use of org.eclipse.mylyn.wikitext.util.XmlStreamWriter in project mylyn.docs by eclipse.

the class MarkupToEclipseToc method createToc.

public String createToc(OutlineItem root) {
    StringWriter out = new StringWriter(8096);
    XmlStreamWriter writer = createXmlStreamWriter(out);
    // $NON-NLS-1$ //$NON-NLS-2$
    writer.writeStartDocument("utf-8", "1.0");
    if (copyrightNotice != null) {
        writer.writeComment(copyrightNotice);
    }
    // $NON-NLS-1$
    writer.writeStartElement("toc");
    // $NON-NLS-1$
    writer.writeAttribute("topic", adjustForPrefix(getHtmlFile()));
    // $NON-NLS-1$
    writer.writeAttribute("label", getBookTitle());
    emitToc(writer, root.getChildren());
    if (anchorLevel >= 0) {
        // $NON-NLS-1$
        writer.writeEmptyElement("anchor");
        // $NON-NLS-1$ //$NON-NLS-2$
        writer.writeAttribute("id", "additions");
    }
    // toc
    writer.writeEndElement();
    writer.writeEndDocument();
    writer.close();
    return out.toString();
}
Also used : StringWriter(java.io.StringWriter) XmlStreamWriter(org.eclipse.mylyn.wikitext.util.XmlStreamWriter) DefaultXmlStreamWriter(org.eclipse.mylyn.wikitext.util.DefaultXmlStreamWriter)

Example 7 with XmlStreamWriter

use of org.eclipse.mylyn.wikitext.util.XmlStreamWriter in project statecharts by Yakindu.

the class HubspotDocumentBuilder method endHeading.

@Override
public void endHeading() {
    if (!isEarlySeparator) {
        headings.add(currentHeading);
        isProcessingHeading = false;
        /* Write the permalink: */
        final XmlStreamWriter w = super.getWriter();
        w.writeStartElement("a");
        w.writeAttribute("href", '#' + currentHeading.getId());
        w.writeAttribute("class", "permalink");
        w.writeAttribute("title", "Permalink to \"" + currentHeading.getTitle() + "\"");
        w.writeAttribute("onclick", "copyPermalinkToClipboard(event, this);");
        w.writeStartElement("span");
        w.writeAttribute("class", "tooltip");
        w.writeCharacters("Copy link to clipboard");
        // span
        w.writeEndElement();
        // a
        w.writeEndElement();
        super.endHeading();
    }
}
Also used : XmlStreamWriter(org.eclipse.mylyn.wikitext.util.XmlStreamWriter)

Aggregations

XmlStreamWriter (org.eclipse.mylyn.wikitext.util.XmlStreamWriter)7 Writer (java.io.Writer)3 MarkupParser (org.eclipse.mylyn.wikitext.parser.MarkupParser)3 HtmlDocumentBuilder (org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder)3 File (java.io.File)2 StringWriter (java.io.StringWriter)2 DocBookDocumentBuilder (org.eclipse.mylyn.wikitext.parser.builder.DocBookDocumentBuilder)2 HtmlDocumentHandler (org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentHandler)2 BufferedOutputStream (java.io.BufferedOutputStream)1 FileOutputStream (java.io.FileOutputStream)1 FileReader (java.io.FileReader)1 FileWriter (java.io.FileWriter)1 OutputStreamWriter (java.io.OutputStreamWriter)1 BuildException (org.apache.tools.ant.BuildException)1 Item (org.eclipse.mylyn.docs.epub.opf.Item)1 SimplifiedHtmlDocumentBuilder (org.eclipse.mylyn.wikitext.commonmark.internal.spec.SimplifiedHtmlDocumentBuilder)1 Stylesheet (org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder.Stylesheet)1 DefaultXmlStreamWriter (org.eclipse.mylyn.wikitext.util.DefaultXmlStreamWriter)1 Test (org.junit.Test)1