branch: elpa/adoc-mode commit 3ba0822b91fa6270964acb33f15f04f0ae73958a Author: Florian Kaufmann <sensor...@gmail.com> Commit: Florian Kaufmann <sensor...@gmail.com>
bugfix: quotes shall not cross labeled list item boundaries --- adoc-mode-test.el | 20 +++++++++----------- adoc-mode.el | 7 ++++++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index e2d4b992d0..753c729d34 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -240,20 +240,18 @@ "lorem " 'no-face "**" markup-meta-hide-face " ipsum " markup-strong-face "**" markup-meta-hide-face "\n" nil "\n" nil - ;; 1) don't cross list item boundaries - ;; 2) don't mistake a list item '**' as an unconstrained quote '**' (either start or end) + ;; don't cross list item boundaries "-" markup-list-face " " nil "lorem ** ipsum\n" 'no-face "-" markup-list-face " " nil "dolor ** sit\n" 'no-face - "**" markup-list-face " " nil "lorem ** ipsumt\n" 'no-face + ;; test that a quote within the list element works + "-" markup-list-face " " nil "dolor " 'no-face "**" markup-meta-hide-face " sit " markup-strong-face "**" markup-meta-hide-face "\n" nil + ;; dont mistake '**' list elements for quote starters/enders + "**" markup-list-face " " nil "lorem ** ipsum\n" 'no-face "**" markup-list-face " " nil "dolor ** sit\n" 'no-face - - ;; todo: not reaching into a labeled list item text does no yet work - ;; "lorem ** ipsum " markup-gen-face "::" markup-list-face " " nil "sit ** dolor\n" 'no-face - - ;; test also - ;; - over beginning of labeled - - )) + "**" markup-list-face " " nil "dolor ** sit\n" 'no-face + ;; don't cross list item boundaries in the case of labeled lists + "lorem ** ipsum " markup-gen-face "::" markup-list-face " " nil "sit ** dolor\n" 'no-face + "lorem ** ipsum " markup-gen-face "::" markup-list-face " " nil "sit ** dolor\n" 'no-face)) ;; todo: also test for warnings (ert-deftest adoctest-test-byte-compile () diff --git a/adoc-mode.el b/adoc-mode.el index 6c54bee868..5a74af9182 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -902,7 +902,12 @@ Concerning TYPE, LEVEL and SUB-TYPE see `adoc-re-oulisti'" "Creates a keyword for font-lock which highlights labeled list item. Concerning TYPE, LEVEL and SUB-TYPE see `adoc-re-llisti'." (list - `(lambda (end) (adoc-kwf-std end ,(adoc-re-llisti sub-type level) '(0))) + `(lambda (end) + (when (adoc-kwf-std end ,(adoc-re-llisti sub-type level) '(0)) + (let ((pos (match-beginning 0))) + (when (> pos (point-min)) + (put-text-property (1- pos) pos 'adoc-reserved 'block-del))) + t)) '(1 '(face nil adoc-reserved block-del) t) '(2 markup-gen-face t) '(3 '(face adoc-align adoc-reserved block-del) t)