16 from .markuputils
import attribute_escape, html_escape, xml_escape
17 from .robottypes
import is_string
18 from .robotio
import file_writer
39 def start(self, name, attrs=None, newline=True):
40 attrs = self._format_attrs(attrs)
41 self._start(name, attrs, newline)
43 def _start(self, name, attrs, newline):
44 self.
_write_write(
'<%s %s>' % (name, attrs)
if attrs
else '<%s>' % name,
53 return ' '.join(
'%s="%s"' % a
for a
in attrs
if write_empty
or a[1])
58 def content(self, content=None, escape=True, newline=False):
60 self.
_write_write(self.
_escape_escape(content)
if escape
else content, newline)
63 raise NotImplementedError
65 def end(self, name, newline=True):
66 self.
_write_write(
'</%s>' % name, newline)
68 def element(self, name, content=None, attrs=None, escape=True,
69 newline=True, replace_newlines=False):
72 self.
_start_start(name, attrs, newline=
False)
73 self.
contentcontent(content, escape, replace_newlines)
74 self.
endend(name, newline)
80 def _write(self, text, newline=False):
98 self.
_write_write(
'<?xml version="1.0" encoding="UTF-8"?>', newline=
True)
107 __init__ = start = content = element = end = close = \
108 lambda *args, **kwargs:
None
def _order_attrs(self, attrs)
def _escape(self, content)
Null implementation of the _MarkupWriter interface.
def close(self)
Closes the underlying output file.
def __init__(self, output, write_empty=True)
:param output: Either an opened, file like object, or a path to the desired output file.
def content(self, content=None, escape=True, newline=False)
def _start(self, name, attrs, newline)
def _order_attrs(self, attrs)
def end(self, name, newline=True)
def start(self, name, attrs=None, newline=True)
def element(self, name, content=None, attrs=None, escape=True, newline=True, replace_newlines=False)
def _escape(self, content)
def _write(self, text, newline=False)
def _format_attrs(self, attrs)
def write(msg, level='INFO', html=False)
Writes the message to the log file using the given level.
def html_escape(text, linkify=True)
def attribute_escape(attr)
def file_writer(path=None, encoding='UTF-8', newline=None)