5 import static jrw.sp.cons.populate;
8 public static final Namespace ns = new Namespace("http://www.w3.org/1999/xhtml", "h");
9 public static final DocType doctype = new DocType("html", "-//W3C//DTD XHTML 1.1//EN", "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd");
11 public static class cons {
12 private static final Name html = new Name(ns, "html");
13 public static Element html(Object... c) {return(populate(new Element(html), c));}
14 private static final Name head = new Name(ns, "head");
15 public static Element head(Object... c) {return(populate(new Element(head), c));}
16 private static final Name base = new Name(ns, "base");
17 public static Element base(Object... c) {return(populate(new Element(base), c));}
18 private static final Name title = new Name(ns, "title");
19 public static Element title(Object... c) {return(populate(new Element(title), c));}
20 private static final Name link = new Name(ns, "link");
21 public static Element link(Object... c) {return(populate(new Element(link), c));}
22 private static final Name meta = new Name(ns, "meta");
23 public static Element meta(Object... c) {return(populate(new Element(meta), c));}
24 private static final Name style = new Name(ns, "style");
25 public static Element style(Object... c) {return(populate(new Element(style), c));}
26 private static final Name script = new Name(ns, "script");
27 public static Element script(Object... c) {return(populate(new Element(script), c));}
28 private static final Name body = new Name(ns, "body");
29 public static Element body(Object... c) {return(populate(new Element(body), c));}
30 private static final Name div = new Name(ns, "div");
31 public static Element div(Object... c) {return(populate(new Element(div), c));}
32 private static final Name span = new Name(ns, "span");
33 public static Element span(Object... c) {return(populate(new Element(span), c));}
34 private static final Name p = new Name(ns, "p");
35 public static Element p(Object... c) {return(populate(new Element(p), c));}
36 private static final Name ul = new Name(ns, "ul");
37 public static Element ul(Object... c) {return(populate(new Element(ul), c));}
38 private static final Name ol = new Name(ns, "ol");
39 public static Element ol(Object... c) {return(populate(new Element(ol), c));}
40 private static final Name li = new Name(ns, "li");
41 public static Element li(Object... c) {return(populate(new Element(li), c));}
42 private static final Name dl = new Name(ns, "dl");
43 public static Element dl(Object... c) {return(populate(new Element(dl), c));}
44 private static final Name dt = new Name(ns, "dt");
45 public static Element dt(Object... c) {return(populate(new Element(dt), c));}
46 private static final Name dd = new Name(ns, "dd");
47 public static Element dd(Object... c) {return(populate(new Element(dd), c));}
48 private static final Name table = new Name(ns, "table");
49 public static Element table(Object... c) {return(populate(new Element(table), c));}
50 private static final Name th = new Name(ns, "th");
51 public static Element th(Object... c) {return(populate(new Element(th), c));}
52 private static final Name tr = new Name(ns, "tr");
53 public static Element tr(Object... c) {return(populate(new Element(tr), c));}
54 private static final Name td = new Name(ns, "td");
55 public static Element td(Object... c) {return(populate(new Element(td), c));}
56 private static final Name a = new Name(ns, "a");
57 public static Element a(Object... c) {return(populate(new Element(a), c));}
58 private static final Name img = new Name(ns, "img");
59 public static Element img(Object... c) {return(populate(new Element(img), c));}
60 private static final Name video = new Name(ns, "video");
61 public static Element video(Object... c) {return(populate(new Element(video), c));}
62 private static final Name audio = new Name(ns, "audio");
63 public static Element audio(Object... c) {return(populate(new Element(audio), c));}
64 private static final Name source = new Name(ns, "source");
65 public static Element source(Object... c) {return(populate(new Element(source), c));}
66 private static final Name track = new Name(ns, "track");
67 public static Element track(Object... c) {return(populate(new Element(track), c));}
68 private static final Name form = new Name(ns, "form");
69 public static Element form(Object... c) {return(populate(new Element(form), c));}
70 private static final Name input = new Name(ns, "input");
71 public static Element input(Object... c) {return(populate(new Element(input), c));}
72 private static final Name em = new Name(ns, "em");
73 public static Element em(Object... c) {return(populate(new Element(em), c));}
74 private static final Name strong = new Name(ns, "strong");
75 public static Element strong(Object... c) {return(populate(new Element(strong), c));}
76 private static final Name hr = new Name(ns, "hr");
77 public static Element hr(Object... c) {return(populate(new Element(hr), c));}
78 private static final Name br = new Name(ns, "br");
79 public static Element br(Object... c) {return(populate(new Element(br), c));}
80 private static final Name blockquote = new Name(ns, "blockquote");
81 public static Element blockquote(Object... c) {return(populate(new Element(blockquote), c));}
82 private static final Name code = new Name(ns, "code");
83 public static Element code(Object... c) {return(populate(new Element(code), c));}
84 private static final Name pre = new Name(ns, "pre");
85 public static Element pre(Object... c) {return(populate(new Element(pre), c));}
86 private static final Name h1 = new Name(ns, "h1");
87 public static Element h1(Object... c) {return(populate(new Element(h1), c));}
88 private static final Name h2 = new Name(ns, "h2");
89 public static Element h2(Object... c) {return(populate(new Element(h2), c));}
90 private static final Name h3 = new Name(ns, "h3");
91 public static Element h3(Object... c) {return(populate(new Element(h3), c));}
92 private static final Name h4 = new Name(ns, "h4");
93 public static Element h4(Object... c) {return(populate(new Element(h4), c));}
94 private static final Name h5 = new Name(ns, "h5");
95 public static Element h5(Object... c) {return(populate(new Element(h5), c));}
96 private static final Name h6 = new Name(ns, "h6");
97 public static Element h6(Object... c) {return(populate(new Element(h6), c));}
100 public static Map<Object, Object> response(Request req, Element root) {
101 // XXX: Use proper Content-Type for clients accepting it.
102 req.ohead("Content-Type", "text/html; charset=utf-8", true);
103 req.body(new HtmlFormatter(root));
104 return(req.response());