diff --git a/org/block.go b/org/block.go index 667fb6b..9668f3b 100644 --- a/org/block.go +++ b/org/block.go @@ -24,7 +24,7 @@ func lexBlock(line string) (token, bool) { return nilToken, false } -func isRawTextBlock(name string) bool { return name == "SRC" || name == "EXAMPLE" } +func isRawTextBlock(name string) bool { return name == "SRC" || name == "EXAMPLE" || name == "EXPORT" } func (d *Document) parseBlock(i int, parentStop stopFn) (int, Node) { t, start, lines := d.tokens[i], i, []string{} diff --git a/org/html.go b/org/html.go index 20b80f5..c64ee21 100644 --- a/org/html.go +++ b/org/html.go @@ -107,22 +107,24 @@ func (w *HTMLWriter) writeNodes(ns ...Node) { } func (w *HTMLWriter) writeBlock(b Block) { - switch b.Name { - case "SRC": + switch name := b.Name; { + case name == "SRC": source, lang := b.Children[0].(Text).Content, "text" if len(b.Parameters) >= 1 { - lang = b.Parameters[0] + lang = strings.ToLower(b.Parameters[0]) } w.WriteString(w.HighlightCodeBlock(source, lang) + "\n") - case "EXAMPLE": + case name == "EXAMPLE": w.WriteString(`
` + "\n")
 		w.writeNodes(b.Children...)
 		w.WriteString("\n
\n") - case "QUOTE": + case name == "EXPORT" && len(b.Parameters) >= 1 && strings.ToLower(b.Parameters[0]) == "html": + w.WriteString(b.Children[0].(Text).Content + "\n") + case name == "QUOTE": w.WriteString("
\n") w.writeNodes(b.Children...) w.WriteString("
\n") - case "CENTER": + case name == "CENTER": w.WriteString(`
` + "\n") w.writeNodes(b.Children...) w.WriteString("
\n") diff --git a/org/testdata/blocks.html b/org/testdata/blocks.html index c6bc188..7b31dba 100644 --- a/org/testdata/blocks.html +++ b/org/testdata/blocks.html @@ -19,3 +19,6 @@ Mongodb is very webscale and quote blocks can contain multiple paragraphs

+ diff --git a/org/testdata/blocks.org b/org/testdata/blocks.org index 320fca2..309ebda 100644 --- a/org/testdata/blocks.org +++ b/org/testdata/blocks.org @@ -19,3 +19,9 @@ Mongodb is very webscale and quote blocks can contain multiple paragraphs #+END_QUOTE + +#+BEGIN_EXPORT html + +#+END_EXPORT