Пример #1
0
 def tohtml(self, text):
     if not text:
         return ''
     mkp = markups.get(self.markup)
     if mkp:
         handler = mkp.get('handler')
         text = handler(text)
         text = loader.mark_safe(to_string(text))
     return text
Пример #2
0
 def tohtml(self, text):
     if not text:
         return ''
     mkp = markups.get(self.markup)
     if mkp:
         handler = mkp.get('handler')
         text = handler(text)
         text = loader.mark_safe(to_string(text))
     return text
Пример #3
0
def docs():
    try:
        rst = markups.get('rst')['handler']
    except:
        rst = lambda x : x
    choices = [('','-----------')]
    text = []
    for name in sorted(function_registry):
        title,body = function_title_and_body(name)
        body = rst(body)
        choices.append((name,title))
        text.append((name,body))
    return html.TextSelect(choices,text)
Пример #4
0
 def render_instance_default(self, request, instance, **kwargs):
     mkp = markups.get(instance.markup)
     text = instance.body
     if mkp:
         text = mkp(request, text)
     w = Widget('div', text, cn=classes.sitecontent)
     if instance.javascript:
         g = script_template % instance.javascript
         script = g.replace('\r\n', '\n')
         if request.is_xhr:
             w.add(script)
         else:
             request.media.add(media.Media(js=[script]))
     return w.render(request)
Пример #5
0
 def render_instance_default(self, request, instance, **kwargs):
     mkp = markups.get(instance.markup)
     text = instance.body
     if mkp:
         text = mkp(request, text)
     w = Widget('div', text, cn=classes.sitecontent)
     if instance.javascript:
         g = script_template % instance.javascript
         script = g.replace('\r\n','\n')
         if request.is_xhr:
             w.add(script)
         else:
             request.media.add(media.Media(js=[script]))
     return w.render(request)