[ $uid = rand(); $b = info_display($_args.0); $b = replace(replace($b, "[box]", msg_start()), "[/box]", msg_end()); $b = replace($b, "[br]", "<br>"); $b = replace(replace($b, "[b]", "<b>"), "[/b]", "</b>"); $b = replace(replace($b, "[i]", "<i>"), "[/i]", "</i>"); $b = replace(replace($b, "[u]", "<u>"), "[/u]", "</u>"); $b = replace(replace($b, "[small]", "<small>"), "[/small]", "</small>"); $b = replace(replace($b, "[sup]", "<sup>"), "[/sup]", "</sup>"); $b = replace(replace($b, "[sub]", "<sub>"), "[/sub]", "</sub>"); $b = replace(replace($b, "[center]", "<center>"), "[/center]", "</center>"); $b = replace(replace($b, "[tt]", "<tt>"), "[/tt]", "</tt>"); $b = replace(replace($b, "[code]", "<pre>"), "[/code]", "</pre>"); /* $b = replace($b, "[pedigree]", page("view", title2id("Cosmology Pedigree"))); */ $b = replace($b, "[table]" & __cr & "<br>" & __lf, "[table]"); $b = replace(replace($b, "[table]", "<table>"), "[/table]", "</table>"); $b = replace(replace($b, "[listing]", {<div width="100%" class="codebox_parent"><textarea readonly class="listing">}), "[/listing]", "</textarea><small style=\"display: block; text-align: right\">automatic listing (click to select contents)</small></div>"); $b = replace(replace($b, "[qna]", {<table class="qna">}), "[/qna]", "</table>"); $b = replace($b, "[/th]" & "<br>" & __lf, "[/th]"); $b = replace($b, "[/td]" & "<br>" & __lf, "[/td]"); $b = replace($b, "[/tr]" & "<br>" & __lf, "[/tr]"); $b = replace(replace($b, "[tr]", "<tr>"), "[th]", "<th>"); $b = replace($b, "[td]", "<td>"); $b = replace(replace($b, "[/tr]", "</tr>"), "[/th]", "</th>"); $b = replace($b, "[/td]", "</td>"); $b = replace($b, "--", "—"); $b = replace($b, "[/quote]" & "<br>" & __lf & "<br>", "[/quote]<br>"); $b = replace(replace($b, "[quote]", "<blockquote>"), "[/quote]", "</blockquote>"); $b = replace(replace($b, "[caption]", {<div class="capt">}), "[/caption]", "</div>"); $b = replace(replace($b, "[h1]", {<h1 class="wiki_h">}), "[/h1]", "</h1>"); $b = replace(replace($b, "[h2]", {<h2 class="wiki_h">}), "[/h2]", "</h2>"); $b = replace(replace($b, "[h3]", {<h3 class="wiki_h">}), "[/h3]", "</h3>"); $b = replace(replace($b, "[h4]", {<h4 class="wiki_h">}), "[/h4]", "</h4>"); $b = replace(replace($b, "[ol]", {<ol>}), "[/ol]", "</ol>"); $b = replace(replace($b, "[ul]", {<ul>}), "[/ul]", "</ul>"); $b = replace(replace($b, "[li]", {<li>}), "[/li]", "</li>"); $b = replace(replace($b, "</li><br>", "</li>"), "</ul><br>", "</ul>"); $b = replace(replace($b, "[h5]", {<h5 class="wiki_h">}), "[/h5]", "</h5>"); $b = replace(replace($b, "[h6]", {<h6 class="wiki_h">}), "[/h6]", "</h6>"); $b = replace(replace($b, "[s]", "<strike>"), "[/s]", "</strike>"); $b = replace(replace($b, "[strike]", "<strike>"), "[/strike]", "</strike>"); $b = replace(replace($b, "[/h]", "</span>"), "[/style]", "</span>"); $b = replace(replace($b, "[sc]", "<span class=\"smallcaps\">"), "[/sc]", "</span>"); $b = replace(replace($b, "[gb]", "<span class=\"gloss_bold\">"), "[/gb]", "</span>"); $b = replace(replace($b, "[spoiler]", {<span class="spoiler">}), "[/spoiler]", "</span>"); $b = replace(replace($b, "[?]", {<span class="spoiler">}), "[/?]", "</span>"); $orig = "/\[h:([^\"\[\]\|]*)\]/i"; $new = "<span style=\"background-color: $1\">"; $b = regreplace($b, $orig, $new); $orig = "/\[style:([^\"\[\]\|]*)\]/i"; $new = "<span style=\"$1\">"; $b = regreplace($b, $orig, $new); $orig = "/\[quote ([^\[\]]*)\]/i"; $new = {<blockquote><div style="font-size: 70%; font-weight: bold;">quoting $1:</div>}; $b = regreplace($b, $orig, $new); /* $orig = "/\[g ([^\[\]]*)\](.*?)\[\/g\]/i"; $new = {<span class="gloss_p"><span class="gloss_t">$2</span><span class="gloss">$1</span></span>}; $b = regreplace($b, $orig, $new); */ $orig = "/\[g (((?!\]).)*?)\](((?!\[g).)*?)\[\/g\]/i"; $new = {<span class="gloss_p"><span class="gloss_t">$3</span><span class="gloss">$1</span></span>}; while(regmatch($b, $orig) > 0) $b = regreplace($b, $orig, $new); $orig = "/\[image:([^\"\[\]\|]*)\|([^\"\[\]\|]*)\]/i"; $new = "<img src=\"$1\" style=\"$2\">"; $b = regreplace($b, $orig, $new); $orig = "/\[image:([^\"\[\]\|]*)\]/i"; $new = "<img src=\"$1\" style=\"max-width: 100%;\">"; $b = regreplace($b, $orig, $new); $orig = "/\[img\]([^\"\[\]\|]*)\[\/img\]/i"; $new = "<img src=\"$1\" style=\"max-width: 100%;\">"; $b = regreplace($b, $orig, $new); $orig = "/\[ol:([^\"\[\]\|]*)\]/i"; $new = "<ol style=\"list-style-type: $1;\">"; $b = regreplace($b, $orig, $new); $orig = "/\[\[([^\[\]]*)\]\]/i"; $new = "<a href=\"?page=$1\">$1</a>"; $b = regreplace($b, $orig, $new); $orig = "/^\* (.*?)$/m"; $new = {<div class="li">$1</div>}; $b = regreplace($b, $orig, $new); $orig = "/\[#([0-9]+)\|([^\[\]]*)\]/i"; $new = "<a href=\"?id=$1\">$2</a>"; $b = regreplace($b, $orig, $new); $orig = "/\[(mailto:[^\"\|]*)\|([^\[\]]*)\]/i"; $new = "<a target=\"_new\" href=\"$1\">$2</a>"; $b = regreplace($b, $orig, $new); $orig = "/\[(https?:\/\/[^\"\|]*)\|([^\[\]]*)\]/i"; $new = "<a target=\"_new\" href=\"$1\">$2</a>"; $b = regreplace($b, $orig, $new); $orig = "/\[(ftps?:\/\/[^\"\|]*)\|([^\[\]]*)\]/i"; $new = "<a target=\"_new\" href=\"$1\">$2</a>"; $b = regreplace($b, $orig, $new); $orig = "/\[(irc:\/\/[^\"\|]*)\|([^\[\]]*)\]/i"; $new = "<a target=\"_new\" href=\"$1\">$2</a>"; $b = regreplace($b, $orig, $new); $orig = "/\[(skype:[^\"\|]*)\|([^\[\]]*)\]/i"; $new = "<a href=\"$1\">$2</a>"; $b = regreplace($b, $orig, $new); $orig = "/\[(telnet:[^\"\|]*)\|([^\[\]]*)\]/i"; $new = "<a href=\"$1\">$2</a>"; $b = regreplace($b, $orig, $new); $orig = "/\[(\/\?[^\"\]|]*)\|([^\[\]]*)\]/i"; $new = "<a href=\"$1\">$2</a>"; $b = regreplace($b, $orig, $new); $orig = "/\[(\/[^\"\]|]*)\|([^\[\]]*)\]/i"; $new = "<a href=\"$1\">$2</a>"; $b = regreplace($b, $orig, $new); $orig = "/\[url=([^\"\]]*)\](((?!\[url).)*?)\[\/url\]/i"; $new = "<a href=\"$1\">$2</a>"; $b = regreplace($b, $orig, $new); $orig = "/\[url]([^\"\[]*)\[\/url\]/i"; $new = "<a href=\"$1\">$1</a>"; $b = regreplace($b, $orig, $new); $orig = "/\[box:([^\"\[\]\|]*)\]/i"; $new = "<div class=\"mbox_parent\" style=\"$1\">"; $b = regreplace($b, $orig, $new); $orig = "/\[table:([^\"\[\]\|]*)\]/i"; $new = "<table style=\"$1\">"; $b = regreplace($b, $orig, $new); $orig = "/\[td:([^\"\[\]\|]*)\]/i"; $new = "<td style=\"$1\">"; $b = regreplace($b, $orig, $new); $orig = "/\[th:([^\"\[\]\|]*)\]/i"; $new = "<th style=\"$1\">"; $b = regreplace($b, $orig, $new); $orig = "/\[table\|([^\[\]\|]*)\]/i"; $new = "<table $1>"; $b = regreplace($b, $orig, $new); $orig = "/\[td\|([^\[\]\|]*)\]/i"; $new = "<td $1>"; $b = regreplace($b, $orig, $new); $orig = "/\[th\|([^\[\]\|]*)\]/i"; $new = "<th $1>"; $b = regreplace($b, $orig, $new); $orig = "/\[tr\|([^\[\]\|]*)\]/i"; $new = "<tr $1>"; $b = regreplace($b, $orig, $new); /* $orig = "|\bhttps?:\/\/([a-z0-9\-]+\.?)+\.([a-z]{2,})(\/.*?)?\b|"; $new = "<a href=\"$1\">$1</a>"; $b = regreplace($b, $orig, $new); */ $orig = "/\<pre\>(((?!\<\/pre\>).)*?)\<br\>(((?!\<\/pre\>).)*?)\<\/pre\>/s"; $new = "<pre>\1\3</pre>"; while(regmatch($b, $orig) > 0) $b = regreplace($b, $orig, $new); $orig = "/\[note\](.+?)\[\/note\]/mi"; $jj = regmatches($b, $orig); var ftlist = ""; for(var i = 0, i < count(jj.0), i++) {[ ft = jj[0, i]; st = jj[1, i]; $fnlist &= {<a href="#ref_[uid]_[i]"><b>[i+1]</b>.</a> [st]<br>}; $b = replace($b, ft, {<a href="#footnote_[uid]_[i]" class="hovernote" ><b>[i+1]</b></a>}); ]}; if(fnlist != "") $b &= {<br><br><div class="fns">_________________________<br>[fnlist]</div>}; $orig = "/\[plus\](((?!\[plus).)*?)\[\/plus\]/mi"; $new = "<span class=\"hovernote\">+<span>$1</span></span>"; $b = regreplace($b, $orig, $new); $orig = "/\[plus ([^\[\]]*)\](((?!\[plus).)*?)\[\/plus\]/mi"; $new = "<span class=\"hoverme\">$1</span><span class=\"hovernote\">+<span>$2</span></span>"; $b = regreplace($b, $orig, $new); $b = replace(replace($b, "&so;", "["), "≻", "]"); $b = replace($b, "[!", "["); if($_args[2] != "nopurify") $b = purify($b); for(var i = 0, i < count(jj.0), i++) {[ $b = replace($b, {href="#ref_[uid]_[i]"}, {name="footnote_[uid]_[i]" href="#ref_[uid]_[i]"}); $b = replace($b, {href="#footnote_[uid]_[i]"}, {name="ref_[uid]_[i]" href="#footnote_[uid]_[i]"}); ]}; $b = replace($b, {<span class="spoiler">}, {<span class="spoiler" onclick="this.className = (this.className == 'spoiler' ? 'spoiler_on' : 'spoiler')">}); $b = replace($b, {<textarea readonly class="listing">}, {<textarea readonly class="listing" onclick="this.select()">}); ]<[if($_args[1] == "inline") {span} else {div}] id="wikicode_[$uid]"> [$b] </[if($_args[1] == "inline") {span} else {div}]> [ if($_args[1] == "") { <script type="text/javascript"> var div = document.getElementById("wikicode_[$uid]"); hs = getElementsByClassName("wiki_h", "", div); var outs = ""; for (var i = 0; i < hs.length; i++) { var h = hs["[i]"].innerHTML; if(hs["[i]"] != null) { var hsize = parseInt(hs["[i]"].tagName.substr(1)) - 1; var aname = h; while(outs.indexOf("#" + aname) != -1) { aname += " again"; } aname = "((" + aname.replace(["/[\<\>\"]/g"], "") + "))"; var a = document.createElement("a"); a.name = aname; hs["[i]"].parentNode.insertBefore(a, hs["[i]"]); outs += '<a href="#' + aname + '" style="margin-left: '+hsize+'em">' + h + '</a>'; } } if(outs != "") { var em = document.createElement("div"); em.innerHTML = "<span>Sections</span>" + outs; em.className = "toc"; div.parentNode.insertBefore(em, div); } </script> }; ]