def _download_and_format_issues(): try: from robot.utils import HtmlWriter, html_format except ImportError: sys.exit('creating release requires Robot Framework to be installed.') URL = Template('http://code.google.com/p/robotframework-ride/issues/csv?' 'sort=priority+type&colspec=ID%20Type%20Priority%20Summary' '&q=target%3A${version}&can=1') reader = csv.reader(urlopen(URL.substitute({'version': VERSION}))) total_issues = 0 writer = HtmlWriter(StringIO()) writer.element('h2', 'Release notes for %s' % VERSION) writer.start('table', attrs={'border': '1'}) for row in reader: if not row or row[1] == 'Task': continue row = row[:4] writer.start('tr') if reader.line_num == 1: row = [ '*%s*' % cell for cell in row ] else: row[0] = '<a href="http://code.google.com/p/robotframework-ride/'\ 'issues/detail?id=%s">Issue %s</a>' % (row[0], row[0]) total_issues += 1 for cell in row: if reader.line_num == 1: cell = html_format(cell) writer.element('td', cell, escape=False) writer.end('tr') writer.end('table') writer.element('p', 'Altogether %d issues.' % total_issues) return writer.output.getvalue()
def _download_and_format_issues(): try: from robot.utils import HtmlWriter, html_format except ImportError: sys.exit('creating release requires Robot Framework to be installed.') writer = HtmlWriter(StringIO()) writer.element('h2', 'Release notes for %s' % VERSION) writer.start('table', attrs={'border': '1'}) writer.start('tr') for header in ['ID', 'Type', 'Priority', 'Summary']: writer.element('td', html_format('*{}*'.format(header)), escape=False) writer.end('tr') issues = list(_get_issues()) for issue in issues: writer.start('tr') link_tmpl = '<a href="http://github.com/robotframework/RIDE/issues/{0}">Issue {0}</a>' row = [ link_tmpl.format(issue.number), find_type(issue), find_priority(issue), issue.title ] for cell in row: writer.element('td', cell, escape=False) writer.end('tr') writer.end('table') writer.element('p', 'Altogether %d issues.' % len(issues)) return writer.output.getvalue()
def _download_and_format_issues(): try: from robot.utils import HtmlWriter, html_format except ImportError: sys.exit('creating release requires Robot Framework to be installed.') URL = Template('http://code.google.com/p/robotframework-ride/issues/csv?' 'sort=priority+type&colspec=ID%20Type%20Priority%20Summary' '&q=target%3A${version}&can=1') reader = csv.reader(urlopen(URL.substitute({'version': VERSION}))) total_issues = 0 writer = HtmlWriter(StringIO()) writer.element('h2', 'Release notes for %s' % VERSION) writer.start('table', attrs={'border': '1'}) for row in reader: if not row or row[1] == 'Task': continue row = row[:4] writer.start('tr') if reader.line_num == 1: row = ['*%s*' % cell for cell in row] else: row[0] = '<a href="http://code.google.com/p/robotframework-ride/'\ 'issues/detail?id=%s">Issue %s</a>' % (row[0], row[0]) total_issues += 1 for cell in row: if reader.line_num == 1: cell = html_format(cell) writer.element('td', cell, escape=False) writer.end('tr') writer.end('table') writer.element('p', 'Altogether %d issues.' % total_issues) return writer.output.getvalue()
def _download_and_format_issues(): try: from robot.utils import HtmlWriter, html_format except ImportError: sys.exit('creating release requires Robot Framework to be installed.') writer = HtmlWriter(StringIO()) writer.element('h2', 'Release notes for %s' % VERSION) writer.start('table', attrs={'border': '1'}) writer.start('tr') for header in ['ID', 'Type', 'Priority', 'Summary']: writer.element( 'td', html_format('*{}*'.format(header)), escape=False) writer.end('tr') issues = list(_get_issues()) for issue in issues: writer.start('tr') link_tmpl = '<a href="http://github.com/robotframework/RIDE/issues/{0}">Issue {0}</a>' row = [link_tmpl.format(issue.number), find_type(issue), find_priority(issue), issue.title] for cell in row: writer.element('td', cell, escape=False) writer.end('tr') writer.end('table') writer.element('p', 'Altogether %d issues.' % len(issues)) return writer.output.getvalue()
def _encode(self, text, html=False): if html: text = html_format(text) if len(text) > self._compress_threshold: compressed = compress_text(text) if len(compressed) * self._use_compressed_threshold < len(text): return compressed # Strings starting with '*' are raw, others are compressed. return '*' + text
def __init__(self, context, attrs): _Handler.__init__(self, context) self._attrs = self._prune_empty_strings_from_attrs(dict(attrs)) self._attrs['pass'] = int(self._attrs['pass']) self._attrs['fail'] = int(self._attrs['fail']) if 'doc' in self._attrs: self._attrs['doc'] = utils.html_format(self._attrs['doc']) # Cannot use 'id' attribute in XML due to http://bugs.jython.org/issue1768 if 'idx' in self._attrs: self._attrs['id'] = self._attrs.pop('idx')
def _download_and_format_issues(): try: from robot.utils import HtmlWriter, html_format except ImportError: sys.exit("creating release requires Robot Framework to be installed.") writer = HtmlWriter(StringIO()) writer.element("h2", "Release notes for %s" % VERSION) writer.start("table", attrs={"border": "1"}) writer.start("tr") for header in ["ID", "Type", "Priority", "Summary"]: writer.element("td", html_format("*{}*".format(header)), escape=False) writer.end("tr") issues = _get_issues() for issue in issues: writer.start("tr") link_tmpl = '<a href="http://github.com/robotframework/RIDE/issues/{0}">Issue {0}</a>' row = [link_tmpl.format(issue.number), _find_type(issue), _find_priority(issue), issue.title] for cell in row: writer.element("td", cell, escape=False) writer.end("tr") writer.end("table") writer.element("p", "Altogether %d issues." % len(issues)) return writer.output.getvalue()
def _html(self, item): return html_format(unescape(item))
def html(self, string): return self.string(html_format(string), escape=False)
def _html(self, item): return utils.html_format(utils.unescape(item))
def _get_htmldoc(self, doc): doc = utils.html_format(doc) return self._name_regexp.sub(self._link_keywords, doc)
def html(self, string): return self.string(html_format(string))
def end_element(self, text): return self._get_ids(self._name, utils.html_format(text))