| Submitter | Olaf Dietsche |
|---|---|
| Date | 2011-09-13 10:05:40 |
| Message ID | <87hb4geozv.fsf@rat.lan> |
| Download | mbox | patch |
| Permalink | /patch/944/ |
| State | Under Review |
| Delegated to: | David Maus |
| Headers | show |
Comments
2011/9/13 Olaf Dietsche <olaf+list.orgmode@olafdietsche.de>: > You might try this *untested* patch. It is against git master. :D Thanks!!! > How did you create ID properties for all entries? Have you exported your > org-files to icalendar? Most of them have ID properties because I often link them internally. When I create the link with C-c l, org adds the id. For those that do not have ID, I'll create them manually with org-id-get-create. With a keyboard macro this will be fast. > And please, don't forget to backup your files! Of course! Fortunately I version control my ~/org folder with Bazaar. With this patch, what happens if there is no id in a heading, does it create it automatically? At work I'm using stable versions of Org-mode. This weekend I'll try the git version at home and test your patch. Thanks
Pere Quintana Seguí <pquintana@obsebre.es> writes: > 2011/9/13 Olaf Dietsche <olaf+list.orgmode@olafdietsche.de>: >> How did you create ID properties for all entries? Have you exported your >> org-files to icalendar? > > Most of them have ID properties because I often link them internally. > When I create the link with C-c l, org adds the id. > > For those that do not have ID, I'll create them manually with > org-id-get-create. With a keyboard macro this will be fast. Ok, thanks for this explanation. > With this patch, what happens if there is no id in a heading, does it > create it automatically? It is supposed to use the CUSTOM_ID, if set. Next, it tries the ID property. At last, it falls back to "sec-...". > At work I'm using stable versions of Org-mode. This weekend I'll try > the git version at home and test your patch. Regards, Olaf
2011/9/15 Olaf Dietsche <olaf+list.orgmode@olafdietsche.de>: >> With this patch, what happens if there is no id in a heading, does it >> create it automatically? > > It is supposed to use the CUSTOM_ID, if set. Next, it tries the ID > property. At last, it falls back to "sec-...". Ok, perfect. Thanks.
Patch
diff --git a/lisp/org-html.el b/lisp/org-html.el index fde563b..806bbb9 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1438,8 +1438,9 @@ lang=\"%s\" xml:lang=\"%s\"> (replace-regexp-in-string "\\." "-" (format "sec-%s" snumber))) (setq href (org-solidify-link-text - (or (cdr (assoc href - org-export-preferred-target-alist)) href))) + (or (cdr (assoc href org-export-preferred-target-alist)) + (cdr (assoc href org-export-id-target-alist)) + href))) (push (format (if todo @@ -2413,7 +2414,8 @@ When TITLE is nil, just close all open levels." (assoc target org-export-target-aliases))) (extra-class (and title (org-get-text-property-any 0 'html-container-class title))) (preferred (and target - (cdr (assoc target org-export-preferred-target-alist)))) + (or (cdr (assoc target org-export-preferred-target-alist)) + (cdr (assoc target org-export-id-target-alist))))) (l org-level-max) (num (plist-get opt-plist :section-numbers)) snumber snu href suffix)