Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _rst2html(self, source, source_path=None,
source_class=docutils.io.StringInput,
destination_path=None, reader=None, reader_name='standalone',
parser=None, parser_name='restructuredtext', writer=None,
writer_name=None, settings=None, settings_spec=None,
settings_overrides=None, config_section=None,
enable_exit_status=None):
if not writer:
writer = HTML5Writer()
# Taken from Nikola
# http://bit.ly/14CmQyh
output, pub = docutils.core.publish_programmatically(
source=source, source_path=source_path, source_class=source_class,
destination_class=docutils.io.StringOutput,
destination=None, destination_path=destination_path,
reader=reader, reader_name=reader_name,
parser=parser, parser_name=parser_name,
writer=writer, writer_name=writer_name,
settings=settings, settings_spec=settings_spec,
settings_overrides=settings_overrides,
config_section=config_section,
enable_exit_status=enable_exit_status)
return pub.writer.parts['body']
'halt_level':6,
'input_encoding':'UTF-8',
'output_encoding':'UTF-8',
'initial_header_level':1,
'file_insertion_enabled':1,
'raw_enabled':1,
'writer_name':'html',
'language_code':'zh_cn',
'context':context,
'request':request
}
parts = publish_parts(
rst,
source_path = path,
writer=rst2html5.HTML5Writer(),
settings_overrides = settings
)
return parts['body']
def _rst2html(self, source, source_path=None,
source_class=docutils.io.StringInput,
destination_path=None, reader=None, reader_name='standalone',
parser=None, parser_name='restructuredtext', writer=None,
writer_name=None, settings=None, settings_spec=None,
settings_overrides=None, config_section=None,
enable_exit_status=None):
if not writer:
writer = HTML5Writer()
# Taken from Nikola
# http://bit.ly/14CmQyh
output, pub = docutils.core.publish_programmatically(
source=source, source_path=source_path, source_class=source_class,
destination_class=docutils.io.StringOutput,
destination=None, destination_path=destination_path,
reader=reader, reader_name=reader_name,
parser=parser, parser_name=parser_name,
writer=writer, writer_name=writer_name,
settings=settings, settings_spec=settings_spec,
settings_overrides=settings_overrides,
config_section=config_section,
enable_exit_status=enable_exit_status)
return pub.writer.parts['body']