public abstract class FormulaConverter extends Object
PandocLatexToHtmlConverter
Modifier and Type | Field and Description |
---|---|
protected static uk.ac.ed.ph.snuggletex.SnuggleEngine |
engine |
static String |
FORMULA_ID_PREFIX |
private boolean |
generateDebugMarkup
If true, an Implementation of FormulaConverter
should generate debug output markup per Formula
|
private static org.apache.log4j.Logger |
logger |
protected Path |
tempDirPath
This path will hold the temporary generated files
|
protected static org.jdom2.xpath.XPathExpression<org.jdom2.Element> |
xpath |
private static org.jdom2.xpath.XPathFactory |
xPathFactory |
Constructor and Description |
---|
FormulaConverter()
Main constructor for an implementation
If overwritten, super() must be called!
|
Modifier and Type | Method and Description |
---|---|
Map<Integer,String> |
extractFormulas(org.jdom2.Document document)
Parses a JDOM HTML Document for formula entries, sets an id to refer to it in the future.
|
Path |
getTempDirPath() |
abstract Formula |
parse(int id,
String latexFormula)
Parse latex formula code to entities, which afterward can be rendered to html
|
Formula |
parseToMathML(int id,
String latexFormula)
Parses a latex formula to MathML with SnuggleTeX
|
org.jdom2.Element |
renderInvalidFormulaSource(Formula formula) |
org.jdom2.Document |
replaceFormulas(org.jdom2.Document doc,
Map<Integer,Formula> formulaMap)
Replaces all formulas with the html representation of the mapped formula objects
|
void |
setGenerateDebugMarkup(boolean generateDebugMarkup) |
public static final String FORMULA_ID_PREFIX
private static final org.apache.log4j.Logger logger
protected static uk.ac.ed.ph.snuggletex.SnuggleEngine engine
private static org.jdom2.xpath.XPathFactory xPathFactory
protected static org.jdom2.xpath.XPathExpression<org.jdom2.Element> xpath
protected Path tempDirPath
private boolean generateDebugMarkup
public FormulaConverter()
public void setGenerateDebugMarkup(boolean generateDebugMarkup)
public abstract Formula parse(int id, String latexFormula)
latexFormula
- public Formula parseToMathML(int id, String latexFormula)
id
- the formula's indexlatexFormula
- the latex formula stringpublic Map<Integer,String> extractFormulas(org.jdom2.Document document)
document
- JDOM HTML Document to parsepublic org.jdom2.Document replaceFormulas(org.jdom2.Document doc, Map<Integer,Formula> formulaMap)
doc
- JDOM Document where to replace the formulasformulaMap
- Map of the indexed Formula Objectspublic Path getTempDirPath()
public org.jdom2.Element renderInvalidFormulaSource(Formula formula)
Copyright © 2015 Vienna University of Technology. All rights reserved.