diff --git a/trypandoc/index.html b/trypandoc/index.html index a604fd311..2dfb96198 100644 --- a/trypandoc/index.html +++ b/trypandoc/index.html @@ -51,8 +51,12 @@ from +


@@ -160,15 +172,17 @@ var params = {
   text: '"hello *world*"',
   to: 'html5',
   from: 'markdown',
-  standalone: false };
+  standalone: false,
+  citeproc: false };
 
 function permalink() {
   let input = document.getElementById("text").value;
   let from = document.getElementById("from").value;
   let to = document.getElementById("to").value;
   let standalone = document.getElementById("standalone").checked ? true : false;
+  let citeproc = document.getElementById("citeproc").checked ? true : false;
   let href = window.location.href;
-  const URLparams = new URLSearchParams(Object.entries({text: input, from: from, to: to, standalone: standalone}));
+  const URLparams = new URLSearchParams(Object.entries({text: input, from: from, to: to, standalone: standalone, citeproc: citeproc}));
   return href.replace(/([?].*)?$/,"?" + URLparams);
 }
 
@@ -194,6 +208,7 @@ function paramsFromURL() {
     params.from = uparams.get("from") || "markdown";
     params.to = uparams.get("to") || "html5";
     params.standalone = uparams.get("standalone") === "true";
+    params.citeproc = uparams.get("citeproc") === "true";
   }
 }
 
@@ -202,7 +217,9 @@ function convert() {
     let from = document.getElementById("from").value;
     let to = document.getElementById("to").value;
     let standalone = document.getElementById("standalone").checked;
-    params = { text: text, from: from, to: to, standalone: standalone };
+    let citeproc = document.getElementById("citeproc").checked;
+    params = { text: text, from: from, to: to, standalone: standalone,
+               citeproc: citeproc };
 
     if (text && text != "") {
        fetch("/cgi-bin/pandoc-server.cgi/version")
@@ -211,11 +228,11 @@ function convert() {
               document.getElementById("version").textContent = restext
             );
 
-       let params = { from: from, to: to, text: text, standalone: standalone };
        // console.log(JSON.stringify(params));
        let commandString = "pandoc"
          + " --from " + from + " --to " + to
-         + (standalone ? " --standalone" : "");
+         + (standalone ? " --standalone" : "")
+         + (citeproc ? " --citeproc" : "") ;
        document.getElementById("command").textContent = commandString;
        fetch("/cgi-bin/pandoc-server.cgi", {
          method: "POST",
@@ -244,11 +261,13 @@ function convert() {
     document.getElementById("from").value = params.from;
     document.getElementById("to").value = params.to;
     document.getElementById("standalone").checked = params.standalone;
+    document.getElementById("citeproc").checked = params.citeproc;
 
     document.getElementById("convert").onclick = convert;
     document.getElementById("from").onchange = convert;
     document.getElementById("to").onchange = convert;
     document.getElementById("standalone").onchange = convert;
+    document.getElementById("citeproc").onchange = convert;
 
     const fileInput = document.getElementById('loadfile');