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

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

[elpa] externals/denote 79fbe2493b 135/355: Merge pull request #11 from


From: ELPA Syncer
Subject: [elpa] externals/denote 79fbe2493b 135/355: Merge pull request #11 from kaushalmodi/update-identifier-regexp
Date: Sun, 26 Jun 2022 23:58:14 -0400 (EDT)

branch: externals/denote
commit 79fbe2493b6a318cfdb1f5dd8597d760ec713498
Merge: e394057985 c9926a528e
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #11 from kaushalmodi/update-identifier-regexp
    
    Identifier regexp improvements (support TOML and Org ID)
---
 denote-link.el | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/denote-link.el b/denote-link.el
index 2d3d95fc69..75eb13f68d 100644
--- a/denote-link.el
+++ b/denote-link.el
@@ -94,14 +94,20 @@ files."
 (defun denote-link--find-value (regexp)
   "Return value from REGEXP by searching the file."
   (goto-char (point-min))
-  (re-search-forward regexp)
-  (match-string-no-properties 3))
+  (re-search-forward regexp nil nil 1) ;Stop search after the first match
+  (match-string-no-properties 1))
 
-(defconst denote-link--title-regexp "^\\(#\\+\\)?\\(title:\\)[\s\t]+\\(.*\\)"
-  "Regular expression for title key and value.")
+(defconst denote-link--title-regexp 
"^\\(?:#\\+\\)?\\(?:title:\\)[\s\t]+\\(?1:.*\\)"
+  "Regular expression for title key and value.
 
-(defconst denote-link--identifier-regexp 
"^\\(#\\+\\)?\\(identifier:\\)[\s\t]+\\(.*\\)"
-  "Regular expression for filename key and value.")
+The match that needs to be extracted is explicityly marked as
+group 1.  `denote-link--find-value' uses the group 1 sting.")
+
+(defconst denote-link--identifier-regexp 
"^.?.?\\b\\(?:identifier\\|ID\\)\\s-*[:=]\\s-*\"?\\(?1:[0-9T]+\\)"
+  "Regular expression for filename key and value.
+
+The match that needs to be extracted is explicityly marked as
+group 1.  `denote-link--find-value' uses the group 1 sting.")
 
 (defconst denote-link--link-format-org "[[file:%s][%s (%s)]]"
   "Format of Org link to note.")



reply via email to

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