use of us.parr.bookish.model.BlockEquation in project bookish by parrt.
the class Translator method visitBlock_eqn.
@Override
public OutputModelObject visitBlock_eqn(BookishParser.Block_eqnContext ctx) {
String eqn = stripQuotes(ctx.getText(), 3);
if (target == Tool.Target.LATEX || target == Tool.Target.LATEX_BOOK) {
return new BlockEquation(this, null, eqn);
}
String relativePath = "images/blkeqn-" + md5hash(eqn) + ".svg";
String src = outputDir + "/" + relativePath;
Path outpath = Paths.get(src);
if (!Files.exists(outpath)) {
Triple<String, Float, Float> results = texConverter.tex2svg(eqn, BLOCKEQN, BLOCK_EQN_FONT_SIZE);
String svg = results.a;
try {
System.out.println(outpath);
Files.write(outpath, svg.getBytes());
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
return new BlockEquation(this, relativePath, eqn);
}
Aggregations