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

@ -3,9 +3,6 @@ A basic Org mode parser in go.
Take a look at [[https://niklasfasching.github.io/go-org/][github pages]] for some examples and an online org -> html demo (requires wasm support).
* next
- test against [[https://raw.githubusercontent.com/kaushalmodi/ox-hugo/master/test/site/content-org/all-posts.org][ox-hugo all-posts.org]]
- fix attr_html splitting - not whitespace, :x keywords, e.g.
#+attr_html: :caption A unicorn! :style width: 100%; height: 100%; :caption foo
[[/images/org-mode-unicorn-logo.png]]
- more keywords: https://orgmode.org/manual/In_002dbuffer-settings.html
- headlines
- unique ids