diff --git a/qutebrowser/html/base.html b/qutebrowser/html/base.html index 51bf2f431..699740025 100644 --- a/qutebrowser/html/base.html +++ b/qutebrowser/html/base.html @@ -1,5 +1,7 @@ - +
diff --git a/qutebrowser/html/log.html b/qutebrowser/html/log.html new file mode 100644 index 000000000..a2d3bad6f --- /dev/null +++ b/qutebrowser/html/log.html @@ -0,0 +1,35 @@ +{% extends "base.html" %} + +{% block style %} +body { + background-color: black; + color: white; + font-size: 11px; +} + +table { + border: 1px solid grey; + border-collapse: collapse; +} + +pre { + margin: 2px; +} + +th, td { + border: 1px solid grey; + padding-left: 5px; + padding-right: 5px; +} +{% endblock %} + +{% block content %} +{{ super() }} +{% if content %} +Log output was disabled.
+{% endif %} +{% endblock %} diff --git a/qutebrowser/network/qutescheme.py b/qutebrowser/network/qutescheme.py index 83f54fe23..66adefb18 100644 --- a/qutebrowser/network/qutescheme.py +++ b/qutebrowser/network/qutescheme.py @@ -20,12 +20,9 @@ """Handler functions for different qute:... pages. Module attributes: - _HTML_TEMPLATE: The HTML boilerplate used to convert text into html. pyeval_output: The output of the last :pyeval command. """ -import html as pyhtml - from PyQt5.QtNetwork import QNetworkReply import qutebrowser @@ -34,42 +31,9 @@ from qutebrowser.utils import version, utils, jinja from qutebrowser.utils import log as logutils -_HTML_TEMPLATE = """ - - - - -Log output was disabled.
" + html_log = None else: - html = logutils.ram_handler.dump_log(html=True) - return _get_html('log', html, head=style) + html_log = logutils.ram_handler.dump_log(html=True) + html = jinja.env.get_template('log.html').render( + title='log', content=html_log) + return html.encode('UTF-8', errors='xmlcharrefreplace') @classmethod def gpl(cls): diff --git a/qutebrowser/utils/log.py b/qutebrowser/utils/log.py index 72b1bce11..c05352126 100644 --- a/qutebrowser/utils/log.py +++ b/qutebrowser/utils/log.py @@ -317,13 +317,12 @@ class RAMHandler(logging.Handler): self.data.append(record) def dump_log(self, html=False): - """Dump the complete formatted log data as as string.""" - if html: - fmt = self.html_formatter.format - lines = ['-This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. -
--This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. -
--You should have received a copy of the GNU General Public License -along with this program. If not, see -http://www.gnu.org/licenses/ or open qute:gpl. -""" - def _git_str(): """Try to find out git version.