Problem
Descriptions and messages of tests and commands are plain text currently. This let us missing some important web features like linking to other content.
One example is the linking of a test to an issue or to a usecase documented somewhere else.
Proposal
Instead of providing a highly specialized input mask for each kind of linking, I would propose a wiki like notation for descriptions. The renderers for wiki elements are pluggable. A renderer can have a configuration. Renderers are used to render description for the presentation of description and messages in the GUI, in the report and optionally in the report rendering of the interpreter.
Realisation
- A text will be splitted line by line
- Renderers are hold in a list, highest priority first
- Each renderer has a function isMatching(text)
- The first renderer matching is rendering the text
- A renderer returns an array of text fragments to be rendered again
- Text fragments are organised in a DOM as DOM text nodes
- Rendering means: replacing a text node with markup nodes
Limitations
Wiki notation can be much more complex by defining exclusions between elements. For example: a list element cannot contain a list element. This proposal does not cover such complex definitions.
Example renderers
ParamRenderer
Takes a text and surrounds this text with a <p> tag.
External link renderer
Such a renderer can be used to link to issue tracking systems background.
Such a renderer needs a configuration with following elements:
- a regular expression with grouping how to find the issue number in the text
- an url with a placeholder for the issue number
The renderer will replace the issue number text with a link to the issue.
Plain link renderer
The renderer will replace all words starting with http:// or https:// or ftp:// with a link.