branch: elpa/adoc-mode commit 3d2ab8175015ba0926c1f37141e0bc7d05db8bfd Author: Florian Kaufmann <sensor...@gmail.com> Commit: Florian Kaufmann <sensor...@gmail.com>
new style font lock for xref inline macro --- adoc-mode-test.el | 9 +++++++++ adoc-mode.el | 13 +++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index fcd84290cb..e94641a626 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -161,6 +161,15 @@ " ipsum\n" 'no-face )) +(ert-deftest adoctest-test-references () + (adoctest-faces "references" + "lorem " 'no-face "xref" markup-command-face ":" markup-meta-face + "foo" markup-reference-face "[]" markup-meta-face "\n" nil + "lorem " 'no-face "xref" markup-command-face ":" markup-meta-face + "foo" markup-internal-reference-face "[" markup-meta-face + "bla bli bla blu" markup-reference-face "]" markup-meta-face "\n" nil + )) + (ert-deftest adoctest-test-images () (adoctest-faces "images" ;; block macros diff --git a/adoc-mode.el b/adoc-mode.el index 00baff0489..bc9bd785f9 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1049,9 +1049,9 @@ When LITERAL-P is non-nil, the contained text is literal text." `(1 '(face ,(or cmd-face markup-command-face) adoc-reserved t) t) '(2 '(face markup-meta-face adoc-reserved t) t) ; : `(3 ,(cond ((not target-faces) markup-meta-face) - ((listp target-faces) '(if (string= (match-string 5) "") - (car target-faces) - (cadr target-faces))) + ((listp target-faces) `(if (string= (match-string 5) "") + ,(car target-faces) + ,(cadr target-faces))) (t target-faces)) ,(if target-meta-p t 'append)) '(4 '(face markup-meta-face adoc-reserved t) t) ; [ @@ -1481,9 +1481,10 @@ When LITERAL-P is non-nil, the contained text is literal text." ;; Macros using default syntax, but having special highlighting in adoc-mode (adoc-kw-inline-macro "anchor" nil markup-anchor-face t '("xreflabel")) - (adoc-kw-inline-macro "image" markup-complex-replacement-face markup-internal-reference-face t '("alt")) - ;; (adoc-kw-inline-macro "xref" nil markup-internal-reference-face t - ;; '(("alt") (("" . ))) + (adoc-kw-inline-macro "image" markup-complex-replacement-face markup-internal-reference-face t + '("alt")) + (adoc-kw-inline-macro "xref" nil '(markup-reference-face markup-internal-reference-face) t + '(("caption") (("caption" . markup-reference-face)))) ;; (list "\\b\\(xref:\\)\\([^ \t\n]*?\\)\\(\\[\\)\\(.*?\\)\\(,.*?\\)?\\(\\]\\)" ;; '(1 adoc-hide-delimiter) '(2 adoc-delimiter) '(3 adoc-hide-delimiter) '(4 adoc-reference) '(5 adoc-delimiter nil t) '(6 adoc-hide-delimiter))