def test_render(): """ renders the wiki code as suitable html. """ from pygameweb.wiki.wiki import render assert render('') == '' assert render( '[[link#section]]') == '<a href="/wiki/link#section">link</a>' assert ( render('<div><table><tr><td>asdf</td></tr></table></div>') == '<div><div class="table-responsive"><table class="table"><tr><td>asdf</td></tr></table></div></div>' ) assert (render('<div><a href="asdf">asdf</a></div>') == '<div><a href="asdf?parent=" rel="nofollow">asdf</a></div>') table = """ <div><table border="0"> <tbody><tr> <td><a href="about?parent=" rel="nofollow">About</a><br/> </td><td><a href="FrequentlyAskedQuestions?parent=" rel="nofollow">FAQ</a><br/> </td><td><a href="info?parent=" rel="nofollow">Help (irc, lists)</a><br/> </td><td><a href="tutorials?parent=" rel="nofollow">Tutorials</a><br/> </td><td><a href="resources?parent=" rel="nofollow">Resources</a><br/> </td><td><a href="interviews?parent=" rel="nofollow">Interviews</a><br/> </td></tr></tbody> </table></div> """ assert ('<div class="table-responsive"><table border="0" class="table">' in render(table))
def content_rendered(self): """The wiki content is rendered for display. """ session = inspect(self).session def for_link(link): return Wiki.content_for_link(session, link) return sanitize_html(render(self.content, for_link))