pandoc/trypandoc/index.html

192 lines
7.8 KiB
HTML
Raw Normal View History

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Try pandoc!</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<style>
h1 { margin-bottom: 1em; }
body { margin: auto; }
textarea { height: auto; width: 100%; font-family: monospace; margin-top: 15px; }
div.alert { margin: 1em; }
h3 { margin-top: 0; margin-bottom: 0; padding: 0; font-size: 100%; }
pre#results { width: 100%; margin-top: 15px; }
footer { color: #555; text-align: center; margin: 1em; }
p.version { color: #555; }
button#convert { vertical-align: bottom; }
2015-06-02 12:38:31 +02:00
pre#command { margin-top: 1em; background-color: transparent; border: none; }
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
2018-11-04 18:56:44 +01:00
<h1>Try pandoc!</h1>
</div>
<div class="col-md-6">
<pre id="command"></pre>
</div>
</div>
<div class="row">
<div class="col-md-6">
<button class="btn btn-primary btn-xs" id="convert">Convert</button>
&nbsp;
<label for="from">
from
</label>
<select id="from">
2017-10-30 01:05:06 +01:00
<option value="commonmark">CommonMark</option>
<option value="creole">Creole</option>
2015-12-07 18:15:34 +01:00
<option value="docbook">DocBook</option>
<option value="dokuwiki">DokuWiki</option>
<option value="fb2">FB2</option>
2015-12-07 18:15:34 +01:00
<option value="haddock">Haddock markup</option>
<option value="html">HTML</option>
<option value="jats">JATS</option>
2019-12-23 07:11:41 +01:00
<option value="jira">Jira</option>
<option value="ipynb">Jupyter Notebook (ipynb)</option>
2015-12-07 18:15:34 +01:00
<option value="latex">LaTeX</option>
2018-11-04 20:22:25 +01:00
<option value="man">Man</option>
2015-12-07 18:15:34 +01:00
<option value="markdown" selected>Markdown (pandoc)</option>
2018-11-04 20:22:25 +01:00
<option value="gfm">Markdown (GitHub-flavored)</option>
2015-12-07 18:15:34 +01:00
<option value="markdown_phpextra">Markdown (PHP Markdown Extra)</option>
2017-10-30 01:05:06 +01:00
<option value="markdown_strict">Markdown (strict)</option>
2015-12-07 18:15:34 +01:00
<option value="mediawiki">MediaWiki</option>
2018-11-04 20:22:25 +01:00
<option value="markdown_mmd">MultiMarkdown</option>
2017-06-19 10:46:02 +02:00
<option value="muse">Muse</option>
2017-10-30 22:20:12 +01:00
<option value="native">Native (Pandoc AST)</option>
2015-12-07 18:15:34 +01:00
<option value="opml">OPML</option>
<option value="org">Org Mode</option>
<option value="rst">reStructuredText</option>
<option value="t2t">Txt2Tags</option>
2017-10-30 01:05:06 +01:00
<option value="textile">Textile</option>
<option value="tikiwiki">TikiWiki</option>
<option value="twiki">TWiki</option>
<option value="vimwiki">Vimwiki</option>
</select>
<input type="checkbox" id="standalone" name="standalone">
<label for="standalone">Standalone
<a href="https://pandoc.org/MANUAL.html#option--standalone" target="_blank">(?)</a>
</label>
<br/>
<textarea id="text" maxlength="3000" rows="15"></textarea>
</div>
<div class="col-md-6">
<label for="to">
to
</label>
<select id="to">
2017-10-30 01:05:06 +01:00
<option value="S5">S5</option>
<option value="asciidoc">AsciiDoc (original)</option>
<option value="asciidoctor">AsciiDoc (asciidoctor-flavored)</option>
2017-10-30 01:05:06 +01:00
<option value="beamer">LaTeX Beamer</option>
<option value="commonmark">CommonMark</option>
2015-12-07 18:15:34 +01:00
<option value="context">ConTeXt</option>
2017-10-30 01:05:06 +01:00
<option value="docbook4">DocBook v4</option>
<option value="docbook5">DocBook v5</option>
2015-12-07 18:15:34 +01:00
<option value="dokuwiki">DokuWiki</option>
<option value="dzslides">DZSlides</option>
2017-10-30 01:05:06 +01:00
<option value="haddock">Haddock markup</option>
2018-11-04 19:43:38 +01:00
<option value="html4">HTML 4</option>
<option value="html5" selected>HTML 5</option>
2015-12-07 18:15:34 +01:00
<option value="icml">ICML</option>
<option value="jats">JATS</option>
2019-06-12 07:24:32 +02:00
<option value="jira">Jira</option>
2017-10-30 01:05:06 +01:00
<option value="json">JSON</option>
<option value="ipynb">Jupyter Notebook (ipynb)</option>
2015-12-07 18:15:34 +01:00
<option value="latex">LaTeX</option>
2018-11-04 20:22:25 +01:00
<option value="man">Man</option>
<option value="ms">Ms</option>
2015-12-07 18:15:34 +01:00
<option value="markdown">Markdown (pandoc)</option>
2018-11-04 20:22:25 +01:00
<option value="gfm">Markdown (GitHub-flavored)</option>
2017-10-30 01:05:06 +01:00
<option value="markdown_phpextra">Markdown (PHP Markdown Extra)</option>
<option value="markdown_strict">Markdown (strict)</option>
<option value="mediawiki">MediaWiki</option>
2018-11-04 20:22:25 +01:00
<option value="markdown_mmd">MultiMarkdown</option>
2017-10-30 01:05:06 +01:00
<option value="muse">Muse</option>
2017-10-30 22:20:12 +01:00
<option value="native">Native (Pandoc AST)</option>
<option value="opendocument">OpenDocument</option>
2015-12-07 18:15:34 +01:00
<option value="opml">OPML</option>
2017-10-30 01:05:06 +01:00
<option value="org">Org Mode</option>
<option value="plain">Plain text</option>
<option value="revealjs">reveal.js</option>
<option value="rst">reStructuredText</option>
<option value="rtf">RTF</option>
<option value="slideous">Slideous</option>
2015-12-07 18:15:34 +01:00
<option value="slidy">Slidy</option>
<option value="tei">TEI</option>
2015-12-07 18:15:34 +01:00
<option value="texinfo">Texinfo</option>
2017-10-30 01:05:06 +01:00
<option value="textile">Textile</option>
<option value="zimwiki">ZimWiki</option>
</select>
<br/>
<pre id="results"></pre>
</div>
</div>
</div>
<footer>
<p class="version">pandoc <span id="version"></span></p>
2018-11-04 19:45:44 +01:00
<p><a href="https://pandoc.org">https://pandoc.org</a></p>
</footer>
<script>
"use strict";
function newpage() {
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 href = window.location.href;
const URLparams = new URLSearchParams(Object.entries({text: input, from: from, to: to, standalone: standalone}));
window.location.href = href.replace(/([?].*)?$/,"?" + URLparams);
};
(function() {
const params = new URLSearchParams(window.location.search);
let text = params.get("text");
document.getElementById("text").value = text;
let from = params.get("from") || "markdown";
document.getElementById("from").value = from;
let to = params.get("to") || "html";
document.getElementById("to").value = to;
let standalone = params.get("standalone") === "true";
document.getElementById("standalone").checked = standalone;
if (text && text != "") {
fetch("/cgi-bin/pandoc-cgi/version")
.then(response => response.text())
.then(restext =>
document.getElementById("version").textContent = restext
);
let params = { from: from, to: to, text: text, standalone: standalone };
// console.log(JSON.stringify(params));
fetch("/cgi-bin/pandoc-cgi/convert", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify(params)
})
.then(response => response.text())
.then(restext => {
document.getElementById("results").textContent = restext;
let commandString = "pandoc"
+ (standalone ? " --standalone" : "")
+ " --from " + from + " --to " + to;
document.getElementById("command").textContent = commandString;
});
};
document.getElementById("convert").onclick = newpage;
document.getElementById("from").onclick = newpage;
document.getElementById("to").onclick = newpage;
})();
</script>
</body>
</html>