Add support for #+HTML
This commit is contained in:
parent
0a905ca172
commit
ffe06b50f2
4 changed files with 31 additions and 3 deletions
|
@ -7,10 +7,8 @@ A basic org-mode parser in go
|
|||
*** TODO [[https://github.com/chaseadamsio/goorgeous/issues/46][#46]]: Support for symbols like ndash and mdash
|
||||
- see org-entities replacement: see org-entities-help
|
||||
*** TODO [[https://github.com/chaseadamsio/goorgeous/issues/10][#10]]: Support noexport
|
||||
*** TODO [[https://github.com/chaseadamsio/goorgeous/issues/19][#19]]: Support #+HTML
|
||||
*** TODO [[https://github.com/chaseadamsio/goorgeous/issues/31][#31]]: Support #+INCLUDE
|
||||
- see https://orgmode.org/manual/Include-files.html
|
||||
*** TODO [[https://github.com/chaseadamsio/goorgeous/issues/33][#33]]: Wrong output when mixing html with org-mode
|
||||
* later
|
||||
- hugo frontmatter - see https://gohugo.io/content-management/front-matter/ -> actually seems to be handled by hugo itself
|
||||
- handle #+RESULTS: raw and stuff
|
||||
|
|
10
org/html.go
10
org/html.go
|
@ -63,7 +63,9 @@ func (w *HTMLWriter) after(d *Document) {
|
|||
func (w *HTMLWriter) writeNodes(ns ...Node) {
|
||||
for _, n := range ns {
|
||||
switch n := n.(type) {
|
||||
case Keyword, Comment:
|
||||
case Keyword:
|
||||
w.writeKeyword(n)
|
||||
case Comment:
|
||||
continue
|
||||
case NodeWithMeta:
|
||||
w.writeNodeWithMeta(n)
|
||||
|
@ -142,6 +144,12 @@ func (w *HTMLWriter) writeBlock(b Block) {
|
|||
}
|
||||
}
|
||||
|
||||
func (w *HTMLWriter) writeKeyword(k Keyword) {
|
||||
if k.Key == "HTML" {
|
||||
w.WriteString(k.Value + "\n")
|
||||
}
|
||||
}
|
||||
|
||||
func (w *HTMLWriter) writeFootnoteDefinition(f FootnoteDefinition) {
|
||||
n := f.Name
|
||||
w.WriteString(`<div class="footnote-definition">` + "\n")
|
||||
|
|
15
org/testdata/misc.html
vendored
15
org/testdata/misc.html
vendored
|
@ -1,4 +1,6 @@
|
|||
<h2>issues from goorgeous (free test cases, yay!)</h2>
|
||||
<h3><a href="https://github.com/chaseadamsio/goorgeous/issues/19">#19</a>: Support #+HTML</h3>
|
||||
<p style="border: 1px dotted grey">neato!</p>
|
||||
<h3><a href="https://github.com/chaseadamsio/goorgeous/issues/29">#29:</a> Support verse block</h3>
|
||||
<div class="verse-block">
|
||||
<p>
|
||||
|
@ -13,6 +15,19 @@ or even a <strong>totally</strong> <em>custom</em> kind of block
|
|||
crazy ain't it?
|
||||
</p>
|
||||
</div>
|
||||
<h3><a href="https://github.com/chaseadamsio/goorgeous/issues/33">#33</a>: Wrong output when mixing html with org-mode</h3>
|
||||
<div class="outline-2" id="meta" style="color: green;">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><strong>foo</strong></td><td>foo</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>bar</strong></td><td>bar</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<h3><a href="https://github.com/chaseadamsio/goorgeous/issues/47">#47:</a> Consecutive <code>code</code> wrapped text gets joined</h3>
|
||||
<p>
|
||||
either <code>this</code> or <code>that</code> foo.
|
||||
|
|
7
org/testdata/misc.org
vendored
7
org/testdata/misc.org
vendored
|
@ -1,4 +1,6 @@
|
|||
** 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>
|
||||
*** DONE [[https://github.com/chaseadamsio/goorgeous/issues/29][#29:]] Support verse block
|
||||
#+BEGIN_VERSE
|
||||
This
|
||||
|
@ -10,6 +12,11 @@ verse
|
|||
or even a *totally* /custom/ kind of block
|
||||
crazy ain't it?
|
||||
#+END_CUSTOM
|
||||
*** DONE [[https://github.com/chaseadamsio/goorgeous/issues/33][#33]]: Wrong output when mixing html with org-mode
|
||||
#+HTML: <div class="outline-2" id="meta" style="color: green;">
|
||||
| *foo* | foo |
|
||||
| *bar* | bar |
|
||||
#+HTML: </div>
|
||||
*** DONE [[https://github.com/chaseadamsio/goorgeous/issues/47][#47:]] Consecutive ~code~ wrapped text gets joined
|
||||
either ~this~ or ~that~ foo.
|
||||
either ~this~
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue