[show modes: view edit delete] [begin mode tag_query][$_id]:.[replace(replace(getv("categories"), __cr, ""), __lf, ".")]. [end mode tag_query] [begin mode part][getv("part")][end mode part] [begin mode update_tag][ var olds = $_args[0]; var news = $_args[1]; var cats = split(replace(getv("categories"), __cr, ""), __lf); cats = (each(cats) ?(c) iif(c == olds, news, c)); cats = concat(cats, __lf); putv("categories", cats); ][end mode update_tag] [begin mode title][ var word = _title; if(strpos(_title, "<!>") != "-1") word = substr(_title, 0, strpos(_title, "<!>")); var part = getv("part"); if(((part == "pre") || (part == "prefix")) && substr(word, -1, 1) != "-") word &= "–"; if(((part == "suf") || (part == "suffix")) && substr(word, 0, 1) != "-") word = "–" & word; // word; var t = ""; if(strpos(_title, "<!>") >= 0) t = " (" & substr(_title, strpos(_title, "<!>") + 3) & ")"; // info_display({<b><a href="/?id=[_id]">[word]</a></b>[t]}); {<b><a href="/?id=[_id]">[word]</a></b>[t]}; ][end mode title] [begin mode compare] [ var $t = iif(strpos($_title, "<!>") != "-1", substr($_title, 0, strpos($_title, "<!>")), $_title); var $l = editdistance($t, $_args[0]); if($l == 0) { <li><a href="/?id=[$_id]"><u><b title="distance: [$l]">[info_display($t)]</b></u></a></li> } else if($l < $_args[1]) { <li><a href="/?id=[$_id]"><span title="distance: [$l]">[info_display($t)]</span></a></li> }; ] [end mode compare] [begin mode dist][ var $t = iif(strpos($_title, "<!>") > -1, substr($_title, 0, strpos($_title, "<!>")), $_title); var $l = editdistance($t, $_args[0]); if($l > 0) {[$l]:[$_id]:[$t]:[$_args[0]] }; ][end mode dist] [begin mode fulldesc][ var $d = replace(getv("definition"), "<!!>", "<!>"); _wiki_format($d, "inline"); ][end mode fulldesc] [begin mode desc][ var $d = replace(getv("definition"), "<!!>", "<!>"); var $pos = strpos($d, ". "); if(substr($d, "-1", 1) == __lf) $d = substr($d, 0, "-1"); if(substr($d, "-1", 1) == __cr) $d = substr($d, 0, "-1"); if($pos > 0) {[ if(substr($d, $pos + 1, 1) == ")") $pos = $pos + 1; _wiki_format(substr($d, 0, 1 + $pos), "inline"); ]} else _wiki_format($d, "inline"); ][end mode desc] [begin mode tag_abbr] [end mode tag_abbr] [begin mode autorepair][ if(strpos($_body, "</") >= 0) {<p><b>Warning: HTML still present in <a href="/?id=[$_id]">[info_display($_title)]</a>.</b></p>}; ][end mode autorepair] [begin mode validate][ var info = {[ var $st = substr($_title, "-1"); var cats = split(replace(getv("categories"), __cr, ""), __lf); var part = getv("part"); if(part == "n") {[ if($st == "a") $st = "u"; if($st == "o") $st = "u"; if($st == "e") $st = "u"; if($st != "u") { <li>is not formed like a noun }; ]}; if(part == "v") {[ if($st == "a") $st = "u"; if($st == "o") $st = "u"; if($st == "e") $st = "u"; if($st == "u") { <li>is formed as a noun but has been categorized as a verb }; if((find(cats, "transitive") + find(cats, "intransitive") + find(cats, "copula")) == -3) { <li>is a verb but not tagged transitive, intransitive, or copula } ]}; ]}; if(info != "") { <p><b><a href="/?id=[_id]&mode=edit" target="_blank">[_title]</a></b></p> <ul>[info]</ul> }; ][end mode validate] [begin mode export][ edit_display($_title); chr(9); edit_display(replace(replace(getv("categories"), __lf, ","), __cr, "")); chr(9); replace(edit_display(getv("definition")), __lf, "\n"); chr(9); replace(edit_display(getv("usage")), __lf, "\n"); chr(9); replace(edit_display(getv("etymology")), __lf, "\n"); chr(9); replace(edit_display(getv("attestation")), __lf, "\n"); chr(9); edit_display(replace(replace(getv("related"), __lf, ","), __cr, "")); chr(9); replace(edit_display(getv("pronunciation")), __lf, "\n"); chr(9); replace(edit_display(getv("inflection")), __lf, "\n"); ] [end mode export] [begin mode entry_abbr] [@this.title()] [var pro = getv("pro"); if(pro != "") pro & ","] <i>[getv("part");]</i>. [ var $d = replace(getv("definition"), "<!!>", "<!>"); var $pos = strpos($d, ". "); if(substr($d, "-1", 1) == __lf) $d = substr($d, 0, "-1"); if(substr($d, "-1", 1) == __cr) $d = substr($d, 0, "-1"); iif($pos >= 0) _wiki_format(substr($d, 0, 1 + $pos), "inline") else _wiki_format($d, "inline"); ]<br> [end mode entry_abbr] [begin mode link][ var hl = (strpos($_title, "<!>") > "-1"); var $t = ""; if(hl) $t = substr($_title, 0, strpos($_title, "<!>")) else $t = $_title; ] <a href="/?id=[_id]">[info_display($t)]</a>[ if(hl) { <b>([ substr($_title, strpos($_title, "<!>") + 3) ])</b>}; ][end mode link] [begin mode abbr][ var word = iif(strpos($_title, "<!>") > "-1", substr($_title, 0, strpos($_title, "<!>")), $_title); word = _title; if(strpos(_title, "<!>") != "-1") word = substr(_title, 0, strpos(_title, "<!>")); var part = getv("part"); if(((part == "pre") || (part == "prefix")) && substr(word, -1, 1) != "-") word &= "–"; if(((part == "suf") || (part == "suffix")) && substr(word, 0, 1) != "-") word = "–" & word; "[style:font-weight: bold; font-size: 100%][/?id=" & $_id & "|" & info_display(word) & "][/style]"; if(strpos($_title, "<!>") > "-1") " (" & substr($_title, strpos($_title, "<!>") + 3) & ")"; var pro = getv("pro"); if(pro != "") ", " & pro; " [i]" & getv("part") & "[/i]. "; var $d = replace(getv("definition"), "<!!>", "<!>"); var $pos = strpos($d, ". "); if(substr($d, "-1", 1) == __lf) $d = substr($d, 0, "-1"); if(substr($d, "-1", 1) == __cr) $d = substr($d, 0, "-1"); if($pos > 0) {[ if(substr($d, $pos + 1, 1) == ")") $pos = $pos + 1; substr($d, 0, 1 + $pos); ]} else $d; ] [end mode abbr] [begin mode view] [suppress_title(); if(_group != 0) {[ var gpid = get_group_profile_id(_group); if(gpid != 0) page("css", gpid); ]}; ] <div style="margin-left: 20px"> [ var $unwrap = function {[ replace(_args[0], "<!!>", "<!>"); ]}; var word = _title; if(strpos(_title, "<!>") != "-1") word = substr(_title, 0, strpos(_title, "<!>")); var part = getv("part"); if(((part == "pre") || (part == "prefix")) && substr(word, -1, 1) != "-") word &= "–"; if(((part == "suf") || (part == "suffix")) && substr(word, 0, 1) != "-") word = "–" & word; word = info_display(word); var suffix = ""; if(strpos($_title, "<!>") > "-1") suffix = " (" & substr($_title, strpos($_title, "<!>") + 3) & ")"; override_title(word, $_subtitle); $dd = unwrap(getv("definition")); if(substr($dd, "-1", 1) == __lf) $dd = substr($dd, 0, "-1"); if(substr($dd, "-1", 1) == __cr) $dd = substr($dd, 0, "-1"); var $u = unwrap(getv("usage")); var $e = unwrap(getv("etymology")); var $a = unwrap(getv("attestation")); var $pro = getv("pronunciation"); var $inf = unwrap(getv("inflection")); if($inf == "") $inf = search("include", "parent", _parent, "template", title2id("Inflection Scheme"), list(_id)); ] <p style="text-indent: -20px;">[ if(_args.0 == "link") "<a href=\"/?id=" & _id & "\">"; "<b>" & word & "</b>"; if(_args.0 == "link") "</a>"; suffix; ", "; if($pro != "") pro & ", "; "<i>" & getv("part") & "</i>."; _wiki_format($dd, "inline"); ]</p> [ if($u) {<p><span style="font-variant: small-caps">usage:</span> [_wiki_format($u, "inline")]</p>}; if($e) {<span style="font-variant: small-caps">etymology:</span> [_wiki_format($e, "inline")]<br>}; if($a) {<span style="font-variant: small-caps">attestation:</span> [_wiki_format($a, "inline")]<br>}; // <span style="font-variant: small-caps">inflection:</span> if($inf) {[_wiki_format($inf, "inline")]<br>}; if($_args[0] != "nocats") {[ var $c = getv("categories"); var $r = unwrap(getv("related")); if($r) {<span style="font-variant: small-caps">related:</span> [ var $foo = foreach($r) {[ $_data = replace($_data, __cr, ""); $_data = if(substr($_data, 0, 1) == "#") {[ var id = int(substr($_data, 1)); if(id > 0) {<a href="/?id=[id]">[get_title(id)]</a> ([get_title(get_parent(id))])} else {<i>[$_data]</i>}; ]} else {[ var id = search("id", "parent", _parent, "title", $_data); if(id != "") {[ var nice_title = get_title(id); var sep_pos = strpos(nice_title, "<!>"); if(sep_pos >= 0) {[ var subscript = substr(nice_title, sep_pos + 3); nice_title = substr(nice_title, 0, sep_pos); {<a href="/?id=[id]">[nice_title]</a> ([subscript])}; ]} else {[ {<a href="/?id=[id]">[nice_title]</a>}; ]}; ]} else {<i>[_data]</i>}; ]}; ]}; replace($foo, __lf, ", "); ]<br>}; if($c) { <span style="font-variant: small-caps">tags:</span> [ var $cat = title2id("Dictionary Tag"); var $bar = foreach($c) {[ $_data = replace($_data, __cr, ""); var $id = search("id", "parent", $_parent, "title", $_data, "template", $cat); if($id == "") {[ $_data = {<i>[$_data]</i>}; ]} else {[ $_data = {<a href="/?id=[$id]">[$_data]</a>}; ]}; ]}; replace($bar, __lf, ", "); ]<br>}; var reverse = foreach_key(_this) (_data = {<a href="/?id=[_parent]&mode=reverse&term=[_data]">[_data]</a>, }); reverse = substr(reverse, 0, len(reverse) - 2); if(reverse != "") {<span style="font-variant: small-caps">reverse terms:</span> [reverse]<br>}; ]}; ] </div> [end mode view] [begin mode print]<style>.t a:link { font-weight: 800; text-decoration: none }</style><span class="t">[_this.title()]</span>[ var pro = getv("pronunciation"); if(pro != "") ", " & pro; var etym = getv("etymology"); if(substr(etym, 0, 5) == "From ") etym = substr(etym, 5, "-1"); if(substr(etym, 0, 4) == "the ") etym = substr(etym, 4, "-1"); /* if((len(etym) < 40) && etym != "") " [" & _wiki_format(etym, "inline") & "]"; */ { <i>[getv("part")].</i> }; var dd = getv("definition"); if(substr($dd, "-1", 1) == __lf) $dd = substr($dd, 0, "-1"); if(substr($dd, "-1", 1) == __cr) $dd = substr($dd, 0, "-1"); var def = $dd; if(etym != "") def = " [" & etym & "] " & def; /* var x = foreach_key(_this) {[_data]}; if(x != "") {[ x = linesplit(x); // debug(x); x = sieve(x) ?(v) {[ // debug(v); if(strpos(lcase($dd), lcase(v)) > "-1") false else true; ]}; if(count(x)) def &= " [i]et[/i]. " & concat(x, ", ") & "."; ]}*/; // if(len(etym) >= 40) var usage = getv("usage"); if(usage != "") def &= " [small]USE[/small]: " & usage; var att = getv("attestation"); if(att != "") def &= " [small]FL[/small]. " & att; var infl = getv("inflection"); if(infl != "") def &= " [i]infl[/i]. " & infl; _wiki_format(def, "inline"); ]<br> [end mode print] [begin mode edit] [ var $unwrap = function {[ replace(_args[0], "<!!>", "<!>"); ]}; if(strpos($_title, "<!>") > "-1") override_title(info_display(substr($_title, 0, strpos($_title, "<!>"))) & " (" & substr($_title, strpos($_title, "<!>") + 3) & ")", $_subtitle) else override_title(info_display($_title), $_subtitle); ] <div> <form method="post" action="/" style="width: 100%;"> <style type="text/css"> #entry-edit .textbox { width: 50%; } #entry-edit th { text-align: right; vertical-align: top; font-weight: normal; font-size: 80%; } </style> <input type="hidden" name="id" value="[$_id]"> <input type="hidden" name="mode" value="submit"> <table style="width: 100%" id="entry-edit"> <tr><th width="5px">headword<td><input name="title" type="text" value="[edit_display($_title)]" style="width: 100%;"> <tr><th>pronunciation<td><input name="pronunciation" type="text" value="[edit_display(getv("pronunciation"))]" style="width: 100%;"> <tr><th>definition<td><textarea style="width: 100%;" name="definition">[edit_display(unwrap(getv("definition")))]</textarea> <br><small>(should always end with a period; the text up to the first period will be shown in lists)</small> <tr><th>usage<td><textarea style="width: 100%;" name="usage">[edit_display(unwrap(getv("usage")))]</textarea> <tr><th>etymology<td><textarea style="width: 100%;" name="etymology">[edit_display(unwrap(getv("etymology")))]</textarea> <tr><th>attestation<td><textarea style="width: 100%;" name="attestation">[edit_display(unwrap(getv("attestation")))]</textarea> <tr><th>inflection<td><textarea style="width: 100%;" name="inflection">[edit_display(unwrap(getv("inflection")))]</textarea> <br><small>(leave this blank to use <a href="/?id=[parent]&mode=inflections">automatic inflection schemes</a>)</small> <tr><th>tags<td><textarea style="width: 100%;" name="categories">[edit_display(getv("categories"))]</textarea> <br><small>(one tag per line)</small> <tr><th>related<td><textarea style="width: 100%;" name="related">[edit_display(unwrap(getv("related")))]</textarea> <br><small>(one per line; use #<number> to refer to an id of an entry in another dictionary)</small> <tr><th>reverse terms<td><textarea style="width: 100%;" name="reverse">[ var x = foreach_key(_this) {}; if(x == "") {[ var def = getv("definition"); def = replace(def, ",", "."); def = replace(def, ";", "."); var go = 1; while(go == 1) {[ if(substr(lcase(def), 0, 3) == "to ") def = substr(def, 3); var dot = strpos(def, "."); var space = strpos(def, " "); go = 0; if(dot > 0) {[ if((dot < space) || (space < 0)) {[ var ret = lcase(substr(def, 0, dot)); iif(_title != lcase(_title), ucase(substr(ret, 0, 1)) & substr(ret, 1), ret) & __lf; def = trim(substr(def, dot + 1)); go = 1; ]}; ]}; ]}; ]} else x; ]</textarea> <tr><th>part of speech<td> [var $parts = replace(getva("parts", get_body(_parent)), chr(9), "<!>"); if($parts == "") {<b>Go to <a href="/?id=[_parent]&mode=edit" target="_blank">the dictionary's edit page</a> and set up the language's parts of speech before saving this!</b>}; _select(getv("part"), $parts, "part", {width: 100%;})] <tr><td><td> <a name="bottom"></a> <input type="submit" value="Submit"> </table> </form> </div> [end mode edit] [begin mode autoreverse][ var revs = {[ var x = foreach_key(_this) {}; if(x == "") {[ var def = replace(getv("definition"), "<!!>", "<!>"); def = replace(def, ",", "."); def = replace(def, ";", "."); var go = 1; while(go == 1) {[ if(substr(lcase(def), 0, 3) == "to ") def = substr(def, 3); var dot = strpos(def, "."); var space = strpos(def, " "); go = 0; if(dot > 0) {[ if((dot < space) || (space < 0)) {[ var ret = lcase(substr(def, 0, dot)); iif(_title != lcase(_title), ucase(substr(ret, 0, 1)) & substr(ret, 1), ret) & __lf; def = trim(substr(def, dot + 1)); go = 1; ]}; ]}; ]}; ]} else x; ]}; mute foreach_key(_this) delete_data(_id, _data); var pr = replace(revs, __cr, ""); if(substr(pr, -1, 1) == __lf) pr = substr(pr, 0, len(pr) - 1); mute foreach(pr) if(_data != "") {[ _this[_data] = 1; ]}; msg_start();] It's done.<br><br> Definition: [_wiki_format(getv("definition"), "no_toc")] Reverse keywords: [replace(pr, __lf, "; ")]<br><br> <a href="/?id=[$_id]&mode=edit#bottom">Edit further</a><br> <a href="/?id=[$_id]">View entry in full</a><br> [msg_end();] [end mode autoreverse] [begin mode reverse_simple][ var t = 0; var def = lcase(replace(getv("definition"), "<!!>", "<!>")); def = replace(def, ",", "."); def = replace(def, ";", "."); if(substr(lcase(def), 0, 3) == "to ") def = substr(def, 3); var dot = strpos(def, "."); var space = strpos(def, " "); var ret = ""; if((t == 0) && (space == -1)) ( (ret = substr(def, 0, dot)) & (t = 1) ) else if(dot > 0) ( if((dot < space) || (space < 0)) ( (ret = substr(def, 0, dot)) & (t = 2) ) ); if((_params.set == t) || (_params.set == "")) "<li><a target=\"_blank\" href=\"/?id=" & _id & "&mode=edit#bottom\">" & _title & "</a> " & ( if(t == 1) "easy: " & iif(_title != lcase(_title), ucase(substr(ret, 0, 1)) & substr(ret, 1), ret) & " <a target=\"_blank\" href=\"/?id=" & _id & "&mode=autoreverse\">(auto)</a>" else if(t == 2) "medium: " & ret & " ... <a target=\"_blank\" href=\"/?id=" & _id & "&mode=autoreverse\">(auto)</a>" else if(t == 0) "hard" ) & " <a target=\"_blank\" href=\"/?id=" & _id & "&mode=edit#bottom\">(manual)</a></li>"; ][end mode reverse_simple] [begin mode tidy][ var d = getv("definition"); var f = substr(d, -1, 1); if(f == __lf) {[ d = substr(d, 0, len(d) - 1); ] Removed 0x0a from end of <b>[_title]</b>.}; f = substr(d, -1, 1); if(f == __cr) {[ d = substr(d, 0, len(d) - 1); ] Removed 0x0d from end of <b>[_title]</b>.}; putv("definition", d); ][end mode tidy] [begin mode submit] [ var $dumbwrap = function {[ replace(_args[0], "<!>", "<!!>"); ]}; if(strpos($_title, "<!>") > "-1") override_title(info_display(substr($_title, 0, strpos($_title, "<!>"))) & " (" & substr($_title, strpos($_title, "<!>") + 3) & ")", $_subtitle) else override_title(info_display($_title), $_subtitle); $_title = $_params.title; putv("definition", dumbwrap($_params.definition)); putv("etymology", dumbwrap($_params.etymology)); putv("usage", dumbwrap($_params.usage)); putv("attestation", dumbwrap($_params.attestation)); putv("related", dumbwrap($_params.related)); putv("part", $_params.part); putv("categories", $_params.categories); putv("pronunciation", $_params.pronunciation); putv("inflection", dumbwrap($_params.inflection)); mute foreach_key(_this) delete_data(_id, _data); var pr = replace(_params.reverse, __cr, ""); mute foreach(pr) if(_data != "") _this[_data] = 1; // refresh_to({./?id=[_id]}, 10); msg_start();] It's done.<br><br> <a href="/?id=[$_id]">Go back to the entry?</a><br> <a href="/?id=[$_parent]&mode=add_entry">Add another entry?</a><br> <a href="/?id=[$_parent]">Return to the dictionary?</a> [msg_end();] [end mode submit]