[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/adoc-mode 9c395f4bf9 093/199: it's now less likely that te
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/adoc-mode 9c395f4bf9 093/199: it's now less likely that text between two adjacent delimited blocks is misinterpreted as delimited block |
Date: |
Sun, 3 Sep 2023 06:59:37 -0400 (EDT) |
branch: elpa/adoc-mode
commit 9c395f4bf91b82966bff3a4ce1540e5164bc66df
Author: sensorflo <sensorflo@gmail.com>
Commit: sensorflo <sensorflo@gmail.com>
it's now less likely that text between two adjacent delimited blocks is
misinterpreted as delimited block
But sadly that also introduces a bug: contrary to the specification in the
AsciiDoc manual, adoc-mode does not allow that either the first line or the
last line of a delimited block is blank.
---
adoc-mode-test.el | 41 +++++++++++++++++++++++++++++++++++++++++
adoc-mode.el | 25 ++++++++++++++++++++++---
2 files changed, 63 insertions(+), 3 deletions(-)
diff --git a/adoc-mode-test.el b/adoc-mode-test.el
index 68ca1efaa4..4e93454f9b 100644
--- a/adoc-mode-test.el
+++ b/adoc-mode-test.el
@@ -191,6 +191,47 @@ removed before TRANSFORM is evaluated.
"sidebar line 1\nsidebar line 2" markup-secondary-text-face "\n" nil
"********" markup-meta-hide-face "\n"))
+;; Don't mistake text between two same delimited blocks as a delimited block,
+;; i.e. wrongly treating the end of block 1 as a beginning and wrongly
+;; treating the beginning of block 2 as ending.
+(ert-deftest adoctest-test-delimited-blocks-simple ()
+ (adoctest-faces "delimited-blocks-special-case"
+
+ "--------" markup-meta-hide-face "\n" nil
+ "11\n12\n13\n14" markup-code-face "\n" nil
+ "--------" markup-meta-hide-face "\n" nil
+ "\n" nil
+ "lorem" 'no-face "\n" nil
+ "\n" nil
+ "--------" markup-meta-hide-face "\n" nil
+ "21\n22\n23\n24" markup-code-face "\n" nil
+ "--------" markup-meta-hide-face "\n" nil
+ "\n" nil
+ "ipsum" 'no-face "\n" nil))
+
+(ert-deftest adoctest-test-delimited-blocks-simple ()
+ (adoctest-faces "delimited-blocks-empty"
+ "////////" markup-meta-hide-face "\n" nil
+ "////////" markup-meta-hide-face "\n" nil
+ "\n" nil
+ "++++++++" markup-meta-hide-face "\n" nil
+ "++++++++" markup-meta-hide-face "\n" nil
+ "\n" nil
+ "--------" markup-meta-hide-face "\n" nil
+ "--------" markup-meta-hide-face "\n" nil
+ "\n" nil
+ "........" markup-meta-hide-face "\n" nil
+ "........" markup-meta-hide-face "\n" nil
+ "\n" nil
+ "________" markup-meta-hide-face "\n" nil
+ "________" markup-meta-hide-face "\n" nil
+ "\n" nil
+ "========" markup-meta-hide-face "\n" nil
+ "========" markup-meta-hide-face "\n" nil
+ "\n" nil
+ "********" markup-meta-hide-face "\n" nil
+ "********" markup-meta-hide-face "\n"))
+
(ert-deftest adoctest-test-open-block ()
(adoctest-faces "open-block"
"--" markup-meta-hide-face "\n" nil
diff --git a/adoc-mode.el b/adoc-mode.el
index 632f68abac..1c2708c979 100644
--- a/adoc-mode.el
+++ b/adoc-mode.el
@@ -900,13 +900,32 @@ Subgroups:
adoc-delimited-block-del "\\|")
"\\)"))
+;; KLUDGE: Contrary to what the AsciiDoc manual specifies, adoc-mode does not
+;; allow that either the first or the last line within a delmited block is
+;; blank. That shall help to prevent the case that adoc-mode wrongly
+;; interprets the end of a delimited block as the beginning, and the beginning
+;; of a following delimited block as the ending, thus wrongly interpreting the
+;; text between two adjacent delimited blocks as delimited block. It is
+;; expected that it is unlikely that one wants to begin or end a delimited
+;; block with a blank line, and it is expected that it is likely that
+;; delimited blocks are surrounded by blank lines.
(defun adoc-re-delimited-block (del)
(let* ((tmp (nth del adoc-delimited-block-del))
(start (if (consp tmp) (car tmp) tmp))
(end (if (consp tmp) (cdr tmp) tmp)))
(concat
"\\(" start "\\)[ \t]*\n"
- "\\(\\(?:.*\n\\)*?\\)"
+ "\\("
+ ;; a single leading non-blank line
+ "[ \t]*[^ \t\n].*\n"
+ ;; optionally followed by
+ "\\(?:"
+ ;; any number of arbitrary lines followed by
+ "\\(?:.*\n\\)*?"
+ ;; a trailing non blank line
+ "[ \t]*[^ \t\n].*\n"
+ "\\)??"
+ "\\)??"
"\\(" end "\\)[ \t]*$")))
;; TODO: since its multiline, it doesn't yet work properly.
@@ -1399,8 +1418,8 @@ Concerning TYPE, LEVEL and SUB-TYPE see `adoc-re-llisti'."
'(0 '(face nil font-lock-multiline t) t)
'(1 '(face markup-meta-hide-face adoc-reserved block-del) t)
(if (not inhibit-text-reserved)
- `(2 '(face ,text-face face markup-verbatim-face adoc-reserved t) t)
- `(2 ,text-face t))
+ `(2 '(face ,text-face face markup-verbatim-face adoc-reserved t) t t)
+ `(2 ,text-face t t))
'(3 '(face markup-meta-hide-face adoc-reserved block-del) t)))
;; if adoc-kw-delimited-block, adoc-kw-two-line-title don't find the whole
- [nongnu] elpa/adoc-mode 601de95b01 062/199: modified regexp for xref for better find, (continued)
- [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, 2023/09/03
- [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 <=
- [nongnu] elpa/adoc-mode 06f9792fcd 011/199: added further simple tests for constrained/uncronstrained quotes, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode ead05da007 014/199: split up the current big test into smaller ones, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode f519baf304 022/199: addef *.elc files to .gitignore, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 886497d6a6 023/199: added a few medium complex tests for (un)constrained quotes, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode b65c7fcb92 026/199: block title now fits into the new concept, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 0f7619cfce 027/199: enheanced inline-subst-boundaries test, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode b8e8574afa 038/199: introduced adoc-attribute-face-alist, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode e03d63e0b3 039/199: extened anchors unittest and fixed revealed bug, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 6ccb9d6de5 009/199: intermediate checkin - to be removed, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode ce247928ec 021/199: added test for byte-compile-file without errors, ELPA Syncer, 2023/09/03