Libraryless. Click here for Pure Java version (1738L/11K/38K).
1 | !759 |
2 | |
3 | static PersistentMap<S, S> urlToText; |
4 | |
5 | p { |
6 | urlToText = new PersistentMap("urlToText"); |
7 | } |
8 | |
9 | static synchronized S html(S uri) { |
10 | uri = dropPrefix("/", uri); |
11 | |
12 | if (empty(uri) || eq(uri, "list")) { |
13 | new L<S> list; |
14 | for (S url : keys(urlToText)) { |
15 | list.add(a("/" + url, "href", pageLink(url))); |
16 | } |
17 | ret h3("Pages") + ul(list); |
18 | } |
19 | |
20 | S html = urlToText.get(tlc(uri)); |
21 | ret or2(html, "?"); |
22 | } |
23 | |
24 | static sync boolean hasURL(S bla) { |
25 | ret urlToText.containsKey(tlc(bla)); |
26 | } |
27 | |
28 | static sync S getTextForURL(S bla) { |
29 | ret urlToText.get(tlc(bla)); |
30 | } |
31 | |
32 | // returns previous text if any |
33 | static sync S setURL(S bla, S text) { |
34 | ret urlToText.put(tlc(bla), text); |
35 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1003007 |
Snippet name: | Home Pages Bot |
Eternal ID of this version: | #1003007/1 |
Text MD5: | a27bdd444fafe4b3e3f27a2eab66431b |
Transpilation MD5: | 0fa5e71478d3d7e30a31720f299db9f2 |
Author: | stefan |
Category: | eleu / internet |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-04-18 17:26:37 |
Source code size: | 713 bytes / 35 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 630 / 1062 |
Referenced in: | [show references] |