Search in sources :

Example 1 with Instruction

use of com.enonic.xp.portal.impl.parser.Instruction 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)

Aggregations

HtmlBlock (com.enonic.xp.portal.impl.parser.HtmlBlock)1 HtmlBlocks (com.enonic.xp.portal.impl.parser.HtmlBlocks)1 Instruction (com.enonic.xp.portal.impl.parser.Instruction)1 PostProcessInstruction (com.enonic.xp.portal.postprocess.PostProcessInstruction)1