aboutsummaryrefslogtreecommitdiff
path: root/trypandoc/index.html
blob: e9fbf45970263ac540e8294a5128a11832a29b3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Try pandoc!</title>
  <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
  <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
  <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
  <script type="text/javascript">
(function($) { // http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values
	$.QueryString = (function(a) {
	    if (a == "") return {};
	    var b = {};
	    for (var i = 0; i < a.length; ++i)
	    {
		var p=a[i].split('=');
		if (p.length != 2) continue;
		b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
	    }
	    return b;
        })(window.location.search.substr(1).split('&'))
})(jQuery);

function newpage() {
  var input = $("#text").val();
  var from = $("#from").val();
  var to = $("#to").val();
  var href = window.location.href;
  window.location.href = href.replace(/([?].*)?$/,"?" + $.param({text: input, from: from, to: to}));
};

$(document).ready(function() {
    var text = $.QueryString["text"];
    $("#text").val(text);
    var from = $.QueryString["from"] || "markdown";
    $("#from").val(from);
    var to = $.QueryString["to"] || "html";
    $("#to").val(to);
    if (text && text != "") {
       $.getJSON("/cgi-bin/trypandoc", { from: from, to: to, text: text },
         function(res) {
          $("#results").text(res.html);
          $("#version").text(res.version);
          $("#command").text("pandoc --from " + from + " --to " + to);
         });
    };
    $("#convert").click(newpage);
    $("#from").change(newpage);
    $("#to").change(newpage);
});
  </script>
  <style type="text/css">
    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; }
    pre#command { margin-top: 1em; background-color: transparent; border: none; }
  </style>
</head>
<body>
<div class="container">
  <div class="row">
    <div class="col-md-6">
      <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">
        <option value="commonmark">CommonMark</option>
        <option value="creole">Creole</option>
        <option value="docbook">DocBook</option>
        <option value="haddock">Haddock markup</option>
        <option value="html">HTML</option>
        <option value="latex">LaTeX</option>
        <option value="man">Man</option>
        <option value="markdown" selected>Markdown (pandoc)</option>
        <option value="gfm">Markdown (GitHub-flavored)</option>
        <option value="markdown_phpextra">Markdown (PHP Markdown Extra)</option>
        <option value="markdown_strict">Markdown (strict)</option>
        <option value="mediawiki">MediaWiki</option>
        <option value="markdown_mmd">MultiMarkdown</option>
        <option value="muse">Muse</option>
        <option value="native">Native (Pandoc AST)</option>
        <option value="opml">OPML</option>
        <option value="org">Org Mode</option>
        <option value="rst">reStructuredText</option>
        <option value="t2t">Txt2Tags</option>
        <option value="textile">Textile</option>
        <option value="tikiwiki">TikiWiki</option>
        <option value="twiki">TWiki</option>
        <option value="vimwiki">Vimwiki</option>
      </select>
      <br/>
      <textarea id="text" maxlength="3000" rows="15"></textarea>
    </div>
    <div class="col-md-6">
      <label for="to">
      to
      </label>
      <select id="to">
        <option value="S5">S5</option>
        <option value="asciidoc">AsciiDoc</option>
        <option value="beamer">LaTeX Beamer</option>
        <option value="commonmark">CommonMark</option>
        <option value="context">ConTeXt</option>
        <option value="docbook4">DocBook v4</option>
        <option value="docbook5">DocBook v5</option>
        <option value="dokuwiki">DokuWiki</option>
        <option value="dzslides">DZSlides</option>
        <option value="dzslides">dzslides</option>
        <option value="haddock">Haddock markup</option>
        <option value="html4">HTML 4</option>
        <option value="html5" selected>HTML 5</option>
        <option value="icml">ICML</option>
        <option value="json">JSON</option>
        <option value="latex">LaTeX</option>
        <option value="man">Man</option>
        <option value="ms">Ms</option>
        <option value="markdown">Markdown (pandoc)</option>
        <option value="gfm">Markdown (GitHub-flavored)</option>
        <option value="markdown_phpextra">Markdown (PHP Markdown Extra)</option>
        <option value="markdown_strict">Markdown (strict)</option>
        <option value="mediawiki">MediaWiki</option>
        <option value="markdown_mmd">MultiMarkdown</option>
        <option value="muse">Muse</option>
        <option value="native">Native (Pandoc AST)</option>
        <option value="opendocument">OpenDocument</option>
        <option value="opml">OPML</option>
        <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>
        <option value="slidy">Slidy</option>
        <option value="texinfo">Texinfo</option>
        <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>
 <p><a href="https://pandoc.org">https://pandoc.org</a></p>
</footer>
</body>
</html>