public boolean handleBegin(TagContext context)
    {
        WikiParameters params = context.getParams();
        MacroInfo macroInfo = (MacroInfo) context.getTagStack().getStackParameter(MACRO_INFO);

        boolean withNonGeneratedContent = false;
        if (isMetaDataElement(params)) {
            MetaData metaData = createMetaData(params);

            if (metaData.contains(MetaData.SYNTAX)) {
                String currentSyntax = (String) metaData.getMetaData(MetaData.SYNTAX);
                context.getTagStack().pushStackParameter(CURRENT_SYNTAX, currentSyntax);
            }

            if (metaData.contains(MetaData.NON_GENERATED_CONTENT)) {
                String currentSyntaxParameter = this.getSyntax(context);
                try {
                    PrintRenderer renderer = this.componentManager.getInstance(PrintRenderer.class,
                        currentSyntaxParameter);
                    DefaultWikiPrinter printer = new DefaultWikiPrinter();
                    renderer.setPrinter(printer);
                    Listener listener;

                    if (context.getTagStack().isInsideBlockElement()) {
                        listener = new InlineFilterListener();
                        ((InlineFilterListener) listener).setWrappedListener(renderer);
                    } else {
                        listener = renderer;
                    }
                    XWikiGeneratorListener xWikiGeneratorListener = this.parser.createXWikiGeneratorListener(listener,
                        null);

                    context.getTagStack().pushScannerContext(new WikiScannerContext(xWikiGeneratorListener));
                    context.getTagStack().getScannerContext().beginDocument();
                    withNonGeneratedContent = true;
                    if (metaData.contains(MetaData.PARAMETER_NAME)) {
                        context.getTagStack().pushStackParameter(PARAMETER_CONTENT_NAME,
                            metaData.getMetaData(MetaData.PARAMETER_NAME));
                    }
                } catch (ComponentLookupException e) {
                    this.logger.error("Error while getting the appropriate renderer for syntax [{}]",
                        currentSyntaxParameter, e);
                }
            }
        }

        context.getTagStack().pushStackParameter(NON_GENERATED_CONTENT_STACK, withNonGeneratedContent);
        return withNonGeneratedContent || macroInfo != null;
    }
public boolean handleBegin ( TagContext context ) { WikiParameters params = context . getParams ( ) ; MacroInfo macroInfo = ( MacroInfo ) context . getTagStack ( ) . getStackParameter ( MACRO_INFO ) ; boolean withNonGeneratedContent = false ; if ( isMetaDataElement ( params ) ) { MetaData metaData = createMetaData ( params ) ; if ( metaData . contains ( MetaData . SYNTAX ) ) { String currentSyntax = ( String ) metaData . getMetaData ( MetaData . SYNTAX ) ; context . getTagStack ( ) . pushStackParameter ( CURRENT_SYNTAX , currentSyntax ) ; } if ( metaData . contains ( MetaData . NON_GENERATED_CONTENT ) ) { String currentSyntaxParameter = this . getSyntax ( context ) ; try { PrintRenderer renderer = this . componentManager . getInstance ( PrintRenderer . class , currentSyntaxParameter ) ; DefaultWikiPrinter printer = new DefaultWikiPrinter ( ) ; renderer . setPrinter ( printer ) ; Listener listener ; if ( context . getTagStack ( ) . isInsideBlockElement ( ) ) { listener = new InlineFilterListener ( ) ; ( ( InlineFilterListener ) listener ) . setWrappedListener ( renderer ) ; } else { listener = renderer ; } XWikiGeneratorListener xWikiGeneratorListener = this . parser . createXWikiGeneratorListener ( listener , null ) ; context . getTagStack ( ) . pushScannerContext ( new WikiScannerContext ( xWikiGeneratorListener ) ) ; context . getTagStack ( ) . getScannerContext ( ) . beginDocument ( ) ; withNonGeneratedContent = true ; if ( metaData . contains ( MetaData . PARAMETER_NAME ) ) { context . getTagStack ( ) . pushStackParameter ( PARAMETER_CONTENT_NAME , metaData . getMetaData ( MetaData . PARAMETER_NAME ) ) ; } } catch ( ComponentLookupException e ) { this . logger . error ( "Error while getting the appropriate renderer for syntax [{}]" , currentSyntaxParameter , e ) ; } } } context . getTagStack ( ) . pushStackParameter ( NON_GENERATED_CONTENT_STACK , withNonGeneratedContent ) ; return withNonGeneratedContent || macroInfo != null ; }
Handle the begin of a container element (div or span) which could contain a syntax metadata and/or a non
generated content metadata.
@param context the current tag context.
@return true if a non generated content metadata has been found or the macro info is not null.