vivekkodu/sphinxcontrib_robotframework — pull request #5 by datakurre (2013-09-13 18:04:24+00:00)
Title: Refactor to use overriding directive to capture robot test sources; Include annotation library

Hi @vivekkodu,

I spent an afternoon with the project. If you can, try look for the discussion with me and peke at #robotframework channel. Main things:

- The next RF-release has been delayed a little, so it's enough to polish RestReader in early next week.
- I took a deep look into Docutils and the only way to easily both fix depenency issues with Pygments and prevent additional traverse for code-nodes is to use override CodeBlock-directive with a custom one, like:

```
from docutils.parsers.rst.directives.body import CodeBlock
from docutils.parsers.rst.directives import register_directive
from docutils.parsers.rst import DirectiveError

class CustomCodeBlock(CodeBlock):

def run(self):
try:
return super(CustomCodeBlock, self).run()
except DirectiveError, directive_error:
self.arguments = []
return super(CustomCodeBlock, self).run()

register_directive('code', CustomCodeBlock)
```
- The above example would replace CodeBlock-directive with a one, with would run also without Pygments
- collect_robot_nodes could be replaced with an approach that I use in this pull request in for the Sphinx-plugin: I simply add and keep updating a custom _robot_source -attriute for the doctree-object
- I fixed an issue, which prevented Sphinx from seeing the new images created by robot tests
- I moved my screenshot annotation library from p.a.robotframework into this and included an example of usagae