{{groovy}}
import org.xwiki.rendering.converter.Converter
import org.xwiki.rendering.renderer.printer.DefaultWikiPrinter;
import org.xwiki.rendering.syntax.Syntax;
import org.xwiki.rendering.syntax.SyntaxType;
import java.io.StringReader;
Syntax LATEX_SYNTAX = new Syntax(new SyntaxType("latex+fragment", "LaTeX-Fragment"), "1.0");
String wikiText = "image:Test.LaTeXFragment@testimage.jpg"
String latexText = ""
if (true) {
Converter converter = services.component.getContextComponentManager().getInstance(Converter.class)
DefaultWikiPrinter printer = new DefaultWikiPrinter()
converter.convert(new StringReader(wikiText), Syntax.XWIKI_2_1, LATEX_SYNTAX, printer);
latexText = printer.toString()
printer = null
converter = null
}
return """
{{raw syntax="latex/1.0"}}
$latexText
{{/raw}}
"""
{{/groovy}}