File: restformatter.py

package info (click to toggle)
python-wikkid 0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 728 kB
  • sloc: python: 3,051; makefile: 12
file content (25 lines) | stat: -rw-r--r-- 724 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#
# Copyright (C) 2010 Wikkid Developers.
#
# This software is licensed under the GNU Affero General Public License
# version 3 (see the file LICENSE).

"""A text to html formatter using reStuctured Text."""

from docutils.core import publish_parts
from zope.interface import implementer

from wikkid.interface.formatter import ITextFormatter


@implementer(ITextFormatter)
class RestructuredTextFormatter(object):
    """Format text as HTML using restructured text."""

    def format(self, filename, text):
        """Format the text.

        I'm almost 100% positive that this method needs more args.
        """
        parts = publish_parts(text, writer_name='html')
        return parts['html_title'] + parts['body']