Search in sources :

Example 1 with AttoParseException

use of org.attoparser.AttoParseException in project xp by enonic.

the class HtmlBlockParser method parse.

public HtmlBlocks parse(final String html) {
    this.currentBlock = new StringBuilder();
    this.htmlBlocks = HtmlBlocks.builder();
    try {
        final MarkupAttoParser parser = new MarkupAttoParser();
        parser.parse(html, new HtmlBlockParseAttoHandler(this));
        addStaticHtml();
        return this.htmlBlocks.build();
    } catch (final AttoParseException e) {
        final Throwable cause = e.getCause();
        if (cause instanceof RuntimeException) {
            throw (RuntimeException) cause;
        }
        throw new RenderException("Failed to post process document", cause != null ? cause : e);
    }
}
Also used : RenderException(com.enonic.xp.portal.impl.rendering.RenderException) MarkupAttoParser(org.attoparser.markup.MarkupAttoParser) AttoParseException(org.attoparser.AttoParseException)

Aggregations

RenderException (com.enonic.xp.portal.impl.rendering.RenderException)1 AttoParseException (org.attoparser.AttoParseException)1 MarkupAttoParser (org.attoparser.markup.MarkupAttoParser)1