Libraryless. Click here for Pure Java version (6364L/45K/131K).
!752 concepts. concept Definition { S name; // what is defined S text; // definition text O source; // where definition comes from (optional) O caveat; // an optional restriction of the definition, like "maybe" or "allegedly" or "rarely" or smth. *() {} *(S *name, S *text) { change(); } } p { loadAndAutoSaveConcepts(); serveHttp(7654); makeBot("Wiki."); } synchronized answer { if "def * *" { S name = m.unq(0); S text = m.unq(1); new Definition(name, text); int count = countConcepts(Definition.class, "name", name); ret "Definition saved! Now have " + n(count, "definition") + " for " + quote(name) + "."; } } synchronized html { uri = dropPrefix("/", uri); if (startsWith(uri, "!")) { S name = substring(uri, 1); L<Definition> l = findConceptsWhere(Definition.class, "name", name); if (empty(l)) ret fixHTML("No definition found for " + quote(htmlencode(name))); else ret fixHTML(h1(htmlencode(name)) + ul(map(l, func(Definition d) { htmlencode(d.text) }))); } final MultiSet<S> ms = collectMultiSet(list(Definition.class), "name"); L<S> names = sorted(ms.keySet()); ret fixHTML( h1("A. I. Wiki!") + p("Yo I got definitions for:") + ul(map(names, func(S name) { ahref("/!" + urlencode(name), htmlencode(name)) + bracketedCount(ms.get(name)) }))); }
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005059 |
Snippet name: | Wiki [simple version] |
Eternal ID of this version: | #1005059/1 |
Text MD5: | fbeaf402dff4e4881b9223a48cfa3dab |
Transpilation MD5: | 59879f078b2de06f6a5f3f230b5342de |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-10-04 21:12:41 |
Source code size: | 1430 bytes / 51 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 679 / 1092 |
Referenced in: | #1005066 - Wiki v2 [WORKS] |