html: Do not render non-html export blocks

This commit is contained in:
Niklas Fasching 2020-03-31 16:28:56 +02:00
parent c68d931100
commit 6ed46ba95d
3 changed files with 14 additions and 2 deletions

View file

@ -124,8 +124,10 @@ func (w *HTMLWriter) WriteBlock(b Block) {
w.WriteString(fmt.Sprintf("<div class=\"src src-%s\">\n%s\n</div>\n", lang, content)) w.WriteString(fmt.Sprintf("<div class=\"src src-%s\">\n%s\n</div>\n", lang, content))
case name == "EXAMPLE": case name == "EXAMPLE":
w.WriteString(`<pre class="example">` + "\n" + html.EscapeString(content) + "\n</pre>\n") w.WriteString(`<pre class="example">` + "\n" + html.EscapeString(content) + "\n</pre>\n")
case name == "EXPORT" && len(b.Parameters) >= 1 && strings.ToLower(b.Parameters[0]) == "html": case name == "EXPORT":
if len(b.Parameters) >= 1 && strings.ToLower(b.Parameters[0]) == "html" {
w.WriteString(content + "\n") w.WriteString(content + "\n")
}
case name == "QUOTE": case name == "QUOTE":
w.WriteString("<blockquote>\n" + content + "</blockquote>\n") w.WriteString("<blockquote>\n" + content + "</blockquote>\n")
case name == "CENTER": case name == "CENTER":

View file

@ -57,6 +57,11 @@ console.log("Hello World!")
</script> </script>
#+END_EXPORT #+END_EXPORT
#+BEGIN_EXPORT something-other-than-html
I won't be rendered as html
#+END_EXPORT
- list item 1 - list item 1
blocks can contain unindented lines that would normally end a list item blocks can contain unindented lines that would normally end a list item
#+BEGIN_EXAMPLE #+BEGIN_EXAMPLE

View file

@ -57,6 +57,11 @@ console.log("Hello World!")
</script> </script>
#+END_EXPORT #+END_EXPORT
#+BEGIN_EXPORT something-other-than-html
I won't be rendered as html
#+END_EXPORT
- list item 1 - list item 1
blocks can contain unindented lines that would normally end a list item blocks can contain unindented lines that would normally end a list item
#+BEGIN_EXAMPLE #+BEGIN_EXAMPLE