Reputation: 2412
I'm using jinja in python to render a .tex file, and then I want to use xelatex to render it to a pdf. Although I've managed to get this to work with an intermediate file, I'd rather not have an intermediate file.
I want to try doing this with a pipe. I'm writing to the pipe like this, after running the jinja2 render:
with open("./utils/xelatex_pipe", "w") as pipe:
pipe.write(output)
This seems to be fine, because if I run cat ./utils/xelatex_pipe
, I get the expected data (the .tex file).
I am now trying to set up a bash script that listens to that pipe, and runs xelatex on anything that comes through it. I've tried something like this:
pipe=./xelatex_pipe
xelatex -output-directory=/tmp/ $pipe
This doesn't work. It seems to treat every line individually, which obviously causes xelatex to go to mad... I think I need to aggregate all of the lines into a file, but I'm not sure how to do something like "while there are still lines in the pipe, concatenate them to some variable, and then run xelatex on the variable once there are no more lines"
Upvotes: 0
Views: 231