@ Override protected Object doExec ( Element element , Object scope , String format , Object ... arguments ) throws IOException { Stack < Index > indexes = this . serializer . getIndexes ( ) ; if ( indexes . size ( ) == 0 ) { throw new TemplateException ( "Required ordered collection index is missing. Numbering operator cancel execution." ) ; } this . serializer . writeTextContent ( getNumbering ( this . serializer . getIndexes ( ) , format ) ) ; return null ; }
Insert formatted numbering as element text content . If serializer indexes stack is empty throws templates exception ; anyway validation tool running on build catches numbering operator without surrounding ordered list .