0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-07-17 06:36:27 +00:00

Fix plain link export

This commit is contained in:
Carsten Dominik 2009-08-24 11:13:00 +02:00
parent 0db9bf496c
commit 0b0460703a
2 changed files with 20 additions and 4 deletions

View file

@ -1,5 +1,9 @@
2009-08-24 Carsten Dominik <carsten.dominik@gmail.com>
* org-exp.el (org-export-protect-sub-super): New function.
(org-export-normalize-links): Protect the url of plain links from
supscript and superscript processing.
* org-remember.el (org-remember-escaped-%): New function.
(org-remember-apply-template): Use `org-remember-escaped-%' to
detect escaped % signs.

View file

@ -1846,6 +1846,12 @@ When it is nil, all comments will be removed."
(point-at-eol))
(end-of-line 1))))
(defun org-export-protect-sub-super (s)
(save-match-data
(while (string-match "\\([^\\\\]\\)\\([_^]\\)" s)
(setq s (replace-match "\\1\\\\\\2" nil nil s)))
s))
(defun org-export-normalize-links ()
"Convert all links to bracket links, and expand link abbreviations."
(let ((re-plain-link (concat "\\([^[<]\\)" org-plain-link-re))
@ -1855,8 +1861,11 @@ When it is nil, all comments will be removed."
(while (re-search-forward re-plain-link nil t)
(goto-char (1- (match-end 0)))
(org-if-unprotected-at (1+ (match-beginning 0))
(let* ((s (concat (match-string 1) "[[" (match-string 2)
":" (match-string 3) "]]")))
(let* ((s (concat (match-string 1)
"[[" (match-string 2) ":" (match-string 3)
"][" (match-string 2) ":" (org-export-protect-sub-super
(match-string 3))
"]]")))
;; added 'org-link face to links
(put-text-property 0 (length s) 'face 'org-link s)
(replace-match s t t))))
@ -1864,8 +1873,11 @@ When it is nil, all comments will be removed."
(while (re-search-forward re-angle-link nil t)
(goto-char (1- (match-end 0)))
(org-if-unprotected
(let* ((s (concat (match-string 1) "[[" (match-string 2)
":" (match-string 3) "]]")))
(let* ((s (concat (match-string 1)
"[[" (match-string 2) ":" (match-string 3)
"][" (match-string 2) ":" (org-export-protect-sub-super
)(match-string 3)
"]]")))
(put-text-property 0 (length s) 'face 'org-link s)
(replace-match s t t))))
(goto-char (point-min))