Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return ''
if not hasattr(_register_roles, '_roles_registered'):
_register_roles()
_register_roles._roles_registered = True
warning_stream = StringIO()
parts = publish_parts(
string,
reader=NoDocInfoReader(),
settings_overrides={
'embed_stylesheet': False,
'input_encoding': 'utf-8',
'syntax_highlight': 'short',
'warning_stream': warning_stream,
},
writer=HTMLWriter(translator_class=translator_class),
)
rst_parse_messages = []
for warning in warning_stream.getvalue().splitlines():
if not warning or ':' not in warning:
continue
warning = warning.split(' ', 2)
rst_parse_messages.append(RSTParseMessage(
line=warning[0].split(':')[1],
level=warning[1].split('/')[0][1:].lower(),
message=warning[2],
))
warning_stream.close()
# TODO: decide what to do with the rst parser warnings and errors
return parts['html_body']