예제 #1
0
def read_pad(request, slug, name):
    user = request.user
    group =  Group.objects.filter(name=user.email)[0]
    # if it exists, render it
    print "NAME:", name, "SLUG:", slug
    pads = Pad.objects.filter(name=name, slug=slug)
    if not pads:
        return redirect('/')
    pad = pads[0]

    # get pad body
    markdown = etherpad.getText(pad.padID)
    mymarkdown = MyMarkdown(extras=['header-ids', 'link-patterns'], link_patterns=link_patterns)
    editurl = "http://localhost:8081/author/" + slug + '/' + name

    ext = '.html'
    mimetype = '%s; charset=utf-8' % mimetypes.types_map[ext]
    frag = mymarkdown.convert(markdown)
        
    return render_to_response('coauthor/markeddown.html', 
        ctx(request, {'frag': frag,
            'editurl': editurl}))
예제 #2
0
 def get_pad_contents(self):
     return etherpad.getText(self.padID)