Selaa lähdekoodia

Use John Gruber's regular expression for URL's

http://daringfireball.net/2009/11/liberal_regex_for_matching_urls
Carsten Dominik 15 vuotta sitten
vanhempi
commit
facedba057
3 muutettua tiedostoa jossa 9 lisäystä ja 1 poistoa
  1. 5 0
      lisp/ChangeLog
  2. 2 0
      lisp/org-macs.el
  3. 2 1
      lisp/org.el

+ 5 - 0
lisp/ChangeLog

@@ -1,5 +1,10 @@
 2009-12-09  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org.el (org-make-link-regexps): Use John Gruber's regexp for
+	urls.
+
+	* org-macs.el (org-re): Interpret :punct: in regexps.
+
 	* org-exp.el (org-export-replace-src-segments-and-examples): Also
 	take the final newline after the END line.
 

+ 2 - 0
lisp/org-macs.el

@@ -63,6 +63,8 @@ Also, do not record undo information."
 	    (setq ss (replace-match "a-zA-Z0-9" t t ss)))
 	  (while (string-match "\\[:alpha:\\]" ss)
 	    (setq ss (replace-match "a-zA-Z" t t ss)))
+	  (while (string-match "\\[:punct:\\]" ss)
+	    (setq ss (replace-match "\001-@[-`{-~" t t ss)))
 	  ss))
     s))
 

+ 2 - 1
lisp/org.el

@@ -4384,7 +4384,8 @@ This should be called after the variable `org-link-types' has changed."
 	org-plain-link-re
 	(concat
 	 "\\<\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
-	 "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)")
+	 (org-re "[^ \t\n()<>]+\\(?:([[:word:]0-9]+)\\|\\([^[:punct:] \t\n]\\|/\\)\\)"))
+	;;	 "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)")
 	org-bracket-link-regexp
 	"\\[\\[\\([^][]+\\)\\]\\(\\[\\([^][]+\\)\\]\\)?\\]"
 	org-bracket-link-analytic-regexp