HTML Export: Make IDs valid
uuidgen ids may start with a number and therefore are not valid names in HTML. Therefore we now use and "ID-" prefix for such IDs when exporting to HTML.
This commit is contained in:
parent
b719ac011d
commit
d8e4a35974
|
@ -26,6 +26,15 @@ with the =C-c a m= key for the corresponding agenda view.
|
|||
=C-c / T= will still work for now, but it is no longer advertised
|
||||
in the documentation and may go away at any time in the future.
|
||||
|
||||
*** IDs in HTML have "ID-" prefix when generated by uuidgen
|
||||
|
||||
=uuidgen= generates IDs that often start with a number, not a
|
||||
latter. However, IDs and names in XHTML must start with a letter.
|
||||
Therefore, IDs in HTML files will now get an "ID-" prefix if they
|
||||
have been generated by uuidgen. This means that id links from one
|
||||
file to another may stop working until all files have been
|
||||
exported again.
|
||||
|
||||
** Details
|
||||
|
||||
*** PDF export of agenda views
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
2009-03-03 Carsten Dominik <carsten.dominik@gmail.com>
|
||||
|
||||
* org-exp.el (org-export-as-html): Use IDs in the correct way.
|
||||
|
||||
* org.el (org-uuidgen-p): New funtion.
|
||||
|
||||
* org-agenda.el (org-agenda-fontify-priorities): New default value
|
||||
`cookies'.
|
||||
(org-agenda-fontify-priorities): Renamed from
|
||||
|
|
|
@ -3745,7 +3745,9 @@ lang=\"%s\" xml:lang=\"%s\">
|
|||
id-file (file-name-directory org-current-export-file)))
|
||||
(setq id-file (concat (file-name-sans-extension id-file)
|
||||
"." html-extension))
|
||||
(setq rpl (concat "<a href=\"" id-file "#" path "\""
|
||||
(setq rpl (concat "<a href=\"" id-file "#"
|
||||
(if (org-uuidgen-p path) "ID-")
|
||||
path "\""
|
||||
attr ">"
|
||||
(org-export-html-format-desc desc)
|
||||
"</a>")))
|
||||
|
@ -4738,6 +4740,7 @@ When TITLE is nil, just close all open levels."
|
|||
(let* ((target (and title (org-get-text-property-any 0 'target title)))
|
||||
(extra-targets
|
||||
(mapconcat (lambda (x)
|
||||
(if (org-uuidgen-p x) (setq x (concat "ID-" x)))
|
||||
(format "<a name=\"%s\" id=\"%s\"></a>"
|
||||
x x))
|
||||
(cdr (assoc target org-export-target-aliases))
|
||||
|
|
|
@ -14644,6 +14644,10 @@ and end of string."
|
|||
list)))
|
||||
(nreverse list)))
|
||||
|
||||
(defun org-uuidgen-p (s)
|
||||
"Is S an ID created by UUIDGEN?"
|
||||
(string-match "\\`[0-9a-f]\\{8\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{12\\}\\'" (downcase s)))
|
||||
|
||||
(defun org-context ()
|
||||
"Return a list of contexts of the current cursor position.
|
||||
If several contexts apply, all are returned.
|
||||
|
|
Loading…
Reference in New Issue