XWiki Rendering Framework » XWiki Rendering Architecture

XWiki Rendering Architecture

Last modified by Manuel Smeria on 2013/02/25 09:57

rendering-architecture-advanced.png

  • Parser: Parses some textual input in a given syntax and generates a XDOM object which is an AST representing the input into structured blocks.
  • Renderer: Takes a XDOM as input and generates some output.
  • Transformation: Takes some XDOM and modifies it to generate modified XDOM (see the list of Transformations). One important transformation is the MacroTransformation which looks for all macro blocks in the XDOM object and replaces them by blocks generated by various macros. Note that executing transformations is an optional step and if you don't run them then you'll get a XDOM object without any transformation applied on it (e.g. without macros executed).
  • Macro: Takes a macro definition as input and generates XDOM Blocks (see the list of Macros).

Macro Execution Process

Macros are executed by the "Macro Transformation". Here are rules that apply:

  • Macros can be registered for a given syntax or for all syntaxes.
  • Macros also have a priority which allows some macros to be executed before or after other macros. For example the "Include" macro runs first and the "Table Of Content" macro executes last (so that it can take into account all headers created by other macros).
  • The Macro Transformation finds all macro blocks defined in the passed XDOM object. For each macro block found it verifies if there's a macro registered for that macro block and for the target syntax. It then sorts all macros by priority and execute them one by one, replacing the macro block with the list of blocks generated by the macro, until there are no macro blocks left in the XDOM. Note that a macro can generate macro blocks.
Tags:
Created by Vincent Massol on 2011/03/08 16:22