[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/adoc-mode 1a4e93ec7c 035/199: enhanded general block macro
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/adoc-mode 1a4e93ec7c 035/199: enhanded general block macro incl. tests |
Date: |
Sun, 3 Sep 2023 06:59:27 -0400 (EDT) |
branch: elpa/adoc-mode
commit 1a4e93ec7c50e6ea4317ddc5febdb6f61c201184
Author: Florian Kaufmann <sensorflo@gmail.com>
Commit: Florian Kaufmann <sensorflo@gmail.com>
enhanded general block macro incl. tests
---
adoc-mode-test.el | 4 ++++
adoc-mode.el | 28 ++++++++++++++++++----------
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/adoc-mode-test.el b/adoc-mode-test.el
index c6f7678f35..4027b6c6ea 100644
--- a/adoc-mode-test.el
+++ b/adoc-mode-test.el
@@ -201,6 +201,10 @@
"[\"" markup-meta-face "lorem \\\"ipsum\\\" dolor" markup-value-face "\"]"
markup-meta-face "\n" nil
))
+(ert-deftest adoctest-test-block-macro ()
+ (adoctest-faces "block-macro"
+ "lorem" markup-command-face "::" markup-meta-face "ipsum[]"
markup-meta-face))
+
(ert-deftest adoctest-test-quotes-simple ()
(adoctest-faces "test-quotes-simple"
;; note that in unconstraned quotes cases " ipsum " has spaces around, in
diff --git a/adoc-mode.el b/adoc-mode.el
index 7e7d8640b2..92c2ff447b 100644
--- a/adoc-mode.el
+++ b/adoc-mode.el
@@ -605,6 +605,15 @@ Subgroups:
"\\|[^. \t\n]\\).*\\)"
"\\(\n\\)"))
+;; (?u)^(?P<name>image|unfloat)::(?P<target>\S*?)(\[(?P<attrlist>.*?)\])$
+(defun adoc-re-block-macro (&optional cmd-name)
+ "Returns a regexp matching an attribute list elment.
+Subgroups:
+1 cmd name
+2 target
+3 attribute list, exclusive brackets []"
+ (concat "^\\(" (or cmd-name "[a-zA-Z0-9_]+") "\\)::\\([^
\t\n]*?\\)\\[\\(.*?\\)\\][ \t]*$"))
+
(defun adoc-re-attribute-list-elt ()
"Returns a regexp matching an attribute list elment.
Subgroups:
@@ -1196,24 +1205,23 @@ When LITERAL-P is non-nil, the contained text is
literal text."
(list "^\\(//\\(?:[^/].*\\|\\)\n\\)"
'(1 '(face markup-comment-face adoc-reserved block-del)))
;; image
- ;; (?u)^(?P<name>image|unfloat)::(?P<target>\S*?)(\[(?P<attrlist>.*?)\])$
- (list "^\\(image\\)::\\([^ \t\n]*?\\)\\[\\(.*?\\)\\][ \t]*$"
+ (list `(lambda (end) (adoc-kwf-std end ,(adoc-re-block-macro "image") '(0)))
'(0 '(face markup-meta-face adoc-reserved block-del)) ; whole match
- '(1 markup-complex-replacement-face t) ; macro name
- '(2 markup-internal-reference-face t) ; file name
- '(3 '(face markup-meta-face
+ '(1 markup-complex-replacement-face t) ; 'image'
+ '(2 markup-internal-reference-face t) ; file name
+ '(3 '(face markup-meta-face ; attribute list
adoc-reserved nil
adoc-attribute-list (((0 "alt") markup-secondary-text-face)
("title" markup-secondary-text-face)))
- t)) ; attribute list
+ t))
;; passthrough:
(?u)^(?P<name>pass)::(?P<subslist>\S*?)(\[(?P<passtext>.*?)\])$
;; todo
;; -- general block macro
- ;; also highlight yet unknown block macros
- ;; general syntax:
(?u)^(?P<name>image|unfloat)::(?P<target>\S*?)(\[(?P<attrlist>.*?)\])$
- (list "^[a-zA-Z0-9_]+::\\([^ \t\n]*?\\)\\(\\[.*?\\]\\)[ \t]*$"
- 'adoc-delimiter)
+ (list `(lambda (end) (adoc-kwf-std end ,(adoc-re-block-macro) '(0)))
+ '(0 '(face markup-meta-face adoc-reserved block-del)) ; whole match
+ '(1 markup-command-face t) ; command name
+ '(3 '(face markup-meta-face adoc-reserved nil adoc-attribute-list t)
t)) ; attribute list
;; lists
;; ------------------------------
- [nongnu] elpa/adoc-mode bded623e3d 139/199: [Fix #8] Add a changelog, (continued)
- [nongnu] elpa/adoc-mode bded623e3d 139/199: [Fix #8] Add a changelog, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 00c59c8d95 145/199: [Fix #7] Convert readme to AsciiDoc (#10), ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 893daa395c 152/199: Move the syntax-table out of the mode definition, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 2c4847d843 160/199: Tweak a couple of docstrings, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode c3d738dd7d 169/199: Fix a typo, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 109bdc5d13 180/199: Fix a typo and some whitespace issues, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 9e7af55e7e 183/199: Fix a typo, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode b0702bdeb8 187/199: [Fix #33] Address noticeable lag when typing in larger code blocks (#35), ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 526e058665 029/199: added another list item test, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode a0ddf0f02d 034/199: added tests for images, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 1a4e93ec7c 035/199: enhanded general block macro incl. tests,
ELPA Syncer <=
- [nongnu] elpa/adoc-mode fcabdc3a7e 037/199: added general inline macro, began reworking anchors, touched image, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 656e7670c5 099/199: fixed type: denote -> demote, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 2cfd433622 030/199: extended quotes tests, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode a61e7cd749 063/199: added AsciiDoc menu & key map, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 22bd99a194 075/199: test: Use with-temp-buffer instead home-brewed solution, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode a3d77b0c15 082/199: bumped copyright year, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode a8142043e5 094/199: adoc customization group comment puts more emphasis on that most faces belong to markup-faces, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 1206fe7409 103/199: adoc-re-inline-macro can now also match in the middle of a word, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 0ac95247d4 116/199: refactoring so regexp's for one- and two line titles have group 2 for title's text, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 411eb48ce9 120/199: Sensorflo/pr35 (#3), ELPA Syncer, 2023/09/03