Browse Source

HTML export: Protect explicit target links

If a link is [[#name][desc]], the href wil be exacty href="#name".
So starting a link target with # will indicate that there will be an
explicit target for this.
Carsten Dominik 16 years ago
parent
commit
80ec053008
2 changed files with 10 additions and 1 deletions
  1. 5 0
      lisp/ChangeLog
  2. 5 1
      lisp/org-exp.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2009-03-12  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-exp.el (org-export-target-internal-links)
+	(org-export-as-html): Protect links specified as #name.
+
 2009-03-11  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org.el (org-clone-subtree-with-time-shift): New command.

+ 5 - 1
lisp/org-exp.el

@@ -1794,6 +1794,9 @@ the current file."
 	    found props pos cref
 	    (target
 	     (cond
+	      ((= (string-to-char link) ?#)
+	       ;; user wants exactly this link
+	       link)
 	      ((cdr (assoc slink target-alist)))
 	      ((and (string-match "^id:" link)
 		    (cdr (assoc (substring link 3) target-alist))))
@@ -3789,7 +3792,8 @@ lang=\"%s\" xml:lang=\"%s\">
 	     ((equal type "internal")
 	      (setq rpl
 		    (concat
-		     "<a href=\"#"
+		     "<a href=\""
+		     (if (= (string-to-char path) ?#) "" "#")
 		     (org-solidify-link-text
 		      (save-match-data (org-link-unescape path)) nil)
 		     "\"" attr ">"