[hmath-commits] org.hartmath.tex2mml/src/org/hartmath/tex2mml Scanner.java,1.1,1.2 TeXParser.java,1.
Status: Pre-Alpha
Brought to you by:
jsurfer
Update of /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15534/src/org/hartmath/tex2mml Modified Files: Scanner.java TeXParser.java Row.java TeX2MathMLFactory.java Text.java Identifier.java Operator.java Node.java Number.java Log Message: initial version Index: Scanner.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/Scanner.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Scanner.java 15 Feb 2004 12:58:33 -0000 1.1 --- Scanner.java 12 Mar 2004 20:47:10 -0000 1.2 *************** *** 12,16 **** // current token protected int token; ! protected String fOperatorString; --- 12,16 ---- // current token protected int token; ! protected String fOperatorString; *************** *** 28,42 **** final static public int T_NOT = 31; final static public int TT_DOT = 32; ! // final static public int TT_POW = 33; final static public int TT_DIVIDE = 34; ! // final static public int TT_MULTIPLY = 35; ! // final static public int TT_SUBTRACT = 36; ! // final static public int TT_ADD = 37; final static public int TT_EQUAL = 38; final static public int TT_UNEQUAL = 39; ! // final static public int TT_GREATER = 40; ! // final static public int TT_GREATEREQUAL = 41; ! // final static public int TT_LESS = 42; ! // final static public int TT_LESSEQUAL = 43; final static public int TT_AND = 44; final static public int TT_OR = 45; --- 28,42 ---- final static public int T_NOT = 31; final static public int TT_DOT = 32; ! // final static public int TT_POW = 33; final static public int TT_DIVIDE = 34; ! // final static public int TT_MULTIPLY = 35; ! // final static public int TT_SUBTRACT = 36; ! // final static public int TT_ADD = 37; final static public int TT_EQUAL = 38; final static public int TT_UNEQUAL = 39; ! // final static public int TT_GREATER = 40; ! // final static public int TT_GREATEREQUAL = 41; ! // final static public int TT_LESS = 42; ! // final static public int TT_LESSEQUAL = 43; final static public int TT_AND = 44; final static public int TT_OR = 45; *************** *** 44,54 **** final static public int TT_RULEDELAYED = 47; final static public int TT_REPLACEALL = 48; ! // final static public int TT_SET = 49; final static public int TT_SETDELAYED = 50; final static public int TT_UPSET = 51; final static public int TT_UPSETDELAYED = 52; final static public int TT_BACKSLASH_SYMBOL = 53; ! final static public int TT_CHARACTER=54; ! final static public int TT_OPERATOR = 55; --- 44,54 ---- final static public int TT_RULEDELAYED = 47; final static public int TT_REPLACEALL = 48; ! // final static public int TT_SET = 49; final static public int TT_SETDELAYED = 50; final static public int TT_UPSET = 51; final static public int TT_UPSETDELAYED = 52; final static public int TT_BACKSLASH_SYMBOL = 53; ! final static public int TT_CHARACTER = 54; ! final static public int TT_OPERATOR = 55; *************** *** 228,232 **** token = TT_OPERATOR; fOperatorString = "_"; ! // token = TT_BLANK; break; --- 228,232 ---- token = TT_OPERATOR; fOperatorString = "_"; ! // token = TT_BLANK; break; *************** *** 268,296 **** token = TT_OPERATOR; fOperatorString = "^"; ! // ! // if (fSourceString.length() > fCurrentPosition) { ! // fChar = fSourceString.charAt(fCurrentPosition); ! // ! // if (fChar == '=') { ! // fCurrentPosition++; ! // token = TT_UPSET; ! // ! // break; ! // } ! // if (fChar == ':') { ! // fCurrentPosition++; ! // ! // if (fSourceString.length() > fCurrentPosition) { ! // fChar = fSourceString.charAt(fCurrentPosition); ! // ! // if (fChar == '=') { ! // fCurrentPosition++; ! // token = TT_UPSETDELAYED; ! // ! // break; ! // } ! // } ! // } ! // } break; --- 268,296 ---- token = TT_OPERATOR; fOperatorString = "^"; ! // ! // if (fSourceString.length() > fCurrentPosition) { ! // fChar = fSourceString.charAt(fCurrentPosition); ! // ! // if (fChar == '=') { ! // fCurrentPosition++; ! // token = TT_UPSET; ! // ! // break; ! // } ! // if (fChar == ':') { ! // fCurrentPosition++; ! // ! // if (fSourceString.length() > fCurrentPosition) { ! // fChar = fSourceString.charAt(fCurrentPosition); ! // ! // if (fChar == '=') { ! // fCurrentPosition++; ! // token = TT_UPSETDELAYED; ! // ! // break; ! // } ! // } ! // } ! // } break; *************** *** 298,315 **** token = TT_OPERATOR; fOperatorString = "/"; ! // if (fSourceString.length() > fCurrentPosition) { ! // if (fSourceString.charAt(fCurrentPosition) == '.') { ! // fCurrentPosition++; ! // token = TT_REPLACEALL; ! // ! // break; ! // } ! // if (fSourceString.charAt(fCurrentPosition) == '=') { ! // fCurrentPosition++; ! // token = TT_DIVIDEBY; ! // ! // break; ! // } ! // } break; --- 298,315 ---- token = TT_OPERATOR; fOperatorString = "/"; ! // if (fSourceString.length() > fCurrentPosition) { ! // if (fSourceString.charAt(fCurrentPosition) == '.') { ! // fCurrentPosition++; ! // token = TT_REPLACEALL; ! // ! // break; ! // } ! // if (fSourceString.charAt(fCurrentPosition) == '=') { ! // fCurrentPosition++; ! // token = TT_DIVIDEBY; ! // ! // break; ! // } ! // } break; *************** *** 323,332 **** break; } ! // if (fSourceString.charAt(fCurrentPosition) == '=') { ! // fCurrentPosition++; ! // token = TT_TIMESBY; ! // ! // break; ! // } } --- 323,332 ---- break; } ! // if (fSourceString.charAt(fCurrentPosition) == '=') { ! // fCurrentPosition++; ! // token = TT_TIMESBY; ! // ! // break; ! // } } *************** *** 335,376 **** token = TT_OPERATOR; fOperatorString = "+"; ! // if (fSourceString.length() > fCurrentPosition) { ! // if (fSourceString.charAt(fCurrentPosition) == '+') { ! // fCurrentPosition++; ! // token = TT_INCREMENT; ! // ! // break; ! // } ! // if (fSourceString.charAt(fCurrentPosition) == '=') { ! // fCurrentPosition++; ! // token = TT_ADDTO; ! // ! // break; ! // } ! // } break; case '-' : token = TT_OPERATOR; fOperatorString = "-"; ! // if (fSourceString.length() > fCurrentPosition) { ! // if (fSourceString.charAt(fCurrentPosition) == '>') { ! // fCurrentPosition++; ! // token = TT_RULE; ! // ! // break; ! // } ! // if (fSourceString.charAt(fCurrentPosition) == '-') { ! // fCurrentPosition++; ! // token = TT_DECREMENT; ! // ! // break; ! // } ! // if (fSourceString.charAt(fCurrentPosition) == '=') { ! // fCurrentPosition++; ! // token = TT_SUBTRACTFROM; ! // ! // break; ! // } ! // } break; --- 335,376 ---- token = TT_OPERATOR; fOperatorString = "+"; ! // if (fSourceString.length() > fCurrentPosition) { ! // if (fSourceString.charAt(fCurrentPosition) == '+') { ! // fCurrentPosition++; ! // token = TT_INCREMENT; ! // ! // break; ! // } ! // if (fSourceString.charAt(fCurrentPosition) == '=') { ! // fCurrentPosition++; ! // token = TT_ADDTO; ! // ! // break; ! // } ! // } break; case '-' : token = TT_OPERATOR; fOperatorString = "-"; ! // if (fSourceString.length() > fCurrentPosition) { ! // if (fSourceString.charAt(fCurrentPosition) == '>') { ! // fCurrentPosition++; ! // token = TT_RULE; ! // ! // break; ! // } ! // if (fSourceString.charAt(fCurrentPosition) == '-') { ! // fCurrentPosition++; ! // token = TT_DECREMENT; ! // ! // break; ! // } ! // if (fSourceString.charAt(fCurrentPosition) == '=') { ! // fCurrentPosition++; ! // token = TT_SUBTRACTFROM; ! // ! // break; ! // } ! // } break; *************** *** 378,407 **** token = TT_OPERATOR; fOperatorString = "="; ! // if (fSourceString.length() > fCurrentPosition) { ! // fChar = fSourceString.charAt(fCurrentPosition); ! // ! // if (fChar == '=') { ! // fCurrentPosition++; ! // token = TT_EQUAL; ! // ! // break; ! // } ! // } break; ! case '>' : token = TT_OPERATOR; fOperatorString = ">"; ! // token = TT_GREATER; ! // ! // if (fSourceString.length() > fCurrentPosition) { ! // if (fSourceString.charAt(fCurrentPosition) == '=') { ! // fCurrentPosition++; ! // token = TT_GREATEREQUAL; ! // ! // break; ! // } ! // } break; --- 378,407 ---- token = TT_OPERATOR; fOperatorString = "="; ! // if (fSourceString.length() > fCurrentPosition) { ! // fChar = fSourceString.charAt(fCurrentPosition); ! // ! // if (fChar == '=') { ! // fCurrentPosition++; ! // token = TT_EQUAL; ! // ! // break; ! // } ! // } break; ! case '>' : token = TT_OPERATOR; fOperatorString = ">"; ! // token = TT_GREATER; ! // ! // if (fSourceString.length() > fCurrentPosition) { ! // if (fSourceString.charAt(fCurrentPosition) == '=') { ! // fCurrentPosition++; ! // token = TT_GREATEREQUAL; ! // ! // break; ! // } ! // } break; *************** *** 409,422 **** token = TT_OPERATOR; fOperatorString = "<"; ! // token = TT_LESS; ! // ! // if (fSourceString.length() > fCurrentPosition) { ! // if (fSourceString.charAt(fCurrentPosition) == '=') { ! // fCurrentPosition++; ! // token = TT_LESSEQUAL; ! // ! // break; ! // } ! // } break; --- 409,422 ---- token = TT_OPERATOR; fOperatorString = "<"; ! // token = TT_LESS; ! // ! // if (fSourceString.length() > fCurrentPosition) { ! // if (fSourceString.charAt(fCurrentPosition) == '=') { ! // fCurrentPosition++; ! // token = TT_LESSEQUAL; ! // ! // break; ! // } ! // } break; *************** *** 434,446 **** break; case '|' : ! if (fSourceString.length() > fCurrentPosition) { ! if (fSourceString.charAt(fCurrentPosition++) == '|') { ! token = TT_OR; ! ! break; ! } ! } ! break; case ':' : if (fSourceString.length() > fCurrentPosition) { --- 434,441 ---- break; case '|' : ! token = TT_OPERATOR; ! fOperatorString = "|"; break; + case ':' : if (fSourceString.length() > fCurrentPosition) { *************** *** 476,482 **** } ! // if (token == TT_EOF) { ! // throwSyntaxError("token not found"); ! // } return; --- 471,477 ---- } ! // if (token == TT_EOF) { ! // throwSyntaxError("token not found"); ! // } return; *************** *** 489,508 **** } ! // protected void throwSyntaxError(String error) { ! // ! // if (fSourceString.length() < fCurrentPosition) { ! // fCurrentPosition--; ! // } ! // // read until end-of-line ! // int eol = fCurrentPosition; ! // while (fSourceString.length() > eol) { ! // fChar = fSourceString.charAt(eol++); ! // if (fChar == '\n') { ! // eol--; ! // break; ! // } ! // } ! // throw new SyntaxError(rowCount, fCurrentPosition - columnCount, fSourceString.substring(columnCount, eol), error); ! // } public String getIdentifier() { --- 484,503 ---- } ! // protected void throwSyntaxError(String error) { ! // ! // if (fSourceString.length() < fCurrentPosition) { ! // fCurrentPosition--; ! // } ! // // read until end-of-line ! // int eol = fCurrentPosition; ! // while (fSourceString.length() > eol) { ! // fChar = fSourceString.charAt(eol++); ! // if (fChar == '\n') { ! // eol--; ! // break; ! // } ! // } ! // throw new SyntaxError(rowCount, fCurrentPosition - columnCount, fSourceString.substring(columnCount, eol), error); ! // } public String getIdentifier() { *************** *** 548,553 **** return fSourceString.substring(startPosition, endPosition); ! } ! final String optimizedCurrentTokenSource1(int startPosition, int endPosition) { //return always the same char[] build only once --- 543,548 ---- return fSourceString.substring(startPosition, endPosition); ! } ! final String optimizedCurrentTokenSource1(int startPosition, int endPosition) { //return always the same char[] build only once *************** *** 696,742 **** * */ ! // public StringBuffer getStringBuffer() { ! // StringBuffer ident = new StringBuffer(); ! // ! // getChar(); ! // ! // if ((fChar == '\n') || (token == TT_EOF)) { ! // throwSyntaxError("string -" + ident.toString() + "- contains no character."); ! // } ! // ! // while (fChar != '"') { ! // if ((fChar == '\\')) { ! // getChar(); ! // ! // switch (fChar) { ! // ! // case '\\' : ! // ident.append(fChar); ! // ! // break; ! // case 'n' : ! // ident.append("\n"); ! // ! // break; ! // case 't' : ! // ident.append("\t"); ! // ! // break; ! // default : ! // throwSyntaxError("string - unknown character after back-slash."); ! // } ! // ! // getChar(); ! // } else { ! // if ((fChar != '"') && ((fChar == '\n') || (token == TT_EOF))) { ! // throwSyntaxError("string -" + ident.toString() + "- not closed."); ! // } ! // ! // ident.append(fChar); ! // getChar(); ! // } ! // } ! // ! // return ident; ! // } } --- 691,737 ---- * */ ! // public StringBuffer getStringBuffer() { ! // StringBuffer ident = new StringBuffer(); ! // ! // getChar(); ! // ! // if ((fChar == '\n') || (token == TT_EOF)) { ! // throwSyntaxError("string -" + ident.toString() + "- contains no character."); ! // } ! // ! // while (fChar != '"') { ! // if ((fChar == '\\')) { ! // getChar(); ! // ! // switch (fChar) { ! // ! // case '\\' : ! // ident.append(fChar); ! // ! // break; ! // case 'n' : ! // ident.append("\n"); ! // ! // break; ! // case 't' : ! // ident.append("\t"); ! // ! // break; ! // default : ! // throwSyntaxError("string - unknown character after back-slash."); ! // } ! // ! // getChar(); ! // } else { ! // if ((fChar != '"') && ((fChar == '\n') || (token == TT_EOF))) { ! // throwSyntaxError("string -" + ident.toString() + "- not closed."); ! // } ! // ! // ident.append(fChar); ! // getChar(); ! // } ! // } ! // ! // return ident; ! // } } Index: TeXParser.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/TeXParser.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TeXParser.java 25 Feb 2004 21:29:59 -0000 1.2 --- TeXParser.java 12 Mar 2004 20:47:10 -0000 1.3 *************** *** 218,226 **** } ! public void start(StringBuffer buffer) { Node node = createNode(); if (node != null) { ! MML_FACTORY.convert(node, buffer); } } } \ No newline at end of file --- 218,234 ---- } ! public void parse2MML(StringBuffer buffer) { Node node = createNode(); if (node != null) { ! MML_FACTORY.convert2MML(node, buffer); ! } ! } ! ! public void parse2CSS(StringBuffer buffer) { ! Node node = createNode(); ! if (node != null) { ! MML_FACTORY.convert2CSS(node, buffer); } } + } \ No newline at end of file Index: Row.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/Row.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Row.java 15 Feb 2004 12:58:33 -0000 1.1 --- Row.java 12 Mar 2004 20:47:10 -0000 1.2 *************** *** 9,15 **** public class Row extends Node implements Cloneable { ! final public static String CONVERTER_PACKAGE_NAME = "org.hartmath.tex2mml.reflection.convert."; ! final public static HashMap CONVERTER = new HashMap(199); ! ArrayList fList; int fType; --- 9,17 ---- public class Row extends Node implements Cloneable { ! final public static String MML_CONVERTER_PACKAGE_NAME = "org.hartmath.tex2mml.reflection.convert."; ! final public static HashMap MML_CONVERTER = new HashMap(199); ! final public static String CSS_CONVERTER_PACKAGE_NAME = "org.hartmath.tex2css.reflection.convert."; ! final public static HashMap CSS_CONVERTER = new HashMap(199); ! ArrayList fList; int fType; *************** *** 34,43 **** } ! public static IRowConverter getConverter(String symbol) { Object temp; ! if ((temp = CONVERTER.get(symbol)) != null) { return (IRowConverter) temp; } ! if (symbol.length() == 0 || CONVERTER.containsKey(symbol)) { return null; } --- 36,45 ---- } ! public static IRowConverter getMMLConverter(String symbol) { Object temp; ! if ((temp = MML_CONVERTER.get(symbol)) != null) { return (IRowConverter) temp; } ! if (symbol.length() == 0 || MML_CONVERTER.containsKey(symbol)) { return null; } *************** *** 50,54 **** } ! String longClassName = CONVERTER_PACKAGE_NAME + shortClassName; Class clazz; try { --- 52,56 ---- } ! String longClassName = MML_CONVERTER_PACKAGE_NAME + shortClassName; Class clazz; try { *************** *** 56,60 **** } catch (ClassNotFoundException e) { // not a predefined converter ! CONVERTER.put(symbol, null); return null; } --- 58,62 ---- } catch (ClassNotFoundException e) { // not a predefined converter ! MML_CONVERTER.put(symbol, null); return null; } *************** *** 63,67 **** try { module = (IRowConverter) clazz.newInstance(); ! CONVERTER.put(symbol, module); return module; } catch (Throwable se) { --- 65,69 ---- try { module = (IRowConverter) clazz.newInstance(); ! MML_CONVERTER.put(symbol, module); return module; } catch (Throwable se) { *************** *** 72,77 **** } ! public void convert(TeX2MathMLFactory f, StringBuffer buf) { ! IRowConverter converter = getConverter(fTeXSymbol); if (converter != null && converter.convert(buf, this, f)) { --- 74,79 ---- } ! public void convert2MML(TeX2MathMLFactory f, StringBuffer buf) { ! IRowConverter converter = getMMLConverter(fTeXSymbol); if (converter != null && converter.convert(buf, this, f)) { *************** *** 81,89 **** f.tagStart(buf, fTag); for (int i = 0; i < fList.size(); i++) { ! ((Node) fList.get(i)).convert(f, buf); } f.tagEnd(buf, fTag); } /** * @param index --- 83,142 ---- f.tagStart(buf, fTag); for (int i = 0; i < fList.size(); i++) { ! ((Node) fList.get(i)).convert2MML(f, buf); } f.tagEnd(buf, fTag); } + public static IRowConverter getCSSConverter(String symbol) { + Object temp; + if ((temp = CSS_CONVERTER.get(symbol)) != null) { + return (IRowConverter) temp; + } + if (symbol.length() == 0 || CSS_CONVERTER.containsKey(symbol)) { + return null; + } + + String shortClassName; + if (symbol.length() == 1) { + shortClassName = "" + Character.toUpperCase(symbol.charAt(0)); + } else { + shortClassName = Character.toUpperCase(symbol.charAt(0)) + symbol.substring(1); + } + + String longClassName = CSS_CONVERTER_PACKAGE_NAME + shortClassName; + Class clazz; + try { + clazz = Class.forName(longClassName); + } catch (ClassNotFoundException e) { + // not a predefined converter + CSS_CONVERTER.put(symbol, null); + return null; + } + + IRowConverter module; + try { + module = (IRowConverter) clazz.newInstance(); + CSS_CONVERTER.put(symbol, module); + return module; + } catch (Throwable se) { + + } + return null; + + } + public void convert2CSS(TeX2MathMLFactory f, StringBuffer buf) + { + IRowConverter converter = getCSSConverter(fTeXSymbol); + + if (converter != null && converter.convert(buf, this, f)) { + return; + } + + buf.append("<m>"); + for (int i = 0; i < fList.size(); i++) { + ((Node) fList.get(i)).convert2CSS(f, buf); + } + buf.append("</m>"); + } /** * @param index Index: TeX2MathMLFactory.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/TeX2MathMLFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TeX2MathMLFactory.java 15 Feb 2004 14:31:01 -0000 1.3 --- TeX2MathMLFactory.java 12 Mar 2004 20:47:10 -0000 1.4 *************** *** 66,73 **** } ! public void convert(Node node, StringBuffer buf) { ! node.convert(this, buf); } /** * Constructor for the EMML object --- 66,77 ---- } ! public void convert2MML(Node node, StringBuffer buf) { ! node.convert2MML(this, buf); } + public void convert2CSS(Node node, StringBuffer buf) { + node.convert2CSS(this, buf); + } + /** * Constructor for the EMML object *************** *** 211,215 **** CONSTANT_SYMBOLS.put("lceiling", new Operator(toEntity('\u2308'), CONSTANT)); CONSTANT_SYMBOLS.put("rceiling", new Operator(toEntity('\u2309'), CONSTANT)); ! CONSTANT_SYMBOLS.put("int", new Operator(toEntity('\u222B'), CONSTANT)); CONSTANT_SYMBOLS.put("circ", new Operator("∘", CONSTANT)); --- 215,219 ---- CONSTANT_SYMBOLS.put("lceiling", new Operator(toEntity('\u2308'), CONSTANT)); CONSTANT_SYMBOLS.put("rceiling", new Operator(toEntity('\u2309'), CONSTANT)); ! CONSTANT_SYMBOLS.put("mid", new Operator(toEntity('\u2223'), CONSTANT)); CONSTANT_SYMBOLS.put("circ", new Operator("∘", CONSTANT)); *************** *** 290,296 **** underover.put(UNDEROVER, "true"); ! CONSTANT_SYMBOLS.put("sum", new Operator(toEntity('\u2211'), CONSTANT, underover)); ! CONSTANT_SYMBOLS.put("prod", new Operator(toEntity('\u220F'), CONSTANT, underover)); ! CONSTANT_SYMBOLS.put("lim", new Operator("lim", CONSTANT, underover)); CONSTANT_SYMBOLS.put("bigwedge", new Operator(toEntity('\u22C0'), CONSTANT, underover)); CONSTANT_SYMBOLS.put("bigvee", new Operator(toEntity('\u22C1'), CONSTANT, underover)); --- 294,300 ---- underover.put(UNDEROVER, "true"); ! CONSTANT_SYMBOLS.put("sum", new Operator(toEntity('\u2211'), "sum", CONSTANT, underover)); ! CONSTANT_SYMBOLS.put("prod", new Operator(toEntity('\u220F'), "ProD", CONSTANT, underover)); ! CONSTANT_SYMBOLS.put("lim", new Operator("lim", "LiM",CONSTANT, underover)); CONSTANT_SYMBOLS.put("bigwedge", new Operator(toEntity('\u22C0'), CONSTANT, underover)); CONSTANT_SYMBOLS.put("bigvee", new Operator(toEntity('\u22C1'), CONSTANT, underover)); *************** *** 304,307 **** --- 308,312 ---- CONSTANT_SYMBOLS.put("=", new Operator("=", CONSTANT)); CONSTANT_SYMBOLS.put("!", new Operator("!", CONSTANT)); + CONSTANT_SYMBOLS.put("|", new Operator(toEntity('\u2223'), CONSTANT)); CONSTANT_SYMBOLS.put("sqrt", new Row("sqrt", "msqrt", UNARY)); Index: Text.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/Text.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Text.java 15 Feb 2004 12:58:33 -0000 1.1 --- Text.java 12 Mar 2004 20:47:10 -0000 1.2 *************** *** 14,22 **** } ! public void convert(TeX2MathMLFactory f, StringBuffer buf) { f.tagStart(buf, fTag); buf.append(fOutput); f.tagEnd(buf, fTag); } ! } \ No newline at end of file --- 14,25 ---- } ! public void convert2MML(TeX2MathMLFactory f, StringBuffer buf) { f.tagStart(buf, fTag); buf.append(fOutput); f.tagEnd(buf, fTag); } ! ! public void convert2CSS(TeX2MathMLFactory f, StringBuffer buf) { ! buf.append(fOutput); ! } } \ No newline at end of file Index: Identifier.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/Identifier.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Identifier.java 15 Feb 2004 12:58:33 -0000 1.1 --- Identifier.java 12 Mar 2004 20:47:10 -0000 1.2 *************** *** 14,22 **** } ! public void convert(TeX2MathMLFactory f, StringBuffer buf) { f.tagStart(buf, fTag); buf.append(fOutput); f.tagEnd(buf, fTag); } } \ No newline at end of file --- 14,26 ---- } ! public void convert2MML(TeX2MathMLFactory f, StringBuffer buf) { f.tagStart(buf, fTag); buf.append(fOutput); f.tagEnd(buf, fTag); } + + public void convert2CSS(TeX2MathMLFactory f, StringBuffer buf) { + buf.append(fOutput); + } } \ No newline at end of file Index: Operator.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/Operator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Operator.java 15 Feb 2004 12:58:33 -0000 1.1 --- Operator.java 12 Mar 2004 20:47:10 -0000 1.2 *************** *** 6,9 **** --- 6,10 ---- String fOperator; int fType; + String fCSSOperator; Map fAttributes; public Operator(String oper) { *************** *** 15,18 **** --- 16,20 ---- fOperator = oper; fType = type; + fCSSOperator = ""; fAttributes = null; } *************** *** 22,33 **** fOperator = oper; fType = type; fAttributes = attributes; } ! public void convert(TeX2MathMLFactory f,StringBuffer buf) { f.tagStart(buf, "mo"); buf.append(fOperator.toString()); f.tagEnd(buf, "mo"); } /* --- 24,56 ---- fOperator = oper; fType = type; + fCSSOperator = ""; + fAttributes = attributes; + } + + public Operator(String oper, String cssOper, int type) { + super("mo", ""); + fOperator = oper; + fType = type; + fCSSOperator = cssOper; + fAttributes = null; + } + + public Operator(String oper, String cssOper, int type, Map attributes) { + super("mo", ""); + fOperator = oper; + fType = type; + fCSSOperator = cssOper; fAttributes = attributes; } ! public void convert2MML(TeX2MathMLFactory f,StringBuffer buf) { f.tagStart(buf, "mo"); buf.append(fOperator.toString()); f.tagEnd(buf, "mo"); } + + public void convert2CSS(TeX2MathMLFactory f,StringBuffer buf) { + buf.append(fOperator.toString()); + } /* *************** *** 64,67 **** --- 87,104 ---- return (String) fAttributes.get(key); } + + /** + * @return Returns the cSSOperator. + */ + public String getCSSOperator() { + return fCSSOperator; + } + + /** + * @param operator The cSSOperator to set. + */ + public void setCSSOperator(String operator) { + fCSSOperator = operator; + } } \ No newline at end of file Index: Node.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/Node.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Node.java 15 Feb 2004 12:58:33 -0000 1.1 --- Node.java 12 Mar 2004 20:47:10 -0000 1.2 *************** *** 31,39 **** } ! public void convert(TeX2MathMLFactory f, StringBuffer buf) { f.tagStart(buf, fTag); buf.append(fOutput); f.tagEnd(buf, fTag); } /* --- 31,43 ---- } ! public void convert2MML(TeX2MathMLFactory f, StringBuffer buf) { f.tagStart(buf, fTag); buf.append(fOutput); f.tagEnd(buf, fTag); } + + public void convert2CSS(TeX2MathMLFactory f, StringBuffer buf) { + buf.append(fOutput); + } /* *************** *** 85,88 **** --- 89,99 ---- return ""; } + + /** + * @return "" as default + */ + public String getCSSOperator() { + return ""; + } /** * @return Returns the output. Index: Number.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/Number.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Number.java 15 Feb 2004 12:58:33 -0000 1.1 --- Number.java 12 Mar 2004 20:47:10 -0000 1.2 *************** *** 14,22 **** } ! public void convert(TeX2MathMLFactory f, StringBuffer buf) { f.tagStart(buf, fTag); buf.append(fOutput); f.tagEnd(buf, fTag); } } \ No newline at end of file --- 14,27 ---- } ! public void convert2MML(TeX2MathMLFactory f, StringBuffer buf) { f.tagStart(buf, fTag); buf.append(fOutput); f.tagEnd(buf, fTag); } + + public void convert2CSS(TeX2MathMLFactory f, StringBuffer buf) + { + buf.append(fOutput); + } } \ No newline at end of file |