def _format_message_with_teardown_message(self, message): teardown = self.failure.teardown if teardown.startswith('*HTML*'): teardown = teardown[6:].lstrip() if not message.startswith('*HTML*'): message = '*HTML* ' + html_escape(message) elif message.startswith('*HTML*'): teardown = html_escape(teardown) return self.also_teardown_message % (message, teardown)
def _format_html_messages(self, messages): from robotide.lib.robot.utils import html_escape for msg in messages: if msg.startswith('*HTML*'): yield msg[6:].lstrip() else: yield html_escape(msg)
def report_config(self): if not self.report: return {} return { 'title': html_escape(self['ReportTitle'] or ''), 'logURL': self._url_from_path(self.report, self.log), 'background' : self._resolve_background_colors(), }
def log_config(self): if not self.log: return {} return { 'title': html_escape(self['LogTitle'] or ''), 'reportURL': self._url_from_path(self.log, self.report), 'splitLogBase': os.path.basename(os.path.splitext(self.log)[0]), 'defaultLevel': self['VisibleLogLevel'] }
def _create_label(self, message): # JLabel doesn't support multiline text, setting size, or wrapping. # Need to handle all that ourselves. Feels like 2005... wrapper = textwrap.TextWrapper(MAX_CHARS_PER_LINE, drop_whitespace=False) lines = [] for line in html_escape(message, linkify=False).splitlines(): if line: lines.extend(wrapper.wrap(line)) else: lines.append('') return JLabel('<html>%s</html>' % '<br>'.join(lines))
def _html_escape(self, item): return html_escape(item) if is_string(item) else item
def _format_text(self, doc): return '<p style="white-space: pre-wrap">%s</p>' % html_escape(doc)
def _escape_and_encode_targets(self, targets): return NormalizedDict( (html_escape(key), self._encode_uri_component(value)) for key, value in targets.items())
def _escape(self, item): return html_escape(item)
def html_message(self): """Returns the message content as HTML.""" return self.message if self.html else html_escape(self.message)
def __init__(self, content='', attributes=None, tag='td', escape=True): if escape: content = utils.html_escape(content) self.content = self._replace_newlines(content) self.attributes = attributes or {} self.tag = tag
def _html_escape(self, message): if message.startswith('*HTML*'): return message[6:].lstrip() else: return html_escape(message)
def _escape_and_encode_targets(self, targets): return NormalizedDict((html_escape(key), self._encode_uri_component(value)) for key, value in targets.items())
def _link_from_name(self, name, type_): return '<a name="%s_%s">%s</a>' % (type_, utils.attribute_escape(name), utils.html_escape(name))