use of org.xwiki.annotation.renderer.AnnotationPrintRenderer in project xwiki-platform by xwiki.
the class DefaultAnnotationService method getAnnotatedRenderedContent.
@Override
public String getAnnotatedRenderedContent(String sourceReference, String sourceSyntax, String outputSyntax, Collection<Annotation> annotations) throws AnnotationServiceException {
try {
XDOM xdom = targetIoService.getXDOM(sourceReference, sourceSyntax);
// build the annotations renderer hint for the specified output syntax
String outputSyntaxId = "annotations-" + outputSyntax;
AnnotationPrintRenderer annotationsRenderer = componentManager.getInstance(AnnotationPrintRenderer.class, outputSyntaxId);
WikiPrinter printer = new DefaultWikiPrinter();
annotationsRenderer.setPrinter(printer);
// set the annotations for this renderer
annotationsRenderer.setAnnotations(annotations);
xdom.traverse(annotationsRenderer);
return printer.toString();
} catch (Exception exc) {
throw new AnnotationServiceException(exc);
}
}
Aggregations