8
8
import sys
9
9
import tempfile
10
10
import textwrap
11
- import warnings
12
11
13
12
from .handler import _check_log_handler
14
13
from .pandoc_download import DEFAULT_TARGET_FOLDER , download_pandoc
24
23
# Set up the module level logger
25
24
logger = logging .getLogger (__name__ )
26
25
27
-
28
- def convert (source , to , format = None , extra_args = (), encoding = 'utf-8' ,
29
- outputfile = None , filters = None , cworkdir = None ):
30
- """Converts given `source` from `format` to `to` (deprecated).
31
-
32
- :param str source: Unicode string or bytes or a file path (see encoding)
33
-
34
- :param str to: format into which the input should be converted; can be one of
35
- `pypandoc.get_pandoc_formats()[1]`
36
-
37
- :param str format: the format of the inputs; will be inferred if input is a file with an
38
- known filename extension; can be one of `pypandoc.get_pandoc_formats()[1]`
39
- (Default value = None)
40
-
41
- :param list extra_args: extra arguments (list of strings) to be passed to pandoc
42
- (Default value = ())
43
-
44
- :param str encoding: the encoding of the file or the input bytes (Default value = 'utf-8')
45
-
46
- :param str outputfile: output will be written to outfilename or the converted content
47
- returned if None (Default value = None)
48
-
49
- :param list filters: pandoc filters e.g. filters=['pandoc-citeproc']
50
-
51
- :returns: converted string (unicode) or an empty string if an outputfile was given
52
- :rtype: unicode
53
-
54
- :raises RuntimeError: if any of the inputs are not valid of if pandoc fails with an error
55
- :raises OSError: if pandoc is not found; make sure it has been installed and is available at
56
- path.
57
- """
58
- msg = ("Due to possible ambiguity, 'convert()' is deprecated and will be removed in pypandoc 1.8. "
59
- "Use 'convert_file()' or 'convert_text()'." )
60
- warnings .warn (msg , DeprecationWarning , stacklevel = 2 )
61
-
62
- path = _identify_path (source )
63
- if path :
64
- format = _identify_format_from_path (source , format )
65
- input_type = 'path'
66
- else :
67
- source = _as_unicode (source , encoding )
68
- input_type = 'string'
69
- if not format :
70
- raise RuntimeError ("Format missing, but need one (identified source as text as no "
71
- "file with that name was found)." )
72
- return _convert_input (source , format , input_type , to , extra_args = extra_args ,
73
- outputfile = outputfile , filters = filters ,
74
- cworkdir = cworkdir )
75
-
76
-
77
26
def convert_text (source , to , format , extra_args = (), encoding = 'utf-8' ,
78
27
outputfile = None , filters = None , verify_format = True ,
79
28
sandbox = True , cworkdir = None ):
@@ -690,7 +639,6 @@ def _ensure_pandoc_path():
690
639
def ensure_pandoc_installed (url = None ,
691
640
targetfolder = None ,
692
641
version = "latest" ,
693
- quiet = None ,
694
642
delete_installer = False ):
695
643
"""Try to install pandoc if it isn't installed.
696
644
@@ -699,11 +647,6 @@ def ensure_pandoc_installed(url=None,
699
647
:raises OSError: if pandoc cannot be installed
700
648
"""
701
649
702
- if quiet is not None :
703
- msg = ("The quiet flag in PyPandoc has been deprecated in favour of "
704
- "logging. See README.md for more information." )
705
- warnings .warn (msg , DeprecationWarning , stacklevel = 2 )
706
-
707
650
# Append targetfolder to the PATH environment variable so it is found by subprocesses
708
651
if targetfolder is not None :
709
652
os .environ ["PATH" ] = os .environ .get ("PATH" , "" ) + os .pathsep + os .path .abspath (os .path .expanduser (targetfolder ))
0 commit comments