Commit 03257d7
authored
Fix internal links (#19)
* Add failing test for internal links
As reported in
#18, I
ran into this with links to footnotes when using ox-html-stable-ids.
This patch adds a failing test which hopefully outlines a way to
resolve this issue. Currently, the id and hrefs remain empty, so
they're removed, resulting in broken links.
Instead, it'd be great if we could use the reference we use in the
link as the anchor. However, other options would also be acceptible,
as long as it fixes the link issue and produces stable IDs.
* Fall back to :value when no :raw-value exists
The test case for internal links passes if
org-html-stable-ids--extract-id falls back to using the element's
:value property when it has no :raw-value property.
This breaks a different test, though, which relies on the return value
being nil if :raw-value doesn't return anything. It might make sense
to only fall back to :value when the :raw-value key doesn't exist at
all.
* Only use :value when it's not deferred
Falling back to the :value property works for inline elements where
the :value is string based, like links. For block-level elements like
example blocks, which have nested elements, those elements get
automatically serialized to a string by org-element-property.
The :value fallback should only work for inline elements, so this
patch switches to using org-element-property-raw, which doesn't
serialize the "deferred" elements. To make sure that doesn't happen,
the new org-html-stable-ids--extract-value function only returns
non-deferred :value properties.
* Manually detangle changes to Org document
* Update description of ID creation, explain extracting values1 parent 8983da1 commit 03257d7
File tree
4 files changed
+30
-5
lines changed- test/fixtures
4 files changed
+30
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
36 | 42 | | |
37 | 43 | | |
38 | 44 | | |
| |||
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
44 | | - | |
| 50 | + | |
45 | 51 | | |
46 | 52 | | |
47 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
79 | 85 | | |
80 | 86 | | |
81 | 87 | | |
| |||
84 | 90 | | |
85 | 91 | | |
86 | 92 | | |
87 | | - | |
| 93 | + | |
88 | 94 | | |
89 | 95 | | |
90 | 96 | | |
91 | 97 | | |
92 | | - | |
93 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
94 | 101 | | |
95 | 102 | | |
96 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
0 commit comments