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

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

[nongnu] elpa/adoc-mode b65c7fcb92 026/199: block title now fits into th


From: ELPA Syncer
Subject: [nongnu] elpa/adoc-mode b65c7fcb92 026/199: block title now fits into the new concept
Date: Sun, 3 Sep 2023 06:59:21 -0400 (EDT)

branch: elpa/adoc-mode
commit b65c7fcb92638575e33bbc5a516b949e1be577ab
Author: Florian Kaufmann <sensorflo@gmail.com>
Commit: Florian Kaufmann <sensorflo@gmail.com>

    block title now fits into the new concept
---
 adoc-mode-test.el | 18 +++++++++++++-----
 adoc-mode.el      | 38 ++++++++++++++++++++++++++++----------
 2 files changed, 41 insertions(+), 15 deletions(-)

diff --git a/adoc-mode-test.el b/adoc-mode-test.el
index fc7e62c3e8..fb6a7309be 100644
--- a/adoc-mode-test.el
+++ b/adoc-mode-test.el
@@ -1,3 +1,4 @@
+
 (require 'ert)
 (require 'adoc-mode)
 
@@ -77,7 +78,10 @@
    "^^^^^^^^^" markup-meta-hide-face "\n" nil
    "\n" nil
    "chapter 4" markup-title-4-face "\n" nil
-   "+++++++++" markup-meta-hide-face "\n" nil))
+   "+++++++++" markup-meta-hide-face "\n" nil
+   "\n" nil
+
+   "." markup-meta-face "Block title" markup-gen-face "\n" nil ))
 
 (ert-deftest adoctest-test-delimited-blocks-simple ()
   (adoctest-faces "delimited-blocks-simple"
@@ -210,10 +214,14 @@
    "lorem ** ipsum\n" 'no-face
    "\n" nil
 
-   ;; "chapter ** 1" markup-title-1-face "\n" nil
-   ;; "------------" markup-meta-hide-face "\n" nil
-   ;; "lorem ** ipsum\n" 'no-face
-   ;; "\n" nil
+   "chapter ** 1" markup-title-1-face "\n" nil
+   "------------" markup-meta-hide-face "\n" nil
+   "lorem ** ipsum\n" 'no-face
+   "\n" nil
+
+   "." markup-meta-face "block ** title" markup-gen-face "\n" nil
+   "lorem ** ipsum\n" 'no-face
+   "\n" nil
 
 
   ;; test also
diff --git a/adoc-mode.el b/adoc-mode.el
index 4a15635143..6c54bee868 100644
--- a/adoc-mode.el
+++ b/adoc-mode.el
@@ -585,6 +585,26 @@ Subgroups:
 
    "\\)" ))
 
+;; ^\.(?P<title>([^.\s].*)|(\.[^.\s].*))$
+;; Isn't that asciidoc.conf regexp the same as: ^\.(?P<title>(.?[^.\s].*))$
+;; insertion: so that this whole regex doesn't mistake a line starting with a 
cell specifier like .2+| as a block title 
+(defun adoc-re-block-title ()
+  "Returns a regexp matching an block title
+
+Subgroups:
+1 delimiter
+2 title's text incl trailing whites
+3 newline 
+
+.foo n
+12--23"
+  (concat
+   "^\\(\\.\\)"
+   "\\(\\.?\\(?:"      
+   "[0-9]+[^+*]" ; inserted part, see above
+   "\\|[^. \t\n]\\).*\\)"
+   "\\(\n\\)"))
+
 (defun adoc-re-precond (&optional unwanted-chars backslash-allowed 
disallowed-at-bol)
   (concat
           (when disallowed-at-bol ".")
@@ -937,6 +957,13 @@ Concerning TYPE, LEVEL and SUB-TYPE see `adoc-re-llisti'."
     ;; highlighers
     '(1 '(face adoc-monospace adoc-reserved t font-lock-multiline t))))
 
+(defun adoc-kw-block-title ()
+  (list
+   `(lambda (end) (adoc-kwf-std end ,(adoc-re-block-title) '(1)))
+   '(1 '(face markup-meta-face adoc-reserved block-del))
+   '(2 markup-gen-face)
+   '(3 '(face nil adoc-reserved block-del))))
+
 (defun adoc-kw-quote (type ldel text-face-spec &optional del-face rdel 
literal-p)
   "Return a keyword which highlights (un)constrained quotes.
 When LITERAL-P is non-nil, the contained text is literal text."
@@ -1260,18 +1287,9 @@ When LITERAL-P is non-nil, the contained text is literal 
text."
          '(1 '(face adoc-delimiter adoc-reserved block-del)))
 
 
-
    ;; block title
    ;; -----------------------------------
-   ;; ^\.(?P<title>([^.\s].*)|(\.[^.\s].*))$
-   ;; Isn't that asciidoc.conf regexp the same as: ^\.(?P<title>(.?[^.\s].*))$
-   (list (concat
-          "^\\(\\.\\)\\(\\.?\\("
-         ; insertion: so that this whole regex doesn't mistake a line starting 
with a cell specifier like .2+| as a block title 
-          "[0-9]+[^+*]"                  
-          "\\|[^. \t\n]\\).*\\)$")
-         '(1 '(face adoc-delimiter adoc-reserved block-del))
-        '(2 adoc-generic))
+   (adoc-kw-block-title)
 
 
    ;; paragraphs



reply via email to

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