close

Filter

loading table of contents...

Headless Server Developer Manual / Version 2010

Table Of Contents

5.8 HandlerSets Property

Using handler sets allows to group and reuse handlers in different contexts. In order to achieve this goal the YAML way, one or more handlers are grouped into a list of handlers, that is a handler set.

Example:

handlerSets:
  text: &text_handlers
    - !Handler
      eventMatcher:  !Matcher {qname: *em}
      outputHandler: !ElementWriter {writeElement: true, writeCharacters: true }
    - !Handler
      eventMatcher:  !Matcher {qname: *strong}
      outputHandler: !ElementWriter {writeElement: true, writeCharacters: true }
    
  • The subsequent property 'text' is up to the author and may be named accordingly to the YAML rules.

  • The list of handlers is anchored to the alias 'text_handlers'.

Example: reuse '*text_handlers' for a named context

      contexts:
        - !Context
          name: headline
          defaultHandler:
            !Handler
            outputHandler: !ElementWriter {writeCharacters: true}
          handlers:
            - *text_handlers
      ...
      

Search Results

Table Of Contents