/** * {@inheritDoc} * * @see java.lang.Object#toString() * @since 1.8RC2 */ @Override public String toString() { return getWord(); } }
/** * {@inheritDoc} * * @see AbstractBlock#traverse(Listener) */ public void traverse(Listener listener) { listener.onWord(getWord()); }
@Override public void transform(Block block, TransformationContext transformationContext) throws TransformationException { // Find all Word blocks and for each of them check if they're a wiki word or not for (WordBlock wordBlock : this.filter.getChildrenByType(block, WordBlock.class, true)) { Matcher matcher = WIKIWORD_PATTERN.matcher(wordBlock.getWord()); if (matcher.matches()) { ResourceReference linkReference = new DocumentResourceReference(wordBlock.getWord()); wordBlock.getParent().replaceChild(new LinkBlock(wordBlock.getChildren(), linkReference, false), wordBlock); } } } }
/** * {@inheritDoc} * @see AbstractTransformation#transform(Block, TransformationContext) */ public void transform(Block block, TransformationContext transformationContext) throws TransformationException { // Find all Word blocks and for each of them check if they're a wiki word or not for (WordBlock wordBlock : this.filter.getChildrenByType(block, WordBlock.class, true)) { Matcher matcher = WIKIWORD_PATTERN.matcher(wordBlock.getWord()); if (matcher.matches()) { ResourceReference linkReference = new DocumentResourceReference(wordBlock.getWord()); wordBlock.getParent().replaceChild(new LinkBlock(wordBlock.getChildren(), linkReference, false), wordBlock); } } } }