--- /dev/null
+//////////////////////////////////////////////////////////////////////////
+// asciidoc JS helper for Proxmox VE mediawiki pages
+//
+// code based on original asciidoc.js, but re-written using jQuery
+//
+//////////////////////////////////////////////////////////////////////////
+
+var asciidoc = {
+
+ // footnote generator
+ footnotes: function () {
+ var noteholder = $("#footnotes");
+ if (!noteholder) {
+ return;
+ }
+
+ noteholder.html('');
+
+ // Rebuild footnote entries.
+ var refs = {};
+ var n = 0;
+ var inner_html = '';
+
+ $("#asciidoccontent span.footnote").each(function(){
+ n++;
+ var span = $(this);
+ var note = span.attr("data-note");
+ var id = span.attr("id");
+ if (!note) {
+ // Use [\s\S] in place of . so multi-line matches work.
+ // Because JavaScript has no s (dotall) regex flag.
+ note = span.html().match(/\s*\[([\s\S]*)]\s*/)[1];
+ span.html("[<a id='_footnoteref_" + n + "' href='#_footnote_" +
+ n + "' title='View footnote' class='footnote'>" + n +
+ "</a>]");
+ span.attr("data-note", note);
+ }
+ inner_html +=
+ "<div class='footnote' id='_footnote_" + n + "'>" +
+ "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
+ n + "</a>. " + note + "</div>";
+
+ if (id != null) { refs["#"+id] = n; }
+ });
+
+ if (inner_html) { noteholder.html("<hr>" + inner_html); }
+
+ if (n != 0) {
+ // process footnoterefs.
+ $("#asciidoccontent span.footnoteref").each(function(){
+ var span = $(this);
+ var href = span.find("a").first().attr("href");
+ href = href.match(/#.*/)[0]; // in case it return full URL.
+ n = refs[href];
+ span.html("[<a href='#_footnote_" + n +
+ "' title='View footnote' class='footnote'>" + n + "</a>]");
+ });
+ }
+ }
+};
+
+$(document).ready(function(){
+ asciidoc.footnotes();
+});
+
[footnote-inlinemacro]
# footnote:[<text>].
-<span class="footnote">[{0}]</span>
+<span class="footnote"><br>[{0}]<br></span>
[footnoteref-inlinemacro]
# footnoteref:[<id>], create reference to footnote.
</div>
[toc]
-<div id="toc">
- <div id="toctitle">{toc-title}</div>
- <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
-</div>
+<!-- FIXME: TOC -->
[header]
-<!-- HEADER -->
+<!-- asciidoc HEADER -->
+<script type="text/javascript">
+include1::asciidoc.js[]
+</script>
+template::[toc]
+<div id="asciidoccontent">
[footer]
<!-- FOOTER -->
+</div>
+<div id="footnotes"></div>
[footer-date]
# Default footer date is document modification time