]>
git.proxmox.com Git - pve-docs.git/blob - asciidoc/asciidoc.js
1 //////////////////////////////////////////////////////////////////////////
2 // asciidoc JS helper for Proxmox VE mediawiki pages
4 // code based on original asciidoc.js, but re-written using jQuery
6 //////////////////////////////////////////////////////////////////////////
11 footnotes: function () {
12 var noteholder
= $("#footnotes");
19 // Rebuild footnote entries.
24 $("#asciidoccontent span.footnote").each(function(){
27 var note
= span
.attr("data-note");
28 var id
= span
.attr("id");
30 // Use [\s\S] in place of . so multi-line matches work.
31 // Because JavaScript has no s (dotall) regex flag.
32 note
= span
.html().match(/\s*\[([\s\S]*)]\s*/)[1];
33 span
.html("[<a id='_footnoteref_" + n
+ "' href='#_footnote_" +
34 n
+ "' title='View footnote' class='footnote'>" + n
+
36 span
.attr("data-note", note
);
39 "<div class='footnote' id='_footnote_" + n
+ "'>" +
40 "<a href='#_footnoteref_" + n
+ "' title='Return to text'>" +
41 n
+ "</a>. " + note
+ "</div>";
43 if (id
!= null) { refs
["#"+id
] = n
; }
46 if (inner_html
) { noteholder
.html("<hr>" + inner_html
); }
49 // process footnoterefs.
50 $("#asciidoccontent span.footnoteref").each(function(){
52 var href
= span
.find("a").first().attr("href");
53 href
= href
.match(/#.*/)[0]; // in case it return full URL.
55 span
.html("[<a href='#_footnote_" + n
+
56 "' title='View footnote' class='footnote'>" + n
+ "</a>]");
62 $(document
).ready(function(){