diff --git a/qutebrowser/html/pre.html b/qutebrowser/html/pre.html new file mode 100644 index 000000000..cfcfad359 --- /dev/null +++ b/qutebrowser/html/pre.html @@ -0,0 +1,7 @@ +{% extends "base.html" %} +{% block content %} +{{ super() }} +
+{{ content }}
+
+{% endblock %} diff --git a/qutebrowser/html/version.html b/qutebrowser/html/version.html new file mode 100644 index 000000000..3db7ced03 --- /dev/null +++ b/qutebrowser/html/version.html @@ -0,0 +1,26 @@ +{% extends "base.html" %} +{% block content %} +{{ super() }} +

Version info

+
{{ version }}
+ +

Copyright info

+

{{ copyright }}

+

+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. +

+{% endblock %} diff --git a/qutebrowser/network/qutescheme.py b/qutebrowser/network/qutescheme.py index 9a4577dda..83f54fe23 100644 --- a/qutebrowser/network/qutescheme.py +++ b/qutebrowser/network/qutescheme.py @@ -30,7 +30,7 @@ from PyQt5.QtNetwork import QNetworkReply import qutebrowser from qutebrowser.network import schemehandler -from qutebrowser.utils import version, utils +from qutebrowser.utils import version, utils, jinja from qutebrowser.utils import log as logutils @@ -110,28 +110,28 @@ class QuteHandlers: @classmethod def pyeval(cls): """Handler for qute:pyeval. Return HTML content as bytes.""" - text = pyhtml.escape(pyeval_output) - return _get_html('pyeval', '
{}
'.format(text)) + html = jinja.env.get_template('pre.html').render( + title='pyeval', content=pyeval_output) + return html.encode('UTF-8', errors='xmlcharrefreplace') @classmethod def version(cls): """Handler for qute:version. Return HTML content as bytes.""" - text = pyhtml.escape(version.version()) - html = '

Version info

' - html += '

{}

'.format(text.replace('\n', '
')) - html += '

Copyright info

' - html += '

{}

'.format(qutebrowser.__copyright__) - html += version.GPL_BOILERPLATE_HTML - return _get_html('Version', html) + html = jinja.env.get_template('version.html').render( + title='Version info', version=version.version(), + copyright=qutebrowser.__copyright__) + return html.encode('UTF-8', errors='xmlcharrefreplace') @classmethod def plainlog(cls): - """Handler for qute:log. Return HTML content as bytes.""" + """Handler for qute:plainlog. Return HTML content as bytes.""" if logutils.ram_handler is None: text = "Log output was disabled." else: - text = pyhtml.escape(logutils.ram_handler.dump_log()) - return _get_html('log', '
{}
'.format(text)) + text = logutils.ram_handler.dump_log() + html = jinja.env.get_template('pre.html').render( + title='log', content=text) + return html.encode('UTF-8', errors='xmlcharrefreplace') @classmethod def log(cls):