List of usage examples for org.jdom2 Element Element
public Element(final String name)
From source file:at.ac.tuwien.ims.latex2mobiformulaconv.converter.mathml2html.elements.scriptlimit.Mover.java
License:Open Source License
@Override public Element render(FormulaElement parent, List<FormulaElement> siblings) { Element mainDiv = new Element("div"); mainDiv.setAttribute("class", "mover"); // Siblings/*from w w w . j a va 2 s .co m*/ List<FormulaElement> content = new ArrayList<>(); content.add(base); content.add(overscript); Element baseDiv = new Element("div"); baseDiv.addContent(base.render(this, content)); baseDiv.setAttribute("class", "base"); Element overscriptDiv = new Element("div"); overscriptDiv.setAttribute("class", "overscript"); overscriptDiv.addContent(overscript.render(this, content)); mainDiv.addContent(overscriptDiv); mainDiv.addContent(baseDiv); return mainDiv; }
From source file:at.ac.tuwien.ims.latex2mobiformulaconv.converter.mathml2html.elements.scriptlimit.Msub.java
License:Open Source License
@Override public Element render(FormulaElement parent, List<FormulaElement> siblings) { Element msubSpan = new Element("span"); msubSpan.setAttribute("class", "msub"); // Add base content msubSpan.addContent(base.render(null, null)); // Add subscript content Element sub = new Element("sub"); sub.addContent(subscript.render(null, null)); msubSpan.addContent(sub);//from w w w . j a v a 2 s . c om return msubSpan; }
From source file:at.ac.tuwien.ims.latex2mobiformulaconv.converter.mathml2html.elements.scriptlimit.Msubsup.java
License:Open Source License
@Override public Element render(FormulaElement parent, List<FormulaElement> siblings) { Element msubsupSpan = new Element("span"); msubsupSpan.setAttribute("class", "msubsup"); // Add base content msubsupSpan.addContent(base.render(null, null)); // Add subscript content Element sup = new Element("sup"); sup.addContent(superscript.render(null, null)); msubsupSpan.addContent(sup);/* w ww . j a v a 2s . c om*/ // Add superscript content Element sub = new Element("sub"); sub.addContent(subscript.render(null, null)); msubsupSpan.addContent(sub); return msubsupSpan; }
From source file:at.ac.tuwien.ims.latex2mobiformulaconv.converter.mathml2html.elements.scriptlimit.Msup.java
License:Open Source License
@Override public Element render(FormulaElement parent, List<FormulaElement> siblings) { Element msuperSpan = new Element("span"); msuperSpan.setAttribute("class", "msup"); // Add base content if (base != null) { Element baseElement = base.render(null, null); msuperSpan.addContent(baseElement); }//from ww w . j a va 2 s . c o m // Add superscript content Element sub = new Element("sup"); sub.addContent(superscript.render(null, null)); msuperSpan.addContent(sub); return msuperSpan; }
From source file:at.ac.tuwien.ims.latex2mobiformulaconv.converter.mathml2html.elements.scriptlimit.Munder.java
License:Open Source License
@Override public Element render(FormulaElement parent, List<FormulaElement> siblings) { Element mainDiv = new Element("div"); mainDiv.setAttribute("class", "munder"); // Siblings/*from w w w . j a v a2 s.co m*/ List<FormulaElement> content = new ArrayList<>(); content.add(base); content.add(underscript); Element baseDiv = new Element("div"); baseDiv.addContent(base.render(this, content)); baseDiv.setAttribute("class", "base"); mainDiv.addContent(baseDiv); Element underscriptDiv = new Element("div"); underscriptDiv.setAttribute("class", "underscript"); underscriptDiv.addContent(underscript.render(this, content)); mainDiv.addContent(underscriptDiv); return mainDiv; }
From source file:at.ac.tuwien.ims.latex2mobiformulaconv.converter.mathml2html.elements.tablesmatrices.Mtable.java
License:Open Source License
@Override public Element render(FormulaElement parent, List<FormulaElement> siblings) { Element mtableDiv = new Element("div"); mtableDiv.setAttribute("class", "mtable"); // create Table Element table = new Element("table"); // Matrix / Table parenthesis if (parent != null && parent instanceof Mfenced) { Mfenced mfenced = (Mfenced) parent; if (mfenced.getOpened().equals("(") && mfenced.getClosed().equals(")")) { table.setAttribute("class", "pmatrix"); }//ww w. j av a 2s . c om if (mfenced.getOpened().equals("[") && mfenced.getClosed().equals("]")) { table.setAttribute("class", "bmatrix"); } if (mfenced.getOpened().equals("{") && mfenced.getClosed().equals("}")) { table.setAttribute("class", "pmatrix"); // intentionally pmatrix for curved border corners mtableDiv.setAttribute("class", mtableDiv.getAttributeValue("class") + " mtable-Bmatrix"); } if (mfenced.getOpened().equals("|") && mfenced.getClosed().equals("|")) { table.setAttribute("class", "vmatrix"); } if (mfenced.getOpened().equals("") && mfenced.getClosed().equals("")) { table.setAttribute("class", "Vmatrix"); } } // evaluate Rows for (int i = 0; i < rows.size(); i++) { table.addContent(rows.get(i).render(null, null)); } mtableDiv.addContent(table); return mtableDiv; }
From source file:at.ac.tuwien.ims.latex2mobiformulaconv.converter.mathml2html.elements.tablesmatrices.Mtd.java
License:Open Source License
@Override public Element render(FormulaElement parent, List<FormulaElement> siblings) { Element td = new Element("td"); td.addContent(content.render(null, null)); return td;//from w w w . j a v a2 s .co m }
From source file:at.ac.tuwien.ims.latex2mobiformulaconv.converter.mathml2html.elements.tablesmatrices.Mtr.java
License:Open Source License
@Override public Element render(FormulaElement parent, List<FormulaElement> siblings) { Element tr = new Element("tr"); for (int i = 0; i < tds.size(); i++) { tr.addContent(tds.get(i).render(null, null)); }//from ww w . ja va 2 s .c om return tr; }
From source file:at.ac.tuwien.ims.latex2mobiformulaconv.converter.mathml2html.elements.token.Mspace.java
License:Open Source License
@Override public Element render(FormulaElement parent, List<FormulaElement> siblings) { Element span = new Element("span"); span.setAttribute("class", "mspace"); String style = "width: " + width.toString() + "; height: " + height.toString() + ";"; span.setAttribute("style", style); span.setText(" "); return span;/* w ww.ja v a2 s . c o m*/ }
From source file:at.ac.tuwien.ims.latex2mobiformulaconv.converter.mathml2html.elements.token.Mtext.java
License:Open Source License
@Override public Element render(FormulaElement parent, List<FormulaElement> siblings) { Element span = new Element("span"); span.setAttribute("class", "mtext"); span.setText(value.trim());/* w w w .j av a2 s. c o m*/ return span; }