private ListItemBlock createFootnoteBlock(String content, int counter, MacroTransformationContext context)
        throws MacroExecutionException
    {
        List<Block> parsedContent;
        try {
            parsedContent = this.contentParser.parse(content, context, false, true).getChildren();
        } catch (MacroExecutionException e) {
            parsedContent = Collections.<Block>singletonList(new WordBlock(content));
        }
        Block result = new WordBlock("^");
        DocumentResourceReference reference = new DocumentResourceReference(null);
        reference.setAnchor(FOOTNOTE_REFERENCE_ID_PREFIX + counter);
        result = new LinkBlock(Collections.singletonList(result), reference, false);
        result.setParameter(ID_ATTRIBUTE_NAME, FOOTNOTE_ID_PREFIX + counter);
        result.setParameter(CLASS_ATTRIBUTE_NAME, "footnoteBackRef");
        result = new ListItemBlock(Collections.singletonList(result));
        result.addChild(new SpaceBlock());
        result.addChildren(parsedContent);
        return (ListItemBlock) result;
    }
private ListItemBlock createFootnoteBlock ( String content , int counter , MacroTransformationContext context ) throws MacroExecutionException { List < Block > parsedContent ; try { parsedContent = this . contentParser . parse ( content , context , false , true ) . getChildren ( ) ; } catch ( MacroExecutionException e ) { parsedContent = Collections . < Block > singletonList ( new WordBlock ( content ) ) ; } Block result = new WordBlock ( "^" ) ; DocumentResourceReference reference = new DocumentResourceReference ( null ) ; reference . setAnchor ( FOOTNOTE_REFERENCE_ID_PREFIX + counter ) ; result = new LinkBlock ( Collections . singletonList ( result ) , reference , false ) ; result . setParameter ( ID_ATTRIBUTE_NAME , FOOTNOTE_ID_PREFIX + counter ) ; result . setParameter ( CLASS_ATTRIBUTE_NAME , "footnoteBackRef" ) ; result = new ListItemBlock ( Collections . singletonList ( result ) ) ; result . addChild ( new SpaceBlock ( ) ) ; result . addChildren ( parsedContent ) ; return ( ListItemBlock ) result ; }
Generate the footnote block, a numbered list item containing a backlink to the footnote's reference, and the
actual footnote text, parsed into XDOM.

@param content the string representation of the actual footnote text; the content of the macro
@param counter the current footnote counter
@param context the macro transformation context, used for obtaining the correct parser for parsing the content
@return the generated footnote block
@throws MacroExecutionException if parsing the content fails