/** * Protect form recursive inclusion. * * @param currrentBlock the child block to check * @param reference the reference of the document being included * @throws MacroExecutionException recursive inclusion has been found */ private void checkRecursiveInclusion(Block currrentBlock, EntityReference reference) throws MacroExecutionException { // Check for parent context=new macros Stack<Object> references = this.inclusionsBeingExecuted.get(); if (references != null && references.contains(reference)) { throw new MacroExecutionException("Found recursive inclusion of document [" + reference + "]"); } // Check for parent context=current macros Block parentBlock = currrentBlock.getParent(); if (parentBlock != null) { if (parentBlock instanceof MacroMarkerBlock) { MacroMarkerBlock parentMacro = (MacroMarkerBlock) parentBlock; if (isRecursive(parentMacro, reference)) { throw new MacroExecutionException("Found recursive inclusion of document [" + reference + "]"); } } checkRecursiveInclusion(parentBlock, reference); } }
section.getParent().replaceChild(blocks, section);
substitution.src.getParent().replaceChild(substitution.dst, substitution.src);
wikiMacroBlock.setParent(syncMetaDataBlock.getParent()); wikiMacroBlock.setNextSiblingBlock(syncMetaDataBlock.getNextSibling()); wikiMacroBlock.setPreviousSiblingBlock(syncMetaDataBlock.getPreviousSibling()); if (syncMetaDataBlock != null) { syncMetaDataBlock.getParent().replaceChild(this.syncContext.getCurrentMacroBlock(), syncMetaDataBlock);