Edgewall Software

Version 12 (modified by Carsten Klein <carsten.klein@…>, 8 years ago) (diff)


Pluggable Directives Libraries (#395)


  • provide for a framework for introducing additional directives into the system, even from different namespace
  • TODO existing directives may be overridden, i.e. alternate versions will simply replace existing directives from a different library
    • might require some configuration by the user for choosing the correct implementation, if multiple such replacements are available
  • zero configuration effort by the user
    • detection of available directives libraries is via the [genshi.libraries.directives] entry point
    • available directives libraries in the system will be automatically loaded by the system
  • api for programmatically adding new directives libraries (similar to the current concept of pluggable DirectiveFactory's, which will be dropped once this is stable)
  • extended text based templates, see WorkInProgress/PluggableDirectivesLibraries/TextTemplates
  • execution order of directives must be redefined so that directives defined by third party libraries will be executed in the correct order, and if a given directive does not impose any restrictions on its execution order, then it will be executed in document order
    • this allows for adding new directives to existing directive namespaces
    • this seems more natural since we are not dealing with operators here and as it is also found in common programming languages where the in-source order of statements is the normally the same order that they are executed in
  • refactoring of the i18n filter into a filter module and a directives library (DONE, untested)
  • refactoring of the standard directives into a base module and a directives library (DONE, tested)

Current Development State

  • currently in early alpha phase (existing test cases do not break and performance is comparable to standard genshi ~ 100..200..400 ms for rendering the trac templates incl. a site.html on my local system)

More information will be made available as soon as the initial prototype is working.


Feel free to add your wishes for this feature. Please do not remove existing wishes from other users, extend upon them.

  • see #296 for a py:element directive
  • see #321 for a py:comment directive
  • see #104 for a proposal on CDATA output (which could be made a directive)
  • working branch to develop this in a joint effort on g.e.o. directly

Example Directives Library

This example serves as a skeleton for ongoing development. It also serves as the initial documentation for the new feature.

Example setup.py

Example lib.py