trypandoc: add citeproc and bib formats.
This commit is contained in:
parent
0d19b859ce
commit
bfd00eece4
1 changed files with 24 additions and 5 deletions
|
@ -51,8 +51,12 @@
|
|||
from
|
||||
</label>
|
||||
<select id="from">
|
||||
<option value="bibtex">BibTeX</option>
|
||||
<option value="biblatex">BibLaTeX</option>
|
||||
<option value="commonmark">CommonMark</option>
|
||||
<option value="commonmark_x">CommonMark (extended)</option>
|
||||
<option value="creole">Creole</option>
|
||||
<option value="csljson">CSL JSON</option>
|
||||
<option value="csv">CSV</option>
|
||||
<option value="docbook">DocBook</option>
|
||||
<option value="dokuwiki">DokuWiki</option>
|
||||
|
@ -77,6 +81,7 @@
|
|||
<option value="odt">ODT</option>
|
||||
<option value="opml">OPML</option>
|
||||
<option value="org">Org Mode</option>
|
||||
<option value="ris">RIS</option>
|
||||
<option value="rst">reStructuredText</option>
|
||||
<option value="t2t">Txt2Tags</option>
|
||||
<option value="textile">Textile</option>
|
||||
|
@ -97,8 +102,11 @@
|
|||
<option value="asciidoc">AsciiDoc (original)</option>
|
||||
<option value="asciidoctor">AsciiDoc (asciidoctor-flavored)</option>
|
||||
<option value="beamer">LaTeX Beamer</option>
|
||||
<option value="bibtex">BibTeX</option>
|
||||
<option value="biblatex">BibLaTeX</option>
|
||||
<option value="commonmark">CommonMark</option>
|
||||
<option value="context">ConTeXt</option>
|
||||
<option value="csljson">CSL JSON</option>
|
||||
<option value="docbook4">DocBook v4</option>
|
||||
<option value="docbook5">DocBook v5</option>
|
||||
<option value="docx">Docx (Word)</option>
|
||||
|
@ -146,6 +154,10 @@
|
|||
<label for="standalone">Standalone
|
||||
<a href="https://pandoc.org/MANUAL.html#option--standalone" target="_blank">(?)</a>
|
||||
</label>
|
||||
<input type="checkbox" id="citeproc" name="citeproc">
|
||||
<label for="citeproc">Citeproc
|
||||
<a href="https://pandoc.org/MANUAL.html#option--citeproc" target="_blank">(?)</a>
|
||||
</label>
|
||||
<br/>
|
||||
<a id="permalink" title="link to this conversion" href="">permalink</a></br/>
|
||||
<pre id="results"></pre>
|
||||
|
@ -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');
|
||||
|
||||
|
|
Loading…
Reference in a new issue