From a572e21dfdc9ecfd5cbba340c401c0a27a20ac8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Abdelkader=20Mart=C3=ADnez=20P=C3=A9rez?= Date: Tue, 2 Apr 2019 14:45:38 +0200 Subject: [PATCH] Examples --- examples/pandoc.kapow | 31 ++++++++++++++++++++++ examples/pdfeditor/pdfeditor.html | 41 ++++++++++++++++++++++++++++++ examples/pdfeditor/pdfeditor.kapow | 19 ++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 examples/pandoc.kapow create mode 100644 examples/pdfeditor/pdfeditor.html create mode 100644 examples/pdfeditor/pdfeditor.kapow 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