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(`

` + "\n") w.writeNodes(b.Children...) - w.WriteString("

\n") + w.WriteString("
\n") default: - w.WriteString(fmt.Sprintf(`

`, strings.ToLower(b.Name)) + "\n") + w.WriteString(fmt.Sprintf(`

`, strings.ToLower(b.Name)) + "\n") w.writeNodes(b.Children...) - w.WriteString("

\n") + w.WriteString("
\n") } } diff --git a/org/testdata/example.html b/org/testdata/example.html index ce63503..92a0b20 100644 --- a/org/testdata/example.html +++ b/org/testdata/example.html @@ -183,19 +183,28 @@ an example block with multiple lines
+

Mongodb is very webscale +

+

+and quote blocks can contain multiple paragraphs +

issues from goorgeous (free test cases, yay!)

#29: Support verse block

-

+

+

This is verse

-

+

+
+

or even a totally custom kind of block crazy ain't it?

+

#47: Consecutive code wrapped text gets joined

either this or that foo. @@ -204,7 +213,9 @@ or that foo.

#68: Quote block with inline markup

+

this is markup! +

#77: Recognize code--- as code plus dash

#75: Not parsing nested lists correctly

diff --git a/org/testdata/example.org b/org/testdata/example.org index 5ae2b30..abbe07f 100644 --- a/org/testdata/example.org +++ b/org/testdata/example.org @@ -77,6 +77,8 @@ with multiple lines #+BEGIN_QUOTE Mongodb is very webscale + +and quote blocks can contain multiple paragraphs #+END_QUOTE ** issues from goorgeous (free test cases, yay!)