def html(self, minify=True, **kwargs) -> str: """ Returns the documentation for this module as self-contained HTML. If `minify` is `True`, the resulting HTML is minified. For explanation of other arguments, see `pdoc.html()`. `kwargs` is passed to the `mako` render function. """ html = _render_template('/html.mako', module=self, **kwargs) if minify: from pdoc.html_helpers import minify_html html = minify_html(html) return html
def test_minify_html(self): html = ' <p> a </p> <pre> a\n b</pre> c \n d ' expected = '\n<p>\na\n</p>\n<pre> a\n b</pre>\nc\nd\n' minified = minify_html(html) self.assertEqual(minified, expected)