Improve ATTR_HTML keyword parsing

Org mode separates kvs not as initially assumed by whitespace (~ csv) but
rather at keywords (~ :\w+).

This is still not replicating Org mode behaviour though as I decided against
attributes ignoring multi-definitions. Instead we stack their
values (and those existing on the element) for certain attributes (class, style
for now).

e.g.
[[foo]]

would become <foo class="a"> in Org mode but becomes <foo class="a b"> with
go-org.
This commit is contained in:
Niklas Fasching 2018-12-18 00:16:41 +01:00
parent 0e64f9df7f
commit dce67eaddf
7 changed files with 25 additions and 22 deletions

View file

@ -1,5 +1,5 @@
<figure>
<div class="highlight a b c" id="it">
<div class="highlight a b c d" id="it">
<pre>echo &#34;a bash source block with custom html attributes&#34;
</pre>
</div>
@ -11,7 +11,7 @@ and <span style="text-decoration: underline;">multiple</span> lines of <strong>c
and an image with custom html attributes and a caption
</p>
<figure>
<img src="https://placekitten.com/200/200#.png" alt="https://placekitten.com/200/200#.png" title="https://placekitten.com/200/200#.png" style="border: 10px solid black"/>
<img src="https://placekitten.com/200/200#.png" alt="https://placekitten.com/200/200#.png" title="https://placekitten.com/200/200#.png" style="height: 100%; border: 10px solid black;" id="kittens"/>
<figcaption>
kittens!
</figcaption>

View file

@ -1,13 +1,14 @@
#+CAPTION: and _multiple_
#+CAPTION: lines of *captions*!
#+ATTR_HTML: :class "a b c"
#+ATTR_HTML: :id it
#+ATTR_HTML: :class a b
#+ATTR_HTML: :id it :class c d
#+BEGIN_SRC sh
echo "a bash source block with custom html attributes"
#+END_SRC
and an image with custom html attributes and a caption
#+CAPTION: kittens!
#+ATTR_HTML: :style "border: 10px solid black"
#+ATTR_HTML: :style height: 100%; :id overwritten
#+ATTR_HTML: :style border: 10px solid black; :id kittens
[[https://placekitten.com/200/200#.png]]

View file

@ -207,7 +207,7 @@ foo
<span class="todo">DONE</span>
<a href="https://github.com/chaseadamsio/goorgeous/issues/72">#72</a>: Support for #+ATTR_HTML
</h3>
<img src="https://golang.org/doc/gopher/pkg.png" alt="Go is fine though." title="https://golang.org/doc/gopher/pkg.png" width="300" style="border:2px solid black;"/>
<img src="https://golang.org/doc/gopher/pkg.png" alt="Go is fine though." title="https://golang.org/doc/gopher/pkg.png" id="gopher-image" width="300" style="border:2px solid black;"/>
<h3>
<span class="todo">DONE</span>
<a href="https://github.com/chaseadamsio/goorgeous/issues/75">#75</a>: Not parsing nested lists correctly

View file

@ -60,8 +60,8 @@ or ~that~ foo.
[[https://www.example.com][/this/ *is* _markup_!]]
#+END_QUOTE
*** DONE [[https://github.com/chaseadamsio/goorgeous/issues/72][#72]]: Support for #+ATTR_HTML
#+ATTR_HTML: :alt "Go is fine though."
#+ATTR_HTML: :width 300 :style "border:2px solid black;"
#+ATTR_HTML: :alt Go is fine though. :id gopher-image
#+ATTR_HTML: :width 300 :style border:2px solid black;
[[https://golang.org/doc/gopher/pkg.png]]
*** DONE [[https://github.com/chaseadamsio/goorgeous/issues/75][#75]]: Not parsing nested lists correctly
- bullet 1