[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/adoc-mode b79c243241 059/199: adoc-re-anchor can now match
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/adoc-mode b79c243241 059/199: adoc-re-anchor can now match a given id |
Date: |
Sun, 3 Sep 2023 06:59:34 -0400 (EDT) |
branch: elpa/adoc-mode
commit b79c243241b6b2ccfa452a14bde946b9c977c96e
Author: Florian Kaufmann <sensorflo@gmail.com>
Commit: Florian Kaufmann <sensorflo@gmail.com>
adoc-re-anchor can now match a given id
---
adoc-mode.el | 49 +++++++++++++++++++++++++++++++++++++++----------
1 file changed, 39 insertions(+), 10 deletions(-)
diff --git a/adoc-mode.el b/adoc-mode.el
index e9f5911495..ff2841cf34 100644
--- a/adoc-mode.el
+++ b/adoc-mode.el
@@ -670,13 +670,34 @@ Subgroups:
3 attribute list, exclusive brackets []"
(concat "^\\(" (or cmd-name "[a-zA-Z0-9_]+") "\\)::\\([^
\t\n]*?\\)\\[\\(.*?\\)\\][ \t]*$"))
-;; with attriblists:
-;; inline macro special syntax: [\\]?\[\[(?P<attrlist>[\w"_:].*?)\]\]
-;; inline macro biblio special syntax:
[\\]?\[\[\[(?P<attrlist>[\w_:][\w_:.-]*?)\]\]\]
-;; id/reftext given by special syntax
-;; block id: ^\[\[(?P<id>[\w\-_]+)(,(?P<reftext>.*?))?\]\]$
-;; mixed:
-;; inline macro default syntax: see adoc-re-inline-macro. the target is the
id, the 1st pos arg is the xreflabel
+(defun adoc-re-anchor (type &optional id)
+ "Returns a regexp matching an anchor.
+
+If ID is non-nil, the regexp matches an anchor defining exactly
+this id. If ID is nil, the regexp matches any anchor."
+ (cond
+ ((eq type 'block-id)
+ ;; ^\[\[(?P<id>[\w\-_]+)(,(?P<reftext>.*?))?\]\]$
+ (concat "^\\[\\["
+ "\\(" (or (regexp-quote id) "[-a-zA-Z0-9_]+") "\\)"
+ "\\(?:,?\\(.*?\\)\\)?"
+ "\\]\\][ \t]*$"))
+
+ ((eq type 'inline-special)
+ ;; [\\]?\[\[(?P<attrlist>[\w"_:].*?)\]\]
+ (concat "\\(\\[\\[\\)"
+ "\\(" (or (concat (regexp-quote id) "[ \t]*?")
"[a-zA-Z0-9\"_:].*?") "\\)"
+ "\\(\\]\\]\\)"))
+
+ ((eq type 'biblio)
+ ;; [\\]?\[\[\[(?P<attrlist>[\w_:][\w_:.-]*?)\]\]\]
+ (concat "\\(\\[\\[\\)"
+ "\\(\\[" (or (regexp-quote id) "[a-zA-Z0-9_:][a-zA-Z0-9_:.-]*?")
"\\]\\)"
+ "\\(\\]\\]\\)"))
+
+ ((eq type 'inline-general)
+ (adoc-re-inline-macro "anchor" id))))
+
(defun adoc-re-anchor(type)
"Returns a regexp matching an anchor."
(cond
@@ -795,9 +816,13 @@ subgroups:
;;
(?<!\w)[\\]?(?P<name>http|https|ftp|file|irc|mailto|callto|image|link|anchor|xref|indexterm):(?P<target>\S*?)\[(?P<attrlist>.*?)\]
;; # Default (catchall) inline macro is not implemented
;; # [\\]?(?P<name>\w(\w|-)*?):(?P<target>\S*?)\[(?P<passtext>.*?)(?<!\\)\]
-(defun adoc-re-inline-macro (&optional cmd-name)
+(defun adoc-re-inline-macro (&optional cmd-name target)
"Returns regex matching an inline macro.
-Subgroups:
+
+Id CMD-NAME is nil, any command is matched. If TARGET is nil, any
+target is matched.
+
+Subgroups of returned regexp:
1 cmd name
2 :
3 target
@@ -805,7 +830,11 @@ Subgroups:
5 attribute list, exclusive brackets []
6 ]"
;; !!! \< is not exactly what AsciiDoc does, see regex above
- (concat "\\<\\(" (or cmd-name "\\w+") "\\)\\(:\\)\\([^
\t\n].*\\)\\(\\[\\)\\(.*?\\)\\(\\]\\)" ))
+ (concat
+ "\\(\\<" (or (regexp-quote cmd-name) "\\w+") "\\)"
+ "\\(:\\)"
+ "\\(" (or (regexp-quote target) "[^ \t\n]*?") "\\)"
+ "\\(\\[\\)\\(.*?\\)\\(\\]\\)" ))
;; todo: use same regexps as for font lock
(defun adoc-re-paragraph-separate ()
- [nongnu] elpa/adoc-mode 8349f0e05e 032/199: added better support for attribute lists, no tests written yet, (continued)
- [nongnu] elpa/adoc-mode 8349f0e05e 032/199: added better support for attribute lists, no tests written yet, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode c8b39080f8 025/199: added that inline subst can't match across block boundaries, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 3ba0822b91 028/199: bugfix: quotes shall not cross labeled list item boundaries, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 2da645a750 040/199: attribute-list can have a local face alist / two faces for target of an inline macro can be specified, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 69e44f37ac 049/199: changed default of adoc-insert-replacement to nil, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode a16699bffe 050/199: test: adapted to new ert, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 6b84d70fe0 051/199: test: reworked adoctest-faces, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode a88d4ea5d5 052/199: bugfix: some regexps did not handle end of buffer correctly, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode f1477f70cc 057/199: comment changes, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 601de95b01 062/199: modified regexp for xref for better find, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode b79c243241 059/199: adoc-re-anchor can now match a given id,
ELPA Syncer <=
- [nongnu] elpa/adoc-mode 9753b42821 065/199: bumped version to V0.5.0, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 3501940311 073/199: test: running the test is a bit more smoothly, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 734527e2d4 077/199: added link to markup-faces within customization group, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 569eff13b1 078/199: added lots of templates & easy-menu-entries, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 16fe6044b7 081/199: bumped version to 0.6.0, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 091f46e866 061/199: test: added test for goto-ref-label, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 2322c32185 076/199: extracted make-two-line-title-underline from make-two-line-title, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode efa9ef97a0 080/199: list item tempos respect tab-width and indent-tabs-mode, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 9c395f4bf9 093/199: it's now less likely that text between two adjacent delimited blocks is misinterpreted as delimited block, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 06f9792fcd 011/199: added further simple tests for constrained/uncronstrained quotes, ELPA Syncer, 2023/09/03