Created
July 13, 2021 11:42
-
-
Save jethrokuan/d6f80caaec7f49dedffac7c4fe41d132 to your computer and use it in GitHub Desktop.
Patching Ox-html to support ID export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun org-html--reference (datum info &optional named-only) | |
"Return an appropriate reference for DATUM. | |
DATUM is an element or a `target' type object. INFO is the | |
current export state, as a plist. | |
When NAMED-ONLY is non-nil and DATUM has no NAME keyword, return | |
nil. This doesn't apply to headlines, inline tasks, radio | |
targets and targets." | |
(let* ((type (org-element-type datum)) | |
(user-label | |
(org-element-property | |
(pcase type | |
((or `headline `inlinetask) :CUSTOM_ID) | |
((or `radio-target `target) :value) | |
(_ :name)) | |
datum)) | |
(user-label (or user-label | |
(when-let ((path (org-element-property :ID datum))) | |
(concat "ID-" path))))) | |
(cond | |
((and user-label | |
(or (plist-get info :html-prefer-user-labels) | |
;; Used CUSTOM_ID property unconditionally. | |
(memq type '(headline inlinetask)))) | |
user-label) | |
((and named-only | |
(not (memq type '(headline inlinetask radio-target target))) | |
(not user-label)) | |
nil) | |
(t | |
(org-export-get-reference datum info))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this does not work.