branch: elpa/adoc-mode commit 69569ee920fd785f8906690efe3590d41b758086 Author: sensorflo <sensor...@gmail.com> Commit: sensorflo <sensor...@gmail.com>
improved fontifying for footnoteref --- adoc-mode-test.el | 31 +++++++++++++++++++++++++++++++ adoc-mode.el | 17 +++-------------- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index b412a913fa..2fd651fe85 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -309,6 +309,37 @@ removed before TRANSFORM is evaluated. "]" markup-meta-face "\n" nil )) +(ert-deftest adoctest-test-footnoterefs () + (adoctest-faces "footnoterefs" + ;; simple example + "footnoteref" markup-command-face ":" markup-meta-face + "[" markup-meta-face + "myid" markup-anchor-face + "]" markup-meta-face "\n" nil + + "footnoteref" markup-command-face ":" markup-meta-face + "[" markup-meta-face + "myid" markup-anchor-face + "," markup-meta-face + "lorem ipsum" markup-secondary-text-face + "]" markup-meta-face "\n" nil + + ;; footnoteref can be hard up against the preceding word + "lorem" 'no-face + "footnoteref" markup-command-face ":" markup-meta-face + "[" markup-meta-face + "myid" markup-anchor-face + "]" markup-meta-face "\n" nil + + "lorem" 'no-face + "footnoteref" markup-command-face ":" markup-meta-face + "[" markup-meta-face + "myid" markup-anchor-face + "," markup-meta-face + "lorem ipsum" markup-secondary-text-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 575606451b..390ddc836a 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -463,7 +463,8 @@ To become a customizable variable when regexps for list items become customizabl ("alt" . markup-secondary-text-face) ("title" . markup-secondary-text-face) ("attribution" . markup-secondary-text-face) - ("citetitle" . markup-secondary-text-face)) + ("citetitle" . markup-secondary-text-face) + ("text" . markup-secondary-text-face)) "An alist, key=attribute id, value=face.") (defvar adoc-mode-abbrev-table nil @@ -2024,19 +2025,7 @@ meta characters." (adoc-kw-inline-macro "xref" nil nil '(markup-reference-face markup-internal-reference-face) t '(("caption") (("caption" . markup-reference-face)))) (adoc-kw-inline-macro "footnote" t nil nil nil 'entire-attribute-list) - (list "\\(\\bfootnoteref:\\)\\(\\[\\)\\(.*?\\)\\(,\\)\\(.*?\\(?:\n.*?\\)?\\)\\(\\]\\)" - '(1 adoc-delimiter) ; name - '(2 adoc-hide-delimiter) ; [ - '(3 adoc-anchor) ; anchor-id - '(4 adoc-hide-delimiter) ; , - '(5 adoc-secondary-text) ; footnote text - '(6 adoc-hide-delimiter)) ; ] - (list "\\(\\bfootnoteref:\\)\\(\\[\\)\\([^,\n].*?\\(?:\n.*?\\)?\\)\\(\\]\\)" - '(1 adoc-delimiter) ; name - '(2 adoc-hide-delimiter) ; [ - '(3 adoc-reference) ; reference-id to footnote - ;; '(3 (adoc-facespec-superscript)) bug: does also fontify the version having anchor-id - '(4 adoc-hide-delimiter)) ; ] + (adoc-kw-inline-macro "footnoteref" t nil nil nil '("id" "text")) (adoc-kw-standalone-urls) ;; Macros using default syntax and having default highlighting in adoc-mod