32 lines
767 B
Plaintext
32 lines
767 B
Plaintext
POST /convert/{from}/pdf {
|
|
tmpfile=$(mktemp --suffix=.pdf)
|
|
pandoc --from=@value:request/match/from \
|
|
--to=pdf \
|
|
--output=${tmpfile} \
|
|
-t latex \
|
|
@file:request/body
|
|
if [ $? -eq 0 ]; then
|
|
cat ${tmpfile} > @fifo:response/body
|
|
echo "application/pdf" > @fifo:response/header/Content-Type
|
|
echo 200 > @fifo:response/status
|
|
else
|
|
echo 500 > @fifo:response/status
|
|
fi
|
|
rm -f ${tmpfile}
|
|
}
|
|
|
|
POST /convert/{from}/{to} {
|
|
pandoc --from=@value:request/match/from \
|
|
--to=@value:request/match/to \
|
|
--output=@fifo:response/body \
|
|
@file:request/body
|
|
}
|
|
|
|
GET /formats/input {
|
|
pandoc --list-input-formats > @fifo:response/body
|
|
}
|
|
|
|
GET /formats/output {
|
|
pandoc --list-output-formats | grep -v pdf > @fifo:response/body
|
|
}
|