diff --git a/output.go b/output.go index 2b101dd..68f9a4c 100644 --- a/output.go +++ b/output.go @@ -119,6 +119,19 @@ func (w *htmlOut) str(s string) *htmlOut { return w } +func (w *htmlOut) children(el *element) *htmlOut { + return w.elist(el.children) +} +func (w *htmlOut) inline(tag string, el *element) *htmlOut { + return w.s(tag).children(el).s("").str(elt.contents.str).s("") case HTML: @@ -175,21 +188,21 @@ func (w *htmlOut) elem(elt *element) *htmlOut { } w.s(" />") case EMPH: - w.s("").elist(elt.children).s("") + w.inline("", elt) case STRONG: - w.s("").elist(elt.children).s("") + w.inline("", elt) case LIST: - w.elist(elt.children) + w.children(elt) case RAW: /* Shouldn't occur - these are handled by process_raw_blocks() */ log.Fatalf("RAW") case H1, H2, H3, H4, H5, H6: - h := "h" + string('1'+elt.key-H1) + ">" /* assumes H1 ... H6 are in order */ - w.pad(2).s("<").s(h).elist(elt.children).s("" /* assumes H1 ... H6 are in order */ + w.pad(2).inline(h, elt).pset(0) case PLAIN: - w.pad(1).elist(elt.children).pset(0) + w.pad(1).children(elt).pset(0) case PARA: - w.pad(2).s("

").elist(elt.children).s("

").pset(0) + w.pad(2).inline("

", elt).pset(0) case HRULE: w.pad(2).s("


").pset(0) case HTMLBLOCK: @@ -197,19 +210,19 @@ func (w *htmlOut) elem(elt *element) *htmlOut { case VERBATIM: w.pad(2).s("
").str(elt.contents.str).s("
").pset(0) case BULLETLIST: - w.pad(2).s("").pset(0) + w.listBlock("