Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*- # # Copyright (C) 2009 Damien Churchill <damoxc@gmail.com> # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. # See LICENSE for more details. #
""" Used by the gettext.js template to escape translated strings so they don't break the script. """ text = text.replace("'", "\\'") text = text.replace('\r\n', '\\n') text = text.replace('\r', '\\n') text = text.replace('\n', '\\n') return text
# This is beeing done like this in order to allow tests to use the above # `compress` without requiring Mako to be instaled
""" A template that adds some built-ins to the rendering """
"_": _, "escape": escape, "version": common.get_version() }
data.update(self.builtins) rendered = MakoTemplate.render_unicode(self, *args, **data) return rendered.encode('utf-8', 'replace') except ImportError: import warnings warnings.warn("The Mako library is required to run deluge.ui.web", RuntimeWarning)
class Template(object): def __new__(cls, *args, **kwargs): raise RuntimeError( "The Mako library is required to run deluge.ui.web" ) |