emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/textile-mode b52abc9ea3 10/19: Better link matching


From: ELPA Syncer
Subject: [nongnu] elpa/textile-mode b52abc9ea3 10/19: Better link matching
Date: Sat, 29 Jan 2022 08:29:35 -0500 (EST)

branch: elpa/textile-mode
commit b52abc9ea316dded669105f643ee347b8ff8f5b1
Author: Matus Goljer <dota.keys@gmail.com>
Commit: Matus Goljer <dota.keys@gmail.com>

    Better link matching
---
 textile-mode.el | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/textile-mode.el b/textile-mode.el
index c820c9ba43..755f772dec 100644
--- a/textile-mode.el
+++ b/textile-mode.el
@@ -135,12 +135,14 @@ non-matching parentheses"
 (defun textile-link-matcher ()
   "Return the matcher regexp for a link"
   (concat
-   "\\(?:"
-   "\\(?:" "\".*?\"" "\\|" "\\[.*?\\]" "\\)?"
-   textile-url-regexp
-   "\\|"
-   "\".*?\":[^ \n\t]+"
-   "\\)"))
+   "\\(\".*?\"\\):"
+   "\\(?:" "\\(" textile-url-regexp "\\)" "\\|" "\\([^ \n\t]+\\)" "\\)"))
+
+(defun textile-link-alias-matcher ()
+  "Return the matcher regexp for a link ali"
+  (concat
+   "\\(\\[.*?\\]\\)"
+   "\\(" textile-url-regexp "\\)"))
 
 (defun textile-image-matcher ()
   "Return the matcher regexp for an image link"
@@ -218,7 +220,14 @@ non-matching parentheses"
        `(,(textile-table-matcher) 0 'textile-table-face t t)
 
        ;; links
-       `(,(textile-link-matcher) 0 'textile-link-face t t)
+       `(,(textile-link-matcher)
+         (1 'textile-link-face)
+         (2 'textile-url-face t t)
+         (3 'textile-lang-face t t))
+       `(,(textile-link-alias-matcher)
+         (1 'textile-lang-face)
+         (2 'textile-url-face))
+       `(,textile-url-regexp 0 'textile-link-face)
 
         ;; <pre> blocks
        '("<pre>\\(.\\|\n\\)*?</pre>\n?" 0 'textile-pre-face t t)
@@ -388,6 +397,11 @@ non-matching parentheses"
   "Face used to highlight links."
   :group 'textile-faces)
 
+(defface textile-url-face
+  '((t (:inherit textile-link-face)))
+  "Face used to highlight links."
+  :group 'textile-faces)
+
 (defface textile-image-face
   '((t (:foreground "pink")))
   "Face used to highlight image links."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]