예제 #1
0
def format_creole(code):
    """Format creole syntax."""
    from creoleparser import creole2html
    rv = creole2html(code)
    if isinstance(rv, str):
        rv = rv.decode('utf-8')
    return u'<div class="wikitext">%s</div>' % rv
예제 #2
0
 def render(self, req, mimetype, content, filename=None, rev=None):
     """Returns wikicreole text as html"""
     text = content_to_unicode(self.env, content, mimetype)
     if text.startswith(u"\ufeff"):
         text = text[1:]
     html = creoleparser.creole2html(text)
     return html
예제 #3
0
def format_creole(code):
    """Format creole syntax."""
    from creoleparser import creole2html
    rv = creole2html(code)
    if isinstance(rv, str):
        rv = rv.decode('utf-8')
    return u'<div class="wikitext">%s</div>' % rv
예제 #4
0
def render_creole(text):
    """Returns wikicreole text as html"""
    if text.startswith(u"\ufeff"):
        text = text[1:]
    html = creoleparser.creole2html(text)
    # convert wikicreole normally, and add a wiki class to each tablea
    stream = creoleparser.creole2html.generate(text)
    embodied_stream = stream.filter(wrap_stream(u"body"))
    transformed_stream = embodied_stream | Transformer(".//table").attr("class", "wiki")
    disembodied_stream = transformed_stream.select("*")
    html = disembodied_stream.render()
    return html
예제 #5
0
def render_creole(text):
    """Returns wikicreole text as html"""
    if text.startswith(u"\ufeff"):
        text = text[1:]
    html = creoleparser.creole2html(text)
    # convert wikicreole normally, and add a wiki class to each tablea
    stream = creoleparser.creole2html.generate(text)
    embodied_stream = stream.filter(wrap_stream(u"body"))
    transformed_stream = embodied_stream | Transformer(".//table").attr(
        "class", "wiki")
    disembodied_stream = transformed_stream.select("*")
    html = disembodied_stream.render()
    return html
예제 #6
0
 def render(self, text, **kwargs):
     from creoleparser import creole2html
     return creole2html(text)
예제 #7
0
    def rendered_description(self):
        """The description after it's been rendered to html."""

        return creoleparser.creole2html(self.description)
예제 #8
0
파일: creole.py 프로젝트: ragb/blogtty
def render(text):   
    return creoleparser.creole2html(text)