!7 p { serveHttpOpenBrowser(7777); } html { uri = dropPrefix("/", uri); bool real = uri.startsWith("real/"); if (real) uri = dropPrefix("real/", uri); S snippetID = #1007528; if (isSnippetID(uri)) snippetID = fsI(uri); S code = loadSnippet(snippetID); L tok = javaTok(code); new Map links; // token index -> sf snippet ID SS sf = stdFunctions_cached(); for (int i = 1; i < l(tok); i += 2) { S t = tok.get(i); if (isIdentifier(t)) { S id = sf.get(t); if (id == null) continue; S prev = get(tok, i-2); if (eq(prev, "f") || eq(get(tok, i+2), "(") && (neq(prev, ".") || eq(get(tok, i-4), "main"))) links.put(i, id); } } new StringBuilder out; SS titles = getSnippetTitles(values(links)); for i over tok: { S t = tok.get(i), id = links.get(i); out.append(id == null ? htmlencode(t) : ahref(makeLink(real, id), htmlencode(t), title := titles.get(fsI(id))); } S html = str(out); if (real) ret html; ret h3_title("Snippet " + snippetID) + hpre(html); } sS makeLink(bool real, S id) { if (real) ret longSnippetLink(id); ret "/" + psI(id); }