Icon Transformation

Last modified by Raphaƫl Jakse on 2024/07/05 18:03

cogA rendering transformation to transform series of characters into icons (emoticons and others)
TypeJAR
Category
Developed by

XWiki Development Team

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1
Compatibility

XWiki 2.6RC1+

Description

Transforms some special characters representing icons into images. For example transforms the (:)) characters into a smiley: emoticon_smile

Here are the default mappings:

CharactersResult
:)emoticon_smile
:(emoticon_unhappy
:Pemoticon_tongue
:Demoticon_grin
;)emoticon_wink
(y)thumb_up
(n)thumb_down
(i)information
(/)accept
(x)cancel
(!)error
(+)add
(-)delete
(?)help
(on)lightbulb
(off)lightbulb_off
(*)star

Customizations

It's possible to customize 2 things:

  • Change the icon used to represent one of the default mappings
  • Add new mappings so that other series of characters are recognized
  • Remove default mappings

To make those changes, edit WEB-INF/lib/xwiki.properties and look for keys starting with the rendering.transformation.icon. prefix.

For example if you wish to change the icon used to represent :) so that it uses emoticon_grin instead, you'd add or modify the following property like this:

rendering.transformation.icon.mappings = :) = emoticon_grin

The icons you can use and their names can be found in this Silk Icon Set Reference

If you wish to add a new mapping so that typing (h) generates a heart (heart), you'd add:

rendering.transformation.icon.mappings = (h) = heart

Since XWiki 8.4.5+/9.3RC1+. If you wish to remove a default mapping, simply redefine the emoticon with a blank value. For example to prevent (n) from displaying you'd add:

rendering.transformation.icon.mappings = (n) =

Prerequisites & Installation Instructions

This transformation is active by default so you should be able to use it right away.

If you wish to disable it or if someone disabled it and you need to re-activate it,  edit WEB-INF/xwiki.properties, look for a property named rendering.transformations and make sure it's uncommented and contains the value icon

For example:

rendering.transformations = macro, icon

Make sure you restart your XWiki instance for the change to take effect.

Get Connected