html: Improve link abbreviation (#+LINK) resolution
Handle `%s`/`%h` interpolation and add support for shorthand of prefix only links / links with empty tag (i.e. `[example]` instead of [example:]). See [1] and [2]. As so often we don't match org mode output completely but our output looks sane enough to me so let's move along for now. [1] https://orgmode.org/manual/Link-Abbreviations.html [2] https://github.com/bzg/org-mode/blob/main/lisp/ol.el#L1011
This commit is contained in:
parent
34dfe32024
commit
9995b3cdad
5 changed files with 37 additions and 5 deletions
10
org/testdata/inline.pretty_org
vendored
10
org/testdata/inline.pretty_org
vendored
|
@ -39,7 +39,15 @@
|
|||
- <2019-01-06 Sun 18:00 +1w>
|
||||
- <2019-01-06 Sun 18:00>
|
||||
- <2019-01-06 Sun 18:00 +1w>
|
||||
- =#+LINK= based links: [[example:foobar]]
|
||||
- =#+LINK= based links:
|
||||
#+LINK: example https://www.example.com/
|
||||
#+LINK: example_interpolate_s https://www.example.com?raw_tag=%s
|
||||
#+LINK: example_interpolate_h https://www.example.com?encoded_tag=%h
|
||||
- [[example:foobar]]
|
||||
- [[example:]]
|
||||
- [[example]]
|
||||
- [[example][description]]
|
||||
- [[example_interpolate_s:tag value with specical chars % : &]] (w/o tag [[example_interpolate_s]])
|
||||
- [[example_interpolate_h:tag value with specical chars % : &]] (w/o tag [[example_interpolate_h]])
|
||||
- =#+MACROs=: {{{headline(yolo)}}}
|
||||
#+MACRO: headline @@html:<h1>$1</h1>@@
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue