Test coverage report: markupmirror.markup.restructuredtext

# markupmirror.markup.restructuredtext: 20 total statements, 100.0% covered

Generated: Wed 2012-04-11 05:19 CDT

Source file: /home/buechler/Sites/django-markupmirror/markupmirror/markup/restructuredtext.py

Stats: 12 executed, 0 missed, 8 excluded, 21 ignored

1. `from django.utils.encoding import smart_str`
2. `from django.utils.translation import ugettext_lazy as _`
3. ``
4. `from markupmirror import settings`
5. `from markupmirror.markup.base import BaseMarkup`
6. `from markupmirror.markup.base import register_markup`
7. ``
8. ``
9. `class ReStructuredTextMarkup(BaseMarkup):`
10. `"""Markup transformer for reStructuredText content.`
11. ``
12. `"""`
13. `codemirror_mode = 'text/x-rst'`
14. `title = _(u"reStructuredText")`
15. ``
16. `def __init__(self):`
17. `self.filter_settings = settings.RESTRUCTUREDTEXT_FILTER`
18. `self.restructuredtext = publish_parts`
19. ``
20. `def convert(self, markup):`
21. `parts = self.restructuredtext(`
22. `source=smart_str(markup),`
23. `writer_name='html4css1',`
24. `settings_overrides=self.filter_settings)`
25. `# Intentionally return ``html_body`` instead of ``fragment`` as`
26. `# Django's templatetag does. ``html_body`` also includes the document's`
27. `# title and subtitle, and if the first parts of ``markup`` are`
28. `# headlines (=== or ---), they would be stripped off the result`
29. `# otherwise.`
30. `return parts['html_body']`
31. ``
32. ``
33. `# Only register if docutils is installed`
34. `try:`
35. `from docutils.core import publish_parts`
36. `register_markup(ReStructuredTextMarkup)`
37. `except ImportError:`
38. `pass`
39. ``
40. ``
41. `__all__ = ('ReStructuredTextMarkup',)`