diff --git a/trypandoc/index.html b/trypandoc/index.html
index effee3802..0015d836f 100644
--- a/trypandoc/index.html
+++ b/trypandoc/index.html
@@ -96,8 +96,11 @@
+
+
+
@@ -117,10 +120,12 @@
+
+
@@ -154,6 +159,19 @@ function newpage() {
window.location.href = href.replace(/([?].*)?$/,"?" + URLparams);
};
+const binaryFormats = {
+ docx: { extension: "docx",
+ mime: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" },
+ odt: { extension: "odt",
+ mime: "application/vnd.oasis.opendocument.text" },
+ pptx: { extension: "pptx",
+ mime: "application/vnd.openxmlformats-officedocument.presentationml.presentation" },
+ epub2: { extension: "epub",
+ mime: "application/epub+zip" },
+ epub3: { extension: "epub",
+ mime: "application/epub+zip" }
+};
+
(function() {
const params = new URLSearchParams(window.location.search);
let text = params.get("text") || '"hello *world*"';
@@ -168,7 +186,7 @@ function newpage() {
fetch("/cgi-bin/pandoc-server.cgi/version")
.then(response => response.text())
.then(restext =>
- document.getElementById("version").textContent = restext
+ document.getElementById("version").textContent = restext
);
let params = { from: from, to: to, text: text, standalone: standalone };
@@ -184,7 +202,15 @@ function newpage() {
})
.then(response => response.text())
.then(restext => {
- document.getElementById("results").textContent = restext;
+ let binary = binaryFormats[to];
+ if (binary) {
+ document.getElementById("results").innerHTML =
+ 'click to download trypandoc.' + binary.extension + '';
+ } else {
+ document.getElementById("results").textContent = restext;
+ }
});
};
document.getElementById("convert").onclick = newpage;