convert(inputfile,
template=None,
options=None,
convert_options=None)
| source code
|
Convert the given input file to an appropriate output format,
optionally using the given template file and further options.
If the output extension (format) cannot be inferred the first
converter that can handle the input file (and the format/extension it
gives as output) is used.
- Parameters:
inputfile (file) - The input file to be converted
template (file) - Template file to use during conversion
options (dict (default: None)) - Valid options are:
-
in_ext: The extension (format) of the input file.
-
out_ext: The extension (format) to use for the output file.
-
templ_ext: The extension (format) of the template file.
-
in_fname: File name of the input file; used only to determine
the input file extension (format).
-
templ_fname: File name of the template file; used only to
determine the template file extension (format).
- Returns:
- a 2-tuple: The new output file (in a temporary directory) and the
extension (format) of the output file. The caller is responsible
for deleting the (temporary) output file.
|