Search in sources :

Example 1 with DocumentType

use of org.jsoup.nodes.DocumentType in project jsoup by jhy.

the class XmlTreeBuilder method insert.

void insert(Token.Doctype d) {
    DocumentType doctypeNode = new DocumentType(settings.normalizeTag(d.getName()), d.getPublicIdentifier(), d.getSystemIdentifier());
    doctypeNode.setPubSysKey(d.getPubSysKey());
    insertNode(doctypeNode);
}
Also used : DocumentType(org.jsoup.nodes.DocumentType)

Example 2 with DocumentType

use of org.jsoup.nodes.DocumentType in project gradle by gradle.

the class ReleaseNotesTransformer method transform.

private Reader transform(Reader in) throws IOException {
    if (jqueryFiles == null || releaseNotesJavascript == null || baseCss == null || releaseNotesCss == null) {
        throw new GradleException("filter isn't ready to transform");
    }
    Document document = Jsoup.parse(CharStreams.toString(in));
    document.outputSettings().indentAmount(2).prettyPrint(true);
    document.prependChild(new DocumentType("html", "", ""));
    document.head().append("<meta charset='utf-8'>").append("<meta name='viewport' content='width=device-width, initial-scale=1'>").append("<title>Gradle @version@ Release Notes</title>").append("<link rel='stylesheet' type='text/css' href='https://assets.gradle.com/lato/css/lato-font.css'/>");
    addCssToHead(document);
    addJavascriptToHead(document);
    wrapH2InSectionTopic(document);
    addAnchorsForHeadings(document);
    document.body().prepend("<h3 class='releaseinfo'>Version @version@</h3>");
    document.body().prepend("<h1>Gradle Release Notes</h1>");
    addTOC(document);
    wrapContentInContainer(document);
    String rewritten = document.body().html();
    // Turn Gradle Jira issue numbers into issue links
    rewritten = rewritten.replaceAll("GRADLE-\\d+", "<a href=\"https://issues.gradle.org/browse/$0\">$0</a>");
    // Turn Gradle Github issue numbers into issue links
    rewritten = rewritten.replaceAll("(gradle/[a-zA-Z\\-_]+)#(\\d+)", "<a href=\"https://github.com/$1/issues/$2\">$0</a>");
    document.body().html(rewritten);
    return new StringReader(document.toString());
}
Also used : GradleException(org.gradle.api.GradleException) StringReader(java.io.StringReader) DocumentType(org.jsoup.nodes.DocumentType) Document(org.jsoup.nodes.Document)

Example 3 with DocumentType

use of org.jsoup.nodes.DocumentType in project flow by vaadin.

the class BootstrapHandler method getBootstrapPage.

static Document getBootstrapPage(BootstrapContext context) {
    Document document = new Document("");
    DocumentType doctype = new DocumentType("html", "", "", document.baseUri());
    document.appendChild(doctype);
    Element html = document.appendElement("html");
    html.attr("lang", context.getUI().getLocale().getLanguage());
    Element head = html.appendElement("head");
    html.appendElement("body");
    List<Element> dependenciesToInlineInBody = setupDocumentHead(head, context);
    dependenciesToInlineInBody.forEach(dependency -> document.body().appendChild(dependency));
    setupDocumentBody(document);
    document.outputSettings().prettyPrint(false);
    BootstrapUtils.getInlineTargets(context).ifPresent(targets -> handleInlineTargets(context, head, document.body(), targets));
    BootstrapUtils.getInitialPageSettings(context).ifPresent(initialPageSettings -> handleInitialPageSettings(context, head, initialPageSettings));
    /* Append any theme elements to initial page. */
    handleThemeContents(context, document);
    BootstrapPageResponse response = new BootstrapPageResponse(context.getRequest(), context.getSession(), context.getResponse(), document, context.getUI(), context.getUriResolver());
    context.getSession().getService().modifyBootstrapPage(response);
    return document;
}
Also used : TargetElement(com.vaadin.flow.component.page.TargetElement) Element(org.jsoup.nodes.Element) DocumentType(org.jsoup.nodes.DocumentType) Document(org.jsoup.nodes.Document)

Aggregations

DocumentType (org.jsoup.nodes.DocumentType)3 Document (org.jsoup.nodes.Document)2 TargetElement (com.vaadin.flow.component.page.TargetElement)1 StringReader (java.io.StringReader)1 GradleException (org.gradle.api.GradleException)1 Element (org.jsoup.nodes.Element)1