Search in sources :

Example 1 with HtmlBlock

use of com.enonic.xp.portal.impl.parser.HtmlBlock in project xp by enonic.

the class PostProcessEvaluator method processInstructions.

private HtmlBlocks processInstructions(final HtmlBlocks htmlBlocks) {
    final HtmlBlocks.Builder processedHtmlBlocks = HtmlBlocks.builder();
    for (HtmlBlock htmlBlock : htmlBlocks) {
        if (isInstruction(htmlBlock)) {
            final String instructionContent = ((Instruction) htmlBlock).getValue();
            final HtmlBlocks processedInstruction = executeInstruction(instructionContent);
            if (processedInstruction != null) {
                processedHtmlBlocks.addAll(processedInstruction);
            }
        } else {
            processedHtmlBlocks.add(htmlBlock);
        }
    }
    return processedHtmlBlocks.build();
}
Also used : HtmlBlocks(com.enonic.xp.portal.impl.parser.HtmlBlocks) HtmlBlock(com.enonic.xp.portal.impl.parser.HtmlBlock) Instruction(com.enonic.xp.portal.impl.parser.Instruction) PostProcessInstruction(com.enonic.xp.portal.postprocess.PostProcessInstruction)

Example 2 with HtmlBlock

use of com.enonic.xp.portal.impl.parser.HtmlBlock in project xp by enonic.

the class PostProcessEvaluator method processContributions.

private HtmlBlocks processContributions(final HtmlBlocks htmlBlocks) {
    final HtmlBlocks.Builder processedHtmlBlocks = HtmlBlocks.builder();
    for (HtmlBlock htmlBlock : htmlBlocks) {
        if (isTagMarker(htmlBlock)) {
            final HtmlTag htmlTag = ((TagMarker) htmlBlock).getTag();
            final StaticHtml injectionHtml = evalPostProcessInjection(htmlTag);
            if (injectionHtml != null) {
                processedHtmlBlocks.add(injectionHtml);
            }
        } else {
            processedHtmlBlocks.add(htmlBlock);
        }
    }
    return processedHtmlBlocks.build();
}
Also used : StaticHtml(com.enonic.xp.portal.impl.parser.StaticHtml) HtmlBlocks(com.enonic.xp.portal.impl.parser.HtmlBlocks) HtmlTag(com.enonic.xp.portal.postprocess.HtmlTag) HtmlBlock(com.enonic.xp.portal.impl.parser.HtmlBlock) TagMarker(com.enonic.xp.portal.impl.parser.TagMarker)

Aggregations

HtmlBlock (com.enonic.xp.portal.impl.parser.HtmlBlock)2 HtmlBlocks (com.enonic.xp.portal.impl.parser.HtmlBlocks)2 Instruction (com.enonic.xp.portal.impl.parser.Instruction)1 StaticHtml (com.enonic.xp.portal.impl.parser.StaticHtml)1 TagMarker (com.enonic.xp.portal.impl.parser.TagMarker)1 HtmlTag (com.enonic.xp.portal.postprocess.HtmlTag)1 PostProcessInstruction (com.enonic.xp.portal.postprocess.PostProcessInstruction)1