diff --git a/org/block.go b/org/block.go index 63d3a8c..c0126ec 100644 --- a/org/block.go +++ b/org/block.go @@ -28,17 +28,26 @@ func (d *Document) parseBlock(i int, parentStop stopFn) (int, Node) { t, start, nodes := d.tokens[i], i, []Node{} name, parameters := t.content, strings.Fields(t.matches[3]) trim := trimIndentUpTo(d.tokens[i].lvl) - for i++; !(d.tokens[i].kind == "endBlock" && d.tokens[i].content == name); i++ { - if parentStop(d, i) { - return 0, nil + stop := func(d *Document, i int) bool { + return parentStop(d, i) || (d.tokens[i].kind == "endBlock" && d.tokens[i].content == name) + } + if name == "SRC" || name == "EXAMPLE" { + for i++; !stop(d, i); i++ { + nodes = append(nodes, Line{[]Node{Text{trim(d.tokens[i].matches[0])}}}) } - text := trim(d.tokens[i].matches[0]) - if name == "SRC" || name == "EXAMPLE" { - nodes = append(nodes, Line{[]Node{Text{text}}}) - } else { - nodes = append(nodes, Line{d.parseInline(text)}) + } else { + for i++; !stop(d, i); { + consumed, node := d.parseParagraph(i, stop) + if consumed == 0 { + break + } + i += consumed + nodes = append(nodes, node) } } + if parentStop(d, i) { + return 0, nil + } return i + 1 - start, Block{name, parameters, nodes} } diff --git a/org/html.go b/org/html.go index f2d89ed..b76e481 100644 --- a/org/html.go +++ b/org/html.go @@ -122,13 +122,13 @@ func (w *HTMLWriter) writeBlock(b Block) { w.writeNodes(b.Children...) w.WriteString("\n") case "CENTER": - w.WriteString(`
` + "\n") + w.WriteString(`
`, strings.ToLower(b.Name)) + "\n") + w.WriteString(fmt.Sprintf(`
+Mongodb is very webscale +
++and quote blocks can contain multiple paragraphs +
+
This is verse
-+
or even a totally custom kind of block crazy ain't it?
+code
wrapped text gets joined
either this
or that
foo.
@@ -204,7 +213,9 @@ or that
foo.
+
code
--- as code plus dash