- public Object walk(String head, Object[] children) {
- Tree<String>[] kids = new Tree[children.length];
- for(int i=0; i<children.length; i++) {
- if (children[i]==null) kids[i]=null;
- else if (children[i] instanceof String) kids[i] = lone((String)children[i]);
- else kids[i] = (Tree<String>)children[i];
+ }
+ public static class OL extends List { public String tag() { return "ol"; } }
+ public static class UL extends List { public String tag() { return "ul"; } }
+
+
+
+ // Tags //////////////////////////////////////////////////////////////////////////////
+
+ public static class Chars extends Text.TextString { }
+ public static class Symbol extends Text.TextString { }
+ public static class Keyword extends Text.TextString { public String tag() { return "tt"; } }
+ public static class Subscript extends Text.TextString { public String tag() { return "sub"; } }
+ public static class Superscript extends Text.TextString { public String tag() { return "super"; } }
+ public static class Bold extends Text.TextArray { public String tag() { return "b"; } }
+ public static class Smallcap extends Text.TextArray { public String tag() { return "sc"; } }
+ public static class Strikethrough extends Text.TextArray { public String tag() { return "strike"; } }
+ public static class TT extends Text.TextArray { public String tag() { return "tt"; } }
+ public static class Underline extends Text.TextArray { public String tag() { return "u"; } }
+ public static class Italic extends Text.TextArray { public String tag() { return "i"; } }
+ public static class Citation extends Text.TextArray { /* FIXME */ }
+ public static class Footnote extends Text.TextArray { /* FIXME */ }
+ public static class LineBreak extends Text { public void toHTML(ToHTML.HTML sb) { sb.tag("br"); } }
+ public static class Today extends Text { }
+ public static class Euro extends Text { public void toHTML(ToHTML.HTML sb) { sb.entity(8364); } }
+ public static class Link extends Text {
+ public Text[] text;
+ public URI href;
+ public void toHTML(ToHTML.HTML sb) { sb.tag("a", new Object[] { "href", href }, text); }
+ }
+ public static class Entity extends Text {
+ public final String entity;
+ public Entity(String entity) { this.entity = entity; }
+ public void toHTML(ToHTML.HTML sb) { sb.entity(entity); }
+ }
+
+
+ // Network //////////////////////////////////////////////////////////////////////////////
+
+ public static interface Host extends ToHTML {
+ public static class DNS implements Host {
+ public String[] part;
+ public void toHTML(ToHTML.HTML sb) {
+ for(int i=0; i<part.length; i++)
+ sb.append((i==0 ? "" : ".")+part[i]);