branch: elpa/adoc-mode
commit 98646039986711a7c65b3425c931cf9aee2b4f55
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>

    Recognise the icon: inline macro
    
    icon:target[attrlist] (e.g. icon:heart[2x]) is a standard inline macro
    but was not in the recognised macro set.
---
 CHANGELOG.md             | 1 +
 adoc-mode.el             | 3 +++
 doc/spec-compliance.adoc | 8 ++++----
 test/adoc-mode-test.el   | 6 +++++-
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 03dcc0ec18..907ece68fe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,7 @@
 
 ### New features
 
+- Recognise the `icon:target[attrlist]` inline macro (e.g. `icon:heart[2x]`), 
highlighting the macro name, the icon name/path, and its attribute list like 
the other inline macros.
 - Recognise the modern block ID shorthand `[#id]`. The id in a `[#id]` / 
`[#id.role%opt]` block-attribute line is now highlighted like an anchor 
(`adoc-anchor-face`), and cross-reference following (`adoc-goto-ref-label`, 
`M-.`) jumps to `[#id]` block IDs - including the `[style#id]` form, e.g. 
`[source#id]` - not just `[[id]]` anchors.
 - Highlight checklist items. An unordered list item whose text begins with `[ 
]` (unchecked), `[x]`/`[X]`, or `[*]` (checked) now fontifies the checkbox with 
the new `adoc-checkbox-face` (inherits `font-lock-constant-face`).
 - Honour backslash escapes in inline formatting: a backslash before a 
formatting delimiter (e.g. `\*not bold*`, `\**nor this**`, `` \`nor code` ``) 
now de-emphasises the backslash and leaves the escaped span as literal text 
instead of fontifying it as markup. Previously the unconstrained forms still 
leaked an inner constrained match (`\**x**` highlighted `x`).
diff --git a/adoc-mode.el b/adoc-mode.el
index 49b34110e2..9a0251273a 100644
--- a/adoc-mode.el
+++ b/adoc-mode.el
@@ -2752,6 +2752,9 @@ for multiline constructs to be matched."
    (adoc-kw-inline-macro "footnoteref" t nil 'adoc-footnote-marker-face nil nil
                          '(("id" "text") (("text" . adoc-footnote-text-face))))
 
+   ;; icon macro: icon:target[attrlist], target is the icon name/path
+   (adoc-kw-inline-macro "icon" nil nil 'adoc-command-face 
'adoc-internal-reference-face t)
+
    ;; Asciidoctor UI macros
    (adoc-kw-inline-macro "kbd" t nil 'adoc-command-face nil t)
    (adoc-kw-inline-macro "btn" t nil 'adoc-command-face nil t)
diff --git a/doc/spec-compliance.adoc b/doc/spec-compliance.adoc
index ae1e4357f4..36924e4dcb 100644
--- a/doc/spec-compliance.adoc
+++ b/doc/spec-compliance.adoc
@@ -275,8 +275,8 @@ Findings are graded:
 | -
 
 | Icon macro `icon:name[]`
-| Not recognised (no `icon` keyword registered; macros are matched by name)
-| Medium
+| *Fixed* - registered as an inline macro
+| -
 |===
 
 === tables
@@ -389,7 +389,7 @@ implements.
 . [ ] *Drop or de-emphasise the deprecated `` `text' `` / ``\`\`text''``
   templates* in the menu (and the `+...+` / `++...++` "Monospaced"
   templates), or relabel them as legacy.
-. [ ] *Add the `icon:name[]` inline macro* to the recognised macro set
-  (currently unhandled).
+. [x] *Add the `icon:name[]` inline macro* to the recognised macro set.
+  Done.
 . [ ] *Verify* CSV/DSV table formats, counters, and the literal-monospace
   `` `+text+` `` enclosure, and add handling where it is missing.
diff --git a/test/adoc-mode-test.el b/test/adoc-mode-test.el
index 0d8e8c9e46..818d9d6a5f 100644
--- a/test/adoc-mode-test.el
+++ b/test/adoc-mode-test.el
@@ -705,7 +705,11 @@ Don't use it for anything real.")
                   "Click " nil "btn" 'adoc-command-face ":[" 'adoc-meta-face 
"OK" 'adoc-value-face "]" 'adoc-meta-face)
   ;; pass macro
   (adoctest-faces "asciidoctor-pass-macro"
-                  "Use " nil "pass" 'adoc-command-face ":[" 'adoc-meta-face 
"raw content" 'adoc-value-face "]" 'adoc-meta-face))
+                  "Use " nil "pass" 'adoc-command-face ":[" 'adoc-meta-face 
"raw content" 'adoc-value-face "]" 'adoc-meta-face)
+  ;; icon macro
+  (adoctest-faces "asciidoctor-icon-macro"
+                  "icon" 'adoc-command-face ":" 'adoc-meta-face "heart" 
'adoc-internal-reference-face
+                  "[" 'adoc-meta-face "2x" 'adoc-value-face "]" 
'adoc-meta-face))
 
 (ert-deftest adoctest-test-meta-face-cleanup ()
   ;; begin with a few simple explicit cases which are easier to debug in case 
of troubles

Reply via email to