checkpoint
[sbp.git] / src / edu / berkeley / sbp / tib / TibDoc.java
index 27f6ae1..469c166 100644 (file)
@@ -338,13 +338,13 @@ toContex ll = prefix ++ (concatMap tl ll) ++ suffix
             public void toHTML(HTML h) { body.toHTML(h); }
         }
 
-        public @bind.as("H") static class Header extends Dump {
+        public @bind static class Header extends Dump {
             public @bind.arg KeyVal[] attrs;
             // FIXME: it would be nice to be able to
             // void KeyVal(String, String) { ... } imperatively
         }
         
-        public @bind.as("B") static class Body extends Dump implements ToHTML {
+        public @bind static class Body extends Dump implements ToHTML {
             public Section[] sections;
             public void toHTML(HTML h) { for(Section s : sections) s.toHTML(h); }
         }
@@ -384,16 +384,17 @@ toContex ll = prefix ++ (concatMap tl ll) ++ suffix
             public @bind.arg String password;
         }
 
-        public @bind.as("Euro") Object euro() { return null; }
-        public @bind.as("Citation") Object cite(Object o) { return null; }
-        public @bind.as("Symbol") Object sym(Object o) { return null; }
+        public static @bind.as("Euro") Object euro() { return null; }
+        public static @bind.as("Citation") Object cite(Object o) { return new Chars("*cite*"); }
+        public static @bind.as("Symbol") Object sym(Object o) { return null; }
 
         public static abstract class List extends Text {
-            public @bind.arg Text[] points;
+            public @bind.arg Text[][] points;
             public abstract String tag();
             public void toHTML(ToHTML.HTML sb) {
                 sb.append("<"+tag()+">\n");
-                for(Text t : points) sb.tag("li", t);
+                for(Text[] t : points)
+                    sb.tag("li", t);
                 sb.append("</"+tag()+">\n");
             }
         }
@@ -409,6 +410,16 @@ toContex ll = prefix ++ (concatMap tl ll) ++ suffix
        public static class Blockquote extends Paragraph {
             Text[] text;
             public @bind Blockquote(Text[] t) { this.text = t; }
+            public @bind Blockquote(Text[] t, Text[] t2) {
+                if (t2==null) {
+                    this.text = t;
+                } else {
+                    Text[] t3 = new Text[t.length + t2.length];
+                    System.arraycopy(t,  0, t3, 0, t.length);
+                    System.arraycopy(t2, 0, t3, t.length, t2.length);
+                    this.text = t3;
+                }
+            }
             public void toHTML(HTML h) { h.tag("blockquote", new P(text)); }
         }
 
@@ -425,12 +436,15 @@ toContex ll = prefix ++ (concatMap tl ll) ++ suffix
             public void toHTML(HTML h) { for(Text t : text) t.toHTML(h); }
         }
         public static class TextWrap extends Text {
-            public Text text;
+            public @bind.arg Text[] text;
             public void toHTML(HTML h) {
-                if (htmlTag()!=null)
-                    h.tag(htmlTag(), htmlTagParams(), text);
-                else
-                    text.toHTML(h);
+                if (htmlTag()!=null) {
+                    h.openTag(htmlTag(), htmlTagParams());
+                }
+                for(Text t : text) t.toHTML(h);
+                if (htmlTag()!=null) {
+                    h.closeTag(htmlTag());
+                }
             }
             public String   htmlTag() { return null; }
             public Object[] htmlTagParams() { return null; }
@@ -441,7 +455,7 @@ toContex ll = prefix ++ (concatMap tl ll) ++ suffix
         public static @bind class Footnote extends TextWrap { public String htmlTag() { return "small"; } }
         public static @bind class TT extends TextWrap { public String htmlTag() { return "tt"; } }
         //public @bind class Citation extends Text {       "[" word "]" }
-        public static @bind class Strikethrough extends TextWrap { public String htmlTag() { return "strikethrough"; } }
+        public static @bind class Strikethrough extends TextWrap { public String htmlTag() { return "strike"; } }
         public static @bind class Superscript extends TextWrap { public String htmlTag() { return "sup"; } }
         public static @bind class Subscript extends TextWrap { public String htmlTag() { return "sub"; } }
         public static @bind class Smallcap extends TextWrap { public String htmlTag() { return "sc"; } }
@@ -454,7 +468,7 @@ toContex ll = prefix ++ (concatMap tl ll) ++ suffix
         public static @bind class LineBreak extends Command { public void toHTML(HTML h) { h.tag("br"); } }
 
         public abstract static class Glyph extends Text { }
-        public static @bind.as("emdash") class Emdash extends Glyph { public void toHTML(HTML h) { h.append("&emdash;"); } }
+        public static @bind.as("emdash") class Emdash extends Glyph { public void toHTML(HTML h) { h.appendLiterally("&mdash;"); } }
 
         public static class Link extends Text {
             public Text[] t;