Function to call a extern command as a filter

Ulrich Goebel ml at fam-goebel.de
Wed Sep 25 07:04:38 EDT 2019


Hello,

what I want:

I want a function which converts a markdown-formatted string to a 
latex-formatted string, like

def markdown_to_latex (m : string)
	make a latex-formatted string l
		from the given markdown-formatted string m
	return (l)

What I have:

I have a extern tool pandoc which does exactly what I want, but it
works on files. This tool is able to work as a pipe, so it uses
the standard input and standard outpu.

What I could do:

def markdown_to_latex (m : string)
	write the string m to a file
	call pandoc to work on that file
	read the outputfile into the string l
	return (l)

What would be nice:

I would like to avoid the extra steps writing an reading extern files.

Can anybody help me?

Thanks
Ulrich


-- 
Ulrich Goebel
Am Büchel 57, 53173 Bonn



More information about the Python-list mailing list