Package net.java.textilej.parser.builder

Examples of net.java.textilej.parser.builder.HtmlDocumentBuilder


      throw new IllegalStateException("Builder must not be set");
    }
   
    StringWriter out = new StringWriter();

    setBuilder(new HtmlDocumentBuilder(out));

    parse(textile);
   
    return out.toString();
  }
View Full Code Here


        writer = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(htmlOutputFile)),"utf-8");
      } catch (Exception e) {
        throw new BuildException(String.format("Cannot write to file '%s': %s",htmlOutputFile,e.getMessage()),e);
      }
      try {
        HtmlDocumentBuilder builder = new HtmlDocumentBuilder(writer) {
          @Override
          protected XmlStreamWriter createXmlStreamWriter(Writer out) {
            return super.createFormattingXmlStreamWriter(out);
          }
        };
        TextileParser parser = new TextileParser();
        parser.setBuilder(builder);
        parser.setDialect(new ConfluenceDialect());
        builder.setEmitDtd(true);
       
        parser.parse(textile);
      } finally {
        try {
          writer.close();
View Full Code Here

        writer = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(htmlOutputFile)),"utf-8");
      } catch (Exception e) {
        throw new BuildException(String.format("Cannot write to file '%s': %s",htmlOutputFile,e.getMessage()),e);
      }
      try {
        HtmlDocumentBuilder builder = new HtmlDocumentBuilder(writer) {
          @Override
          protected XmlStreamWriter createXmlStreamWriter(Writer out) {
            return super.createFormattingXmlStreamWriter(out);
          }
        };
        TextileParser parser = new TextileParser();
        parser.setBuilder(builder);
        parser.setDialect(new ConfluenceDialect());
        builder.setEmitDtd(true);
       
        parser.parse(textile);
      } finally {
        try {
          writer.close();
View Full Code Here

   * @see org.opoo.press.Converter#convert(java.lang.String)
   */
  @Override
  public String convert(String content) {
    StringWriter writer = new StringWriter();
    HtmlDocumentBuilder builder = new HtmlDocumentBuilder(writer);
    builder.setEmitAsDocument(false);
    parser.setBuilder(builder);
   
    parser.parse(content);
    parser.setBuilder(null);
    return writer.toString();
View Full Code Here

      throw new IllegalStateException("Builder must not be set");
    }
   
    StringWriter out = new StringWriter();

    setBuilder(new HtmlDocumentBuilder(out));

    parse(markupContent);
   
    setBuilder(null);
   
View Full Code Here

  public String parseToHtml(String textile) {
    if (builder != null) {
      throw new IllegalStateException("parseToHtml cannot be called if builder is set");
    }
    StringWriter out = new StringWriter();
    setBuilder(new HtmlDocumentBuilder(out));
    parse(textile);
    setBuilder(null);
    return out.toString();
  }
View Full Code Here

        writer = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(htmlOutputFile)),"utf-8");
      } catch (Exception e) {
        throw new BuildException(String.format("Cannot write to file '%s': %s",htmlOutputFile,e.getMessage()),e);
      }
      try {
        HtmlDocumentBuilder builder = new HtmlDocumentBuilder(writer) {
          @Override
          protected XmlStreamWriter createXmlStreamWriter(Writer out) {
            return super.createFormattingXmlStreamWriter(out);
          }
        };
        builder.setUseInlineStyles(useInlineCssStyles);
        builder.setSuppressBuiltInStyles(suppressBuiltInCssStyles);
        for (Stylesheet stylesheet: stylesheets) {
          if (stylesheet.url != null) {
            builder.addCssStylesheet(stylesheet.url);
          } else {
            builder.addCssStylesheet(stylesheet.file);
          }
        }
       
        builder.setTitle(title==null?name:title);
        MarkupParser parser = new MarkupParser();
        parser.setDialect(new TextileDialect());
        parser.setBuilder(builder);
        builder.setEmitDtd(true);
       
        parser.parse(textile);
      } finally {
        try {
          writer.close();
View Full Code Here

TOP

Related Classes of net.java.textilej.parser.builder.HtmlDocumentBuilder

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.