diff --git a/examples/pandoc.kapow b/examples/pandoc.kapow new file mode 100644 index 0000000..dc458ba --- /dev/null +++ b/examples/pandoc.kapow @@ -0,0 +1,31 @@ +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 +} diff --git a/examples/pdfeditor/pdfeditor.html b/examples/pdfeditor/pdfeditor.html new file mode 100644 index 0000000..378898b --- /dev/null +++ b/examples/pdfeditor/pdfeditor.html @@ -0,0 +1,41 @@ + + + PDF Editor + + + +
+
+
+
+
+
+
+
AWYSIWYG PDF Editor
+
+
InputFormat
+ +
+
+
InputFormat
+ +
+
+
Preview!
+
+
+
+
+
+ +
+
+
+
+
+ + + diff --git a/examples/pdfeditor/pdfeditor.kapow b/examples/pdfeditor/pdfeditor.kapow new file mode 100644 index 0000000..d2dff0b --- /dev/null +++ b/examples/pdfeditor/pdfeditor.kapow @@ -0,0 +1,19 @@ +POST /editor/pdf { + tmpfile=$(mktemp --suffix=.pdf) + pandoc --from=@value:request/form/from \ + --to=pdf \ + --output=${tmpfile} \ + -t latex \ + @file:request/form/content + 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} + +} + +GET / = pdfeditor.html