Wiki source code of Available Transformations

Last modified by Marius Dumitru Florea on 2026/02/16 11:37

Show last authors
1 Here's the list of available [[Transformations>>Architecture]] you can use:
2
3 {{toc/}}
4
5 To configure the list of Transformations to execute in your wiki, edit your ##xwiki.properties## file and look for the ##rendering.transformations## configuration key. The default value is (which means you have the Macro Transformation and the Icon Transformation enabled by default in your wiki):
6
7 {{code language="none"}}
8 rendering.transformations = macro, icon
9 {{/code}}
10
11 {{version since="18.1.0RC1"}}
12 You can also configure the list of transformations to perform from the ##TransformationContext##, for a specific call to the ##TransformationManager##:
13
14 {{code language="java"}}
15 TransformationContext transformationContext = new TransformationContext();
16 transformationContext.setTransformationNames(Optional.of(List.of("macro", "icon")));
17 transformationManager.performTransformations(xdom, transformationContext);
18 {{/code}}
19 {{/version}}
20
21 = Macro Transformation =
22
23 See the [[Macro Transformation documentation>>extensions:Extension.RenderingMacroTransformation.WebHome]].
24
25 = Icon Transformation =
26
27 See the [[Icon Transformation documentation>>extensions:Extension.Icon Transformation]] to understand what this transformation does.
28
29 Example of usage:
30
31 {{code language="java"}}
32 // Initialize Rendering components and allow getting instances
33 final EmbeddableComponentManager cm = new EmbeddableComponentManager();
34 cm.initialize(this.getClass().getClassLoader());
35
36 XDOM xdom = new XDOM(Arrays.<Block>asList(new ParagraphBlock(Arrays.asList((Block) new SpecialSymbolBlock(':'),
37 new SpecialSymbolBlock(')')))));
38
39 Transformation transformation = cm.lookup(Transformation.class, "icon");
40 TransformationContext txContext = new TransformationContext();
41 transformation.transform(xdom, txContext);
42
43 WikiPrinter printer = new DefaultWikiPrinter();
44 BlockRenderer renderer = cm.lookup(BlockRenderer.class, Syntax.XWIKI_2_0.toIdString());
45 renderer.render(xdom, printer);
46
47 String expected = "image:emoticon_smile";
48
49 Assert.assertEquals(expected, printer.toString());
50 {{/code}}
51
52 It's also possible to configure new emoticons or override existing ones by getting the ##IconTransformationConfiguration## component as shown below (works on XWiki Rendering 3.3M1+):
53
54 {{code language="java"}}
55 // Initialize Rendering components and allow getting instances
56 final EmbeddableComponentManager cm = new EmbeddableComponentManager();
57 cm.initialize(this.getClass().getClassLoader());
58
59 XDOM xdom = new XDOM(Arrays.<Block>asList(new ParagraphBlock(Arrays.asList((Block) new SpecialSymbolBlock(':'),
60 new SpecialSymbolBlock(':')))));
61
62 // Test adding a new Icon Mapping.
63 cm.lookup(IconTransformationConfiguration.class).addMapping("::", "something");
64
65 Transformation transformation = cm.lookup(Transformation.class, "icon");
66 TransformationContext txContext = new TransformationContext();
67 transformation.transform(xdom, txContext);
68
69 WikiPrinter printer = new DefaultWikiPrinter();
70 BlockRenderer renderer = cm.lookup(BlockRenderer.class, Syntax.XWIKI_2_0.toIdString());
71 renderer.render(xdom, printer);
72
73 String expected = "image:box";
74
75 Assert.assertEquals(expected, printer.toString());
76 {{/code}}
77
78 = WikiWord Transformation =
79
80 See the [[WikiWord Transformation documentation>>extensions:Extension.WikiWord Transformation]] to understand what this transformation does.
81
82 Example of usage:
83
84 {{code language="java"}}
85 // Initialize Rendering components and allow getting instances
86 final EmbeddableComponentManager cm = new EmbeddableComponentManager();
87 cm.initialize(this.getClass().getClassLoader());
88
89 XDOM xdom = new XDOM(
90 Arrays.<Block>asList(new ParagraphBlock(Arrays.asList((Block) new WordBlock("WikiWord")))));
91
92 Transformation transformation = cm.lookup(Transformation.class, "wikiword");
93 TransformationContext txContext = new TransformationContext();
94 transformation.transform(xdom, txContext);
95
96 WikiPrinter printer = new DefaultWikiPrinter();
97 BlockRenderer renderer = cm.lookup(BlockRenderer.class, Syntax.XWIKI_2_0.toIdString());
98 renderer.render(xdom, printer);
99
100 String expected = "[[WikiWord]]";
101
102 Assert.assertEquals(expected, printer.toString());
103 {{/code}}
104
105 = LinkChecker Transformation =
106
107 See the [[Link Checker Transformation documentation>>extensions:Extension.Link Checker Transformation]] to understand what this transformation does and how to use it.
  • Powered by XWiki 18.4.6 - node1. Hosted and managed by XWiki SAS

Get Connected