@@ -50,7 +50,7 @@ def convert(source, to, format=None, extra_args=(), encoding='utf-8',
5050 :raises OSError: if pandoc is not found; make sure it has been installed and is available at
5151 path.
5252 """
53- msg = ("Due to possible ambiguity, 'convert()' is deprecated. "
53+ msg = ("Due to possible ambiguity, 'convert()' is deprecated and will be removed in pypandoc 1.8 . "
5454 "Use 'convert_file()' or 'convert_text()'." )
5555 warnings .warn (msg , DeprecationWarning , stacklevel = 2 )
5656
@@ -69,7 +69,7 @@ def convert(source, to, format=None, extra_args=(), encoding='utf-8',
6969
7070
7171def convert_text (source , to , format , extra_args = (), encoding = 'utf-8' ,
72- outputfile = None , filters = None , verify_format = True ):
72+ outputfile = None , filters = None , verify_format = True , sandbox = True ):
7373 """Converts given `source` from `format` to `to`.
7474
7575 :param str source: Unicode string or bytes (see encoding)
@@ -99,11 +99,11 @@ def convert_text(source, to, format, extra_args=(), encoding='utf-8',
9999 source = _as_unicode (source , encoding )
100100 return _convert_input (source , format , 'string' , to , extra_args = extra_args ,
101101 outputfile = outputfile , filters = filters ,
102- verify_format = verify_format )
102+ verify_format = verify_format , sandbox = sandbox )
103103
104104
105105def convert_file (source_file , to , format = None , extra_args = (), encoding = 'utf-8' ,
106- outputfile = None , filters = None , verify_format = True ):
106+ outputfile = None , filters = None , verify_format = True , sandbox = True ):
107107 """Converts given `source` from `format` to `to`.
108108
109109 :param str source_file: file path (see encoding)
@@ -137,7 +137,7 @@ def convert_file(source_file, to, format=None, extra_args=(), encoding='utf-8',
137137 format = _identify_format_from_path (source_file , format )
138138 return _convert_input (source_file , format , 'path' , to , extra_args = extra_args ,
139139 outputfile = outputfile , filters = filters ,
140- verify_format = verify_format )
140+ verify_format = verify_format , sandbox = sandbox )
141141
142142
143143def _identify_path (source ):
@@ -256,7 +256,7 @@ def _validate_formats(format, to, outputfile):
256256
257257
258258def _convert_input (source , format , input_type , to , extra_args = (), outputfile = None ,
259- filters = None , verify_format = True ):
259+ filters = None , verify_format = True , sandbox = True ):
260260 _ensure_pandoc_path ()
261261
262262 if verify_format :
@@ -276,6 +276,9 @@ def _convert_input(source, format, input_type, to, extra_args=(), outputfile=Non
276276 if outputfile :
277277 args .append ("--output=" + outputfile )
278278
279+ if sandbox :
280+ args .append ("--sandbox" )
281+
279282 args .extend (extra_args )
280283
281284 # adds the proper filter syntax for each item in the filters list
0 commit comments