Package com.google.caja.plugin.templates

Examples of com.google.caja.plugin.templates.TemplateCompiler


    TemplateSanitizer ts = new TemplateSanitizer(htmlSchema, mq);
    for (IhtmlRoot ihtmlRoot : html) {
      ts.sanitize(ihtmlRoot.root);
    }

    TemplateCompiler tc = new TemplateCompiler(
        html, css, js, cssSchema, htmlSchema,
        jobs.getPluginMeta(), jobs.getMessageContext(), mq);
    Pair<List<SafeHtmlChunk>, List<SafeJsChunk>> htmlAndJs = tc.getSafeHtml(
        DomParser.makeDocument(null, null));

    for (SafeHtmlChunk outputHtml : htmlAndJs.a) {
      Job outJob = makeJobFromHtml(outputHtml.root, outputHtml.baseUri);
      if (outJob != null) {
View Full Code Here


    TemplateSanitizer ts = new TemplateSanitizer(htmlSchema, mq);
    for (IhtmlRoot ihtmlRoot : html) {
      ts.sanitize(ihtmlRoot.root);
    }

    TemplateCompiler tc = new TemplateCompiler(
        html, css, js, cssSchema, htmlSchema,
        jobs.getPluginMeta(), jobs.getMessageContext(), mq);
    Pair<List<SafeHtmlChunk>, List<SafeJsChunk>> htmlAndJs = tc.getSafeHtml(
        DomParser.makeDocument(null, null));

    for (SafeHtmlChunk outputHtml : htmlAndJs.a) {
      Job outJob = makeJobFromHtml(outputHtml.root, outputHtml.baseUri);
      if (outJob != null) {
View Full Code Here

        + "<div><script>a()</script>Hello <script>b()</script>World!!!</div>\n"
        + "<h1>Foo <b><script>c()</script>Bar</b> Baz</h1>\n"
        + "<h2 id='x'>Boo</h2>\n");
    PluginMeta meta = new PluginMeta();
    List<ScriptPlaceholder> extractedScripts = Lists.newArrayList();
    TemplateCompiler tc = new TemplateCompiler(
        Collections.singletonList(new IhtmlRoot(
            new JobEnvelope(
                null, JobCache.none(), ContentType.HTML, false, null),
            htmlWithScriptsExtracted(input, extractedScripts), is.getUri())),
        Collections.<ValidatedStylesheet>emptyList(), extractedScripts,
        CssSchema.getDefaultCss21Schema(mq), HtmlSchema.getDefault(mq),
        meta, mc, mq);
    Pair<List<SafeHtmlChunk>, List<SafeJsChunk>> htmlAndJs = tc.getSafeHtml(
        DomParser.makeDocument(null, null));

    assertEquals(
        ""
        + "<p>Hi</p>"
View Full Code Here

TOP

Related Classes of com.google.caja.plugin.templates.TemplateCompiler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.