Wiki Word Transformation

The WikiWord transformation is used to automatically generate links for WikiWords. A WikiWord consists of two or more words composed of at least two letters each, without white spaces, where the first letter of each component word is capitalized and the remaining letters are in lowercase. 

The WikiWord Transformation is disabled by default, but when it is activated it automatically generates links for WikiWords which are pointing to wiki pages. If the referred pages don't exist, a question mark will appear on the link, allowing you to create the new page by clicking on it. To enable the WikiWord transformation, edit the "WEB-INF/xwiki.properties" file, un-comment the line #-#rendering.transformations = macro, icon, add value "wikiword"

#-#rendering.transformations = macro, icon, wikiword

then restart the server.

In order to discover WikiWords, this transformation needs to check every rendered word in the page and it can affect the overall performance.

Example of Usage

// Initialize Rendering components and allow getting instances
final EmbeddableComponentManager cm = new EmbeddableComponentManager();
cm.initialize(this.getClass().getClassLoader());

 XDOM xdom = new XDOM(
    Arrays.<Block>asList(new ParagraphBlock(Arrays.asList((Block) new WordBlock("WikiWord")))));

 Transformation transformation = cm.lookup(Transformation.class, "wikiword");
 TransformationContext txContext = new TransformationContext();
 transformation.transform(xdom, txContext);

 WikiPrinter printer = new DefaultWikiPrinter();
 BlockRenderer renderer = cm.lookup(BlockRenderer.class, Syntax.XWIKI_2_0.toIdString());
 renderer.render(xdom, printer);

 String expected = "[[WikiWord]]";

 Assert.assertEquals(expected, printer.toString());

  

Related Pages

Search this space