!7 p { useLocalMechListCopies(); } html { uri = dropPrefix("/", uri); L rules = ai_activeRules(); S ruleID = urldecode(uri); if (empty(uri)) ret h2_title(n2(rules, "rule")) + ul(map_pcall(reversed(rules), func(IfThen rule) { ahref(rawSelfLink(urlencode(rule.globalID)), htmlencode(rule.globalID)) })); L found = filterByField(rules, globalID := ruleID); if (empty(found)) ret "Rule " + htmlencode(ruleID) + " not found"; new StringBuilder buf; if (l(found) > 1) buf.append(p("Bad: Multiple rules for ID " + htmlencode(ruleID) + ".")); for (IfThen rule : found) { buf.append(h2_title("Rule " + htmlencode(rule.globalID))); buf.append(hsourcecode(/*str(rule)*/ rule.originalText)); if (ai_ruleDifferentFromOriginalText(rule)) { buf.append(h3("Loaded as")); buf.append(hsourcecode(str(rule))); } } ret buf; }