html: Allow inline html export in #+TITLE

This commit is contained in:
Niklas Fasching 2020-04-16 15:18:33 +02:00
parent 4b56810a65
commit cbf1b8c38c
5 changed files with 11 additions and 5 deletions

View file

@ -93,6 +93,10 @@ func (w *HTMLWriter) Before(d *Document) {
w.document = d
w.log = d.Log
if title := d.Get("TITLE"); title != "" {
titleDocument := d.Parse(strings.NewReader(title), d.Path)
if titleDocument.Error == nil {
title = w.WriteNodesAsString(titleDocument.Nodes...)
}
w.WriteString(fmt.Sprintf(`<h1 class="title">%s</h1>`+"\n", title))
}
w.WriteOutline(d)
@ -140,7 +144,7 @@ func (w *HTMLWriter) WriteInlineBlock(b InlineBlock) {
w.WriteString(fmt.Sprintf("<div class=\"src src-inline src-%s\">\n%s\n</div>", lang, content))
case "export":
if strings.ToLower(b.Parameters[0]) == "html" {
w.WriteString(content + "\n")
w.WriteString(content)
}
}
}

View file

@ -51,7 +51,6 @@ inline source blocks like <div class="src src-inline src-html">
<li>
<p>
inline export blocks <h1>hello</h1>
</p>
</li>
<li>

View file

@ -1,4 +1,7 @@
<h1 class="title">Misc</h1>
<h1 class="title"><p>
Misc title <b>with an inline html export</b>
</p>
</h1>
<nav>
<ul>
<li><a href="#headline-1">issues from goorgeous (free test cases, yay!)</a>

View file

@ -1,4 +1,4 @@
#+TITLE: Misc
#+TITLE: Misc title @@html:<b>with an inline html export</b>@@
** issues from goorgeous (free test cases, yay!)
*** DONE [[https://github.com/chaseadamsio/goorgeous/issues/19][#19]]: Support #+HTML
#+HTML: <p style="border: 1px dotted grey">neato!</p>

View file

@ -1,4 +1,4 @@
#+TITLE: Misc
#+TITLE: Misc title @@html:<b>with an inline html export</b>@@
** issues from goorgeous (free test cases, yay!)
*** DONE [[https://github.com/chaseadamsio/goorgeous/issues/19][#19]]: Support #+HTML
#+HTML: <p style="border: 1px dotted grey">neato!</p>