hmath-commits Mailing List for HMath - MathML Wiki/BLOG (Page 3)
Status: Pre-Alpha
Brought to you by:
jsurfer
You can subscribe to this list here.
| 2004 |
Jan
|
Feb
(28) |
Mar
(121) |
Apr
(49) |
May
(11) |
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|
|
From: Klaus H. <js...@us...> - 2004-04-02 18:33:21
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/META-INF/services In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11079/WEB-INF/src/META-INF/services Modified Files: org.radeox.macro.code.SourceCodeFormatter Log Message: misc changes Index: org.radeox.macro.code.SourceCodeFormatter =================================================================== RCS file: /cvsroot/hmath/org.hmath.server/WEB-INF/src/META-INF/services/org.radeox.macro.code.SourceCodeFormatter,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** org.radeox.macro.code.SourceCodeFormatter 9 Mar 2004 20:13:09 -0000 1.1 --- org.radeox.macro.code.SourceCodeFormatter 2 Apr 2004 18:21:11 -0000 1.2 *************** *** 1 **** --- 1,2 ---- org.snipsnap.render.macro.code.Java2HtmlCodeFilter + org.hmath.server.macro.code.CHashCodeFilter \ No newline at end of file |
|
From: Klaus H. <js...@us...> - 2004-04-02 18:31:52
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hmath/server/macro/code In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10875/WEB-INF/src/org/hmath/server/macro/code Added Files: CHashCodeFilter.java Log Message: misc changes --- NEW FILE: CHashCodeFilter.java --- /* * This file is part of "SnipSnap Radeox Rendering Engine". * * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel All Rights Reserved. * * Please visit http://radeox.org/ for updates and contact. * * --LICENSE NOTICE-- This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser * General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any * later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --LICENSE NOTICE-- */ package org.hmath.server.macro.code; import org.radeox.macro.code.DefaultRegexCodeFormatter; import org.radeox.macro.code.SourceCodeFormatter; /* * JavaCodeFilter colourizes Java source code * * @author stephan @team sonicteam * * @version $Id: CHashCodeFilter.java,v 1.1 2004/04/02 18:19:39 jsurfer Exp $ */ public class CHashCodeFilter extends DefaultRegexCodeFormatter implements SourceCodeFormatter { private static final String KEYWORDS = "\\b(abstract|event|new|struct|as|explicit|null|switch|base|extern" + "object|this|bool|false|operator|throw|break|finally|out|true" + "byte|fixed|override|try|case|float|params|typeof|catch|for" + "private|uint|char|foreach|protected|ulong|checked|goto|public" + "unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort" + "continue|in|return|using|decimal|int|sbyte|virtual|default" + "interface|sealed|volatile|delegate|internal|short|void|do|is" + "sizeof|while|double|lock|stackalloc|else|long|static|enum" + "namespace|string)\\b"; // private static final String OBJECTS = // "\\b(Boolean|Byte|Character|Class|ClassLoader|Cloneable|Compiler|" // + "Double|Float|Integer|Long|Math|Number|Object|Process|" // + "Runnable|Runtime|SecurityManager|Short|String|StringBuffer|" // + "System|Thread|ThreadGroup|Void|boolean|char|byte|short|int|long|float|double)\\b"; private static final String QUOTES = "\"(([^\"\\\\]|\\.)*)\""; public CHashCodeFilter() { super(QUOTES, "<span class=\"java-quote\">\"$1\"</span>"); addRegex(KEYWORDS, "<span class=\"java-keyword\">$1</span>"); // addRegex(OBJECTS, "<span class=\"java-object\">$1</span>"); } public String getName() { return "chash"; } } |
|
From: Klaus H. <js...@us...> - 2004-04-02 18:31:37
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hmath/server/macro/code In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10804/WEB-INF/src/org/hmath/server/macro/code Log Message: Directory /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hmath/server/macro/code added to the repository |
|
From: Klaus H. <js...@us...> - 2004-04-02 18:31:37
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hmath/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10804/WEB-INF/src/org/hmath/server Log Message: Directory /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hmath/server added to the repository |
|
From: Klaus H. <js...@us...> - 2004-04-02 18:31:37
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hmath/server/macro In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10804/WEB-INF/src/org/hmath/server/macro Log Message: Directory /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hmath/server/macro added to the repository |
|
From: Klaus H. <js...@us...> - 2004-04-02 18:31:37
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hmath In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10804/WEB-INF/src/org/hmath Log Message: Directory /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hmath added to the repository |
|
From: Klaus H. <js...@us...> - 2004-04-02 18:29:25
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/macro/table In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10394/WEB-INF/src/org/hartmath/server/macro/table Added Files: STableBuilder.java Log Message: misc changes --- NEW FILE: STableBuilder.java --- /* * This file is part of "SnipSnap Radeox Rendering Engine". * * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel All Rights Reserved. * * Please visit http://radeox.org/ for updates and contact. * * --LICENSE NOTICE-- This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser * General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any * later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --LICENSE NOTICE-- */ package org.hartmath.server.macro.table; import java.util.ArrayList; import org.radeox.api.engine.context.RenderContext; /** * Built a table from a string * * @author stephan * @version $Id: STableBuilder.java,v 1.1 2004/04/02 18:17:10 jsurfer Exp $ */ public class STableBuilder { // public static Table build(String content, RenderContext context) { // Table table = new Table(context); // StringTokenizer tokenizer = new StringTokenizer(content, "|\n", true); // String lastToken = null; // while (tokenizer.hasMoreTokens()) { // String token = tokenizer.nextToken(); // if ("\n".equals(token)) { // // Handles "\n" - "|\n" // if (null == lastToken || "|".equals(lastToken)) { // table.addCell(" "); // } // table.newRow(); // } else if (!"|".equals(token)) { // table.addCell(token); // } else if (null == lastToken || "|".equals(lastToken)) { // // Handles "|" "||" // table.addCell(" "); // } // lastToken = token; // } // return table; // } public static Table build(String content, RenderContext context) { Table table = new Table(context); int index0 = content.indexOf('\n'); int index1 = -1; char currentChar = ' '; char lastChar = ' '; int startPosition = 0; int currentPosition = 0; ArrayList rowList = new ArrayList(); ArrayList columnPositionList = null; if (index0 >= 0) { rowList.add(content.substring(0,index0)); index1 = content.indexOf('\n', index0+1); if (index1 > (index0 + 1)) { char headerLine[] = new char[index1 - index0 - 1]; content.getChars(index0+1, index1, headerLine, 0); columnPositionList = new ArrayList(); boolean whiteSpace = true; try { while (true) { currentChar = headerLine[currentPosition++]; if (Character.isWhitespace(currentChar)) { whiteSpace = true; continue; } if (whiteSpace) { switch (currentChar) { case '=' : case '-' : columnPositionList.add(new Integer(currentPosition - 1)); whiteSpace = false; break; } } } } catch (IndexOutOfBoundsException e) { } columnPositionList.add(new Integer(headerLine.length)); } } if (columnPositionList == null || columnPositionList.size()==0) { return table; } index0 = index1+1; while ((index1 = content.indexOf('\n', index0))>0) { rowList.add(content.substring(index0,index1)); index0 = index1+1; } if (index0<content.length()) { rowList.add(content.substring(index0,content.length())); } for (int i = 0; i < rowList.size(); i++) { generateTable(table, (String)rowList.get(i), columnPositionList); table.newRow(); } // char firstRow[] = new char[index0]; // content.getChars(0, index0, firstRow, 0); // // // char[] source = new char[content.length() - index1 -1]; // content.getChars(index1+1, content.length(), source, 0); // generateTable(table, source, columnPositionList); return table; } private static void generateTable(Table table, String source, ArrayList list) { int j = ((Integer)list.get(0)).intValue(); int len = source.length(); for (int i = 1; i < list.size(); i++) { int k = ((Integer)list.get(i)).intValue(); if (j<len && k<=len) { table.addCell(source.substring(j,k)); } else if (j<len) { table.addCell(source.substring(j,len)); } else { table.addCell(""); } j = k; } } // private static void generateTable(Table table, char[] source, ArrayList list) { // char currentChar = ' '; // char lastChar = ' '; // int startPosition = 0; // int currentPosition = 0; // StringBuffer buffer = new StringBuffer(128); // // StringTokenizer tokenizer = new StringTokenizer(content, "|\n", true); // // String lastToken = null; // try { // while (true) { // currentChar = source[currentPosition++]; // switch (currentChar) { // case '\n' : // // Handles "\n" - "|\n" // if (lastChar == '|') { // table.addCell(" "); // } else { // table.addCell(buffer.toString()); // buffer = new StringBuffer(128); // } // table.newRow(); // break; // case '|' : // if (lastChar == '\\') { // buffer.insert(buffer.length() - 1, currentChar); // } else { // table.addCell(buffer.toString()); // buffer = new StringBuffer(128); // } // break; // case '{' : // if (lastChar == '\\') { // buffer.append(currentChar); // } else { // int tempPosition = currentPosition; // char tempChar = ' '; // try { // lastChar = currentChar; // buffer.append(currentChar); // while ((tempChar = source[tempPosition++]) != '}' || lastChar == '\\') { // buffer.append(tempChar); // lastChar = tempChar; // } // buffer.append(tempChar); // currentPosition = tempPosition; // } catch (IndexOutOfBoundsException e) { // table.addCell(buffer.toString()); // buffer = new StringBuffer(128); // currentPosition = tempPosition; // } // } // break; // default : // buffer.append(currentChar); // } // lastChar = currentChar; // } // } catch (IndexOutOfBoundsException e) { // // } // } } |
|
From: Klaus H. <js...@us...> - 2004-04-02 18:28:53
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/test/filter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10296/WEB-INF/src/org/hartmath/server/test/filter Modified Files: WikipediaFilterTest.java Log Message: misc changes Index: WikipediaFilterTest.java =================================================================== RCS file: /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/test/filter/WikipediaFilterTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WikipediaFilterTest.java 28 Mar 2004 17:25:48 -0000 1.2 --- WikipediaFilterTest.java 2 Apr 2004 18:16:42 -0000 1.3 *************** *** 39,42 **** --- 39,46 ---- public void testParser() { + assertEquals(" ", + filter.filter("==te\"\'?st==", context)); + assertEquals(" \ ", + filter.filter(" \\\\\\ ", context)); assertEquals("<h2><a name=\"test_head\"> test head </a></h2>", filter.filter("== test head ==", context)); |
|
From: Klaus H. <js...@us...> - 2004-04-02 18:28:42
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/macro In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10254/WEB-INF/src/org/hartmath/server/macro Added Files: STableMacro.java Log Message: misc changes --- NEW FILE: STableMacro.java --- /* * This file is part of "SnipSnap Radeox Rendering Engine". * * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel * All Rights Reserved. * * Please visit http://radeox.org/ for updates and contact. * * --LICENSE NOTICE-- * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * --LICENSE NOTICE-- */ package org.hartmath.server.macro; import java.io.IOException; import java.io.Writer; import org.hartmath.server.filter.INoParserBodyFilterMacro; import org.hartmath.server.macro.table.STableBuilder; import org.hartmath.server.macro.table.Table; import org.radeox.api.engine.context.RenderContext; import org.radeox.macro.BaseLocaleMacro; import org.radeox.macro.parameter.MacroParameter; /* * Macro for defining and displaying tables. The rows of the table are * devided by newlins and the columns are divided by pipe symbols "|". * The first line of the table is rendered as column headers. * {table} * A|B|C * 1|2|3 * {table} * * @author stephan * @team sonicteam * @version $Id: STableMacro.java,v 1.1 2004/04/02 18:16:25 jsurfer Exp $ */ public class STableMacro extends BaseLocaleMacro implements INoParserBodyFilterMacro { private String[] paramDescription = {}; public String[] getParamDescription() { return paramDescription; } public String getLocaleKey() { return "macro.stable"; } public void execute(Writer writer, MacroParameter params) throws IllegalArgumentException, IOException { String content = params.getContent(); if (null == content) throw new IllegalArgumentException("STableMacro: missing table content"); // content = content.trim(); int index = content.indexOf('\n'); if (index>=0) { content = content.substring(index+1); } RenderContext context = params.getContext(); Table table = STableBuilder.build(content, context); table.calc(); // calculate macros like =SUM(A1:A3) table.appendTo(writer); return; } } |
|
From: Klaus H. <js...@us...> - 2004-04-02 18:25:09
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/macro In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9661/WEB-INF/src/org/hartmath/server/macro Added Files: ImageMacro.java Log Message: misc changes --- NEW FILE: ImageMacro.java --- /* * This file is part of "SnipSnap Wiki/Weblog". * * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel All Rights Reserved. * * Please visit http://snipsnap.org/ for updates and contact. * * --LICENSE NOTICE-- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. --LICENSE NOTICE-- */ package org.hartmath.server.macro; import java.io.IOException; import java.io.Writer; import org.hartmath.server.filter.WikipediaFilter; import org.radeox.api.engine.ImageRenderEngine; import org.radeox.api.engine.RenderEngine; import org.radeox.util.Encoder; import org.snipsnap.app.Application; import org.snipsnap.config.Configuration; import org.snipsnap.render.macro.SnipMacro; import org.snipsnap.render.macro.parameter.SnipMacroParameter; import org.snipsnap.snip.Snip; import org.snipsnap.snip.SnipLink; import org.snipsnap.snip.SnipSpaceFactory; /* * Macro that displays images * * @author stephan @team sonicteam * * @version $Id: ImageMacro.java,v 1.1 2004/04/02 18:12:59 jsurfer Exp $ */ public class ImageMacro extends SnipMacro { Configuration config; public String getName() { return "image"; } public String getDescription() { return "Displays an image file."; } public ImageMacro() { config = Application.get().getConfiguration(); } public void execute(Writer writer, SnipMacroParameter params) throws IllegalArgumentException, IOException { RenderEngine engine = params.getContext().getRenderEngine(); if (engine instanceof ImageRenderEngine) { ImageRenderEngine imageEngine = (ImageRenderEngine) engine; if (params.getLength() > 0) { String img = params.get("img"); String alt = null, ext = null, align = null, target = null; boolean qualifiedParams = img != null; StringBuffer buff = new StringBuffer(); if (qualifiedParams) { alt = params.get("alt"); ext = params.get("ext"); align = params.get("align"); target = params.get("target"); } else { img = params.get(0); alt = params.get(1); ext = params.get(2); align = params.get(3); target = params.get(4); } String link = params.get("link"); if (link != null) { writer.write("<a href=\"" + Encoder.escape(link) + "\""); if (target != null) { writer.write("target=\"" + Encoder.escape(target) + "\""); } writer.write(">"); } String imageName = img; if (imageName.startsWith("http://")) { if (config.allow(Configuration.APP_PERM_EXTERNALIMAGES)) { appendExternalImage(writer, imageName, align); } } else { // Does the name contain an extension? int dotIndex = imageName.lastIndexOf('.'); if (dotIndex==(-1) && img != null && WikipediaFilter.createStaticImage(img, buff)) { writer.write(buff.toString()); } else { if (-1 != dotIndex) { ext = imageName.substring(dotIndex + 1); imageName = imageName.substring(0, dotIndex); } Snip snip = params.getSnipRenderContext().getSnip(); int slashIndex = imageName.lastIndexOf('/'); if (-1 != slashIndex) { String snipName = imageName.substring(0, slashIndex); snip = SnipSpaceFactory.getInstance().load(snipName); imageName = imageName.substring(slashIndex + 1); } if ("svg".equals(ext)) { // SVG cannot be used with <image> writer.write("<object data=\""); writer.write(snip.getNameEncoded() + "/" + imageName); writer.write("."); writer.write(ext); writer.write("\" type=\"image/svg+xml\" width=\"400\" height=\"400\"></object>"); } else { SnipLink.appendImage(writer, snip, imageName, alt, ext, align); } } } if (link != null) { writer.write("</a>"); } } } else { throw new IllegalArgumentException("Number of arguments does not match"); } return; } public static Writer appendExternalImage(Writer writer, String url, String position) throws IOException { writer.write("<img src=\""); writer.write(url); writer.write("\" "); if (position != null) { writer.write("class=\""); writer.write(position); writer.write("\" "); } writer.write("border=\"0\"/>"); return writer; } } |
|
From: Klaus H. <js...@us...> - 2004-04-02 18:24:42
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/macro In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9604/WEB-INF/src/org/hartmath/server/macro Modified Files: CodeMacro.java Log Message: misc changes Index: CodeMacro.java =================================================================== RCS file: /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/macro/CodeMacro.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CodeMacro.java 9 Mar 2004 20:13:05 -0000 1.1 --- CodeMacro.java 2 Apr 2004 18:12:31 -0000 1.2 *************** *** 123,127 **** SourceCodeFormatter formatter = null; ! if (params.getLength() == 0 || !formatters.containsKey(params.get("0"))) { formatter = (SourceCodeFormatter) formatters.get(initialContext.get(RenderContext.DEFAULT_FORMATTER)); --- 123,127 ---- SourceCodeFormatter formatter = null; ! String result; if (params.getLength() == 0 || !formatters.containsKey(params.get("0"))) { formatter = (SourceCodeFormatter) formatters.get(initialContext.get(RenderContext.DEFAULT_FORMATTER)); *************** *** 130,139 **** formatter = (SourceCodeFormatter) formatters.get("java"); } } else { formatter = (SourceCodeFormatter) formatters.get(params.get("0")); } - String result = formatter.filter(Encoder.escape( params.getContent() ), nullContext); - writer.write(start); writer.write(replace(result.trim())); --- 130,139 ---- formatter = (SourceCodeFormatter) formatters.get("java"); } + result = formatter.filter(Encoder.escape( params.getContent() ), nullContext); } else { formatter = (SourceCodeFormatter) formatters.get(params.get("0")); + result = formatter.filter( params.getContent() , nullContext); } writer.write(start); writer.write(replace(result.trim())); |
|
From: Klaus H. <js...@us...> - 2004-04-02 18:24:23
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/filter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9563/WEB-INF/src/org/hartmath/server/filter Modified Files: WikipediaFilter.java Log Message: misc changes Index: WikipediaFilter.java =================================================================== RCS file: /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/filter/WikipediaFilter.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** WikipediaFilter.java 28 Mar 2004 17:24:26 -0000 1.5 --- WikipediaFilter.java 2 Apr 2004 18:12:13 -0000 1.6 *************** *** 21,24 **** --- 21,25 ---- import java.io.IOException; import java.io.Writer; + import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; *************** *** 465,468 **** --- 466,470 ---- if ((fCurrentCharacter = fSource[fCurrentPosition++]) == '\\') { fResult.append(Encoder.toEntity(fCurrentCharacter)); + break; } else { fResult.append("<br />"); *************** *** 804,809 **** continue; } ! } ! if (levelMinus==2) { copyWhite(fWhiteStart, fWhiteStartPosition, 2); fWhiteStart = false; --- 806,811 ---- continue; } ! } ! if (levelMinus == 2) { copyWhite(fWhiteStart, fWhiteStartPosition, 2); fWhiteStart = false; *************** *** 846,849 **** --- 848,866 ---- } break; + + case '@' : // images @xml@ -> /static/rss-small.png + copyWhite(fWhiteStart, fWhiteStartPosition, 1); + fWhiteStart = false; + int atStart = fCurrentPosition; + if (readUntilChar('@')) { + String imageTag = new String(fSource, atStart, fCurrentPosition - atStart - 1); + if (imageTag != null) { + if (createStaticImage(imageTag, fResult)) { + continue; + } + } + } + fCurrentPosition = atStart; + break; case '&' : int ampersandStart = fCurrentPosition - 1; *************** *** 967,971 **** private void createExternalLink(String urlString) { ! // Does our engine know images? if (fWikiEngine instanceof ImageRenderEngine) { --- 984,988 ---- private void createExternalLink(String urlString) { ! // Does our engine know images? if (fWikiEngine instanceof ImageRenderEngine) { *************** *** 1111,1123 **** StringBuffer result = new StringBuffer(); char ch; for (int i = 0; i < head.length(); i++) { ch = head.charAt(i); ! switch (ch) { ! case ' ' : ! result.append('_'); ! break; ! default : ! result.append(ch); } } return result.toString(); --- 1128,1164 ---- StringBuffer result = new StringBuffer(); char ch; + result.append('a'); + // reduce Anchorstring for (int i = 0; i < head.length(); i++) { ch = head.charAt(i); ! if ('a' <= ch && 'z' >= ch) { ! result.append(ch); ! } else if ('A' <= ch && 'Z' >= ch) { ! result.append(ch); ! } else if ('0' <= ch && '9' >= ch) { ! result.append(ch); } + // switch (ch) { + // case ' ' : + // result.append('_'); + // break; + // case '<' : // special html escape character + // fResult.append(Encoder.toEntity('<')); + // break; + // case '>' : // special html escape character + // fResult.append(Encoder.toEntity('>')); + // break; + // case '&' : // special html escape character + // fResult.append(Encoder.toEntity('&')); + // break; + // case '\'' : // special html escape character + // fResult.append(Encoder.toEntity('\'')); + // break; + // case '\"' : // special html escape character + // fResult.append(Encoder.toEntity('\"')); + // break; + // default : + // result.append(ch); + // } } return result.toString(); *************** *** 1790,1793 **** --- 1831,1835 ---- final static HashSet ENTITY_SET = new HashSet(); + final static HashMap IMAGE_MAP = new HashMap(); private static Log log = LogFactory.getLog(WikipediaFilter.class); *************** *** 1797,1800 **** --- 1839,1845 ---- ENTITY_SET.add(ENTITY_STRINGS[i]); } + for (int i = 0; i < IMAGE_STRINGS.length; i += 2) { + IMAGE_MAP.put(IMAGE_STRINGS[i], IMAGE_STRINGS[i + 1]); + } OPEN_TAGS.put("br", HTML_BR_OPEN); OPEN_TAGS.put("hr", HTML_HR_OPEN); *************** *** 1882,1885 **** --- 1927,1939 ---- } + public static boolean createStaticImage(String imageTag, StringBuffer buff) { + String value = (String) IMAGE_MAP.get(imageTag); + if (value != null) { + buff.append(MessageFormat.format(value, ARGUMENTS)); + return true; + } + return false; + } + private MacroRepository macros; *************** *** 1892,1897 **** fWikiEngine = context.getRenderContext().getRenderEngine(); try { ! SnipMacroParameter params = (SnipMacroParameter) fContext.getMacroParameter(); ! fSnip = params.getSnipRenderContext().getSnip(); } catch (ClassCastException e) { e.printStackTrace(); --- 1946,1951 ---- fWikiEngine = context.getRenderContext().getRenderEngine(); try { ! SnipMacroParameter params = (SnipMacroParameter) fContext.getMacroParameter(); ! fSnip = params.getSnipRenderContext().getSnip(); } catch (ClassCastException e) { e.printStackTrace(); |
|
From: Klaus H. <js...@us...> - 2004-04-02 18:24:03
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/filter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9482/WEB-INF/src/org/hartmath/server/filter Modified Files: IWikipediaFilterConstants.java Log Message: misc changes Index: IWikipediaFilterConstants.java =================================================================== RCS file: /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/filter/IWikipediaFilterConstants.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IWikipediaFilterConstants.java 28 Mar 2004 17:23:50 -0000 1.1 --- IWikipediaFilterConstants.java 2 Apr 2004 18:11:50 -0000 1.2 *************** *** 2,5 **** --- 2,77 ---- public interface IWikipediaFilterConstants { + final static String[] ARGUMENTS = { "static/images" }; + final static String[] IMAGE_STRINGS = + { + "ep", + "<img src=\"{0}/ep.png\" border=\"0\" alt=\"EclipseProject.de\" />", + "xml", + "<img src=\"{0}/rss-small.png\" border=\"0\" alt=\"XML\" />", + "note", + "<img src=\"{0}/note.gif\" border=\"0\" alt=\"Note\" />", + "tip", + "<img src=\"{0}/tip.gif\" border=\"0\" alt=\"Tip\" />", + "tryit", + "<img src=\"{0}/tryit.gif\" border=\"0\" alt=\"Try it!\" />", + "1", + "<img src=\"{0}/tag_1.gif\" border=\"0\" alt=\"1.\" />", + "2", + "<img src=\"{0}/tag_2.gif\" border=\"0\" alt=\"2.\" />", + "3", + "<img src=\"{0}/tag_3.gif\" border=\"0\" alt=\"3.\" />", + "4", + "<img src=\"{0}/tag_4.gif\" border=\"0\" alt=\"4.\" />", + "5", + "<img src=\"{0}/tag_5.gif\" border=\"0\" alt=\"5.\" />", + "6", + "<img src=\"{0}/tag_6.gif\" border=\"0\" alt=\"6.\" />", + "7", + "<img src=\"{0}/tag_7.gif\" border=\"0\" alt=\"7.\" />", + "surprised", + "<img src=\"{0}/icon_surprised.gif\" alt=\"Surprised\" border=\"0\" />", + "lol", + "<img src=\"{0}/icon_lol.gif\" alt=\"Laughing\" border=\"0\" />", + "cry", + "<img src=\"{0}/icon_cry.gif\" alt=\"Crying or Very sad\" border=\"0\" />", + "sad", + "<img src=\"{0}/icon_sad.gif\" alt=\"Sad\" border=\"0\" />", + "smile", + "<img src=\"{0}/icon_smile.gif\" alt=\"Smile\" border=\"0\" />", + "biggrin", + "<img src=\"{0}/icon_biggrin.gif\" alt=\"Very Happy\" border=\"0\" />", + "eek", + "<img src=\"{0}/icon_eek.gif\" alt=\"Shocked\" border=\"0\" />", + "confused", + "<img src=\"{0}/icon_confused.gif\" alt=\"Confused\" border=\"0\" />", + "cool", + "<img src=\"{0}/icon_cool.gif\" alt=\"Cool\" border=\"0\" />", + "mad", + "<img src=\"{0}/icon_mad.gif\" alt=\"Mad\" border=\"0\" />", + "razz", + "<img src=\"{0}/icon_razz.gif\" alt=\"Razz\" border=\"0\" />", + "redface", + "<img src=\"{0}/icon_redface.gif\" alt=\"Embarassed\" border=\"0\" />", + "evil", + "<img src=\"{0}/icon_evil.gif\" alt=\"Evil or Very Mad\" border=\"0\" />", + "twisted", + "<img src=\"{0}/icon_twisted.gif\" alt=\"Twisted Evil\" border=\"0\" />", + "rolleyes", + "<img src=\"{0}/icon_rolleyes.gif\" alt=\"Rolling Eyes\" border=\"0\" />", + "wink", + "<img src=\"{0}/icon_wink.gif\" alt=\"Wink\" border=\"0\" />", + "exclaim", + "<img src=\"{0}/icon_exclaim.gif\" alt=\"Exclamation\" border=\"0\" />", + "question", + "<img src=\"{0}/icon_question.gif\" alt=\"Question\" border=\"0\" />", + "idea", + "<img src=\"{0}/icon_idea.gif\" alt=\"Idea\" border=\"0\" />", + "arrow", + "<img src=\"{0}/icon_arrow.gif\" alt=\"Arrow\" border=\"0\" />", + "mrgreen", + "<img src=\"{0}/icon_mrgreen.gif\" alt=\"Mr. Green\" border=\"0\" />", + "neutral", + "<img src=\"{0}/icon_neutral.gif\" alt=\"Neutral\" border=\"0\" />", + }; final static String[] ENTITY_STRINGS = { *************** *** 272,273 **** --- 344,347 ---- }; } + + |
|
From: Klaus H. <js...@us...> - 2004-03-28 19:27:28
|
Update of /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/reflection/convert In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15555/src/org/hartmath/tex2mml/reflection/convert Modified Files: Sqrt.java Log Message: misc changes Index: Sqrt.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/reflection/convert/Sqrt.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Sqrt.java 19 Mar 2004 20:19:03 -0000 1.1 --- Sqrt.java 28 Mar 2004 19:16:07 -0000 1.2 *************** *** 1,10 **** package org.hartmath.tex2mml.reflection.convert; import org.hartmath.tex2mml.IRowMMLConverter; import org.hartmath.tex2mml.Row; import org.hartmath.tex2mml.TeX2MathMLFactory; public class Sqrt implements IRowMMLConverter { ! /* * (non-Javadoc) --- 1,13 ---- package org.hartmath.tex2mml.reflection.convert; + import java.util.ArrayList; + import org.hartmath.tex2mml.IRowMMLConverter; + import org.hartmath.tex2mml.Node; import org.hartmath.tex2mml.Row; import org.hartmath.tex2mml.TeX2MathMLFactory; public class Sqrt implements IRowMMLConverter { ! /* * (non-Javadoc) *************** *** 15,23 **** public boolean convert(StringBuffer buf, Row row, TeX2MathMLFactory f) { if (row.size() == 1) { ! f.tagStart(buf, "msqrt"); ! row.get(0).convert2MML(f, buf); ! f.tagEnd(buf, "msqrt"); ! return true; ! } return false; } --- 18,35 ---- public boolean convert(StringBuffer buf, Row row, TeX2MathMLFactory f) { if (row.size() == 1) { ! ArrayList args = row.getArgs(); ! if (args != null && args.size() > 0) { ! f.tagStart(buf, "mroot"); ! row.get(0).convert2MML(f, buf); ! ((Node) args.get(0)).convert2MML(f, buf); // nth root ! f.tagEnd(buf, "mroot"); ! return true; ! } else { ! f.tagStart(buf, "msqrt"); ! row.get(0).convert2MML(f, buf); ! f.tagEnd(buf, "msqrt"); ! return true; ! } ! } return false; } |
|
From: Klaus H. <js...@us...> - 2004-03-28 19:27:12
|
Update of /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15457/src/org/hartmath/tex2mml Modified Files: TeXParser.java Log Message: misc changes Index: TeXParser.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/TeXParser.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TeXParser.java 21 Mar 2004 16:58:58 -0000 1.5 --- TeXParser.java 28 Mar 2004 19:15:50 -0000 1.6 *************** *** 1,4 **** --- 1,6 ---- package org.hartmath.tex2mml; + import java.util.ArrayList; + /** * *************** *** 11,15 **** MML_FACTORY.init(); } ! public TeXParser(String s) { super(s); --- 13,17 ---- MML_FACTORY.init(); } ! public TeXParser(String s) { super(s); *************** *** 39,42 **** --- 41,45 ---- private Node createOperationNode(String str, Row stack) { Node temp; + ArrayList args=null; Node c = MML_FACTORY.getSymbol(str); if (c == null) { *************** *** 48,51 **** --- 51,75 ---- return c; case TeX2MathMLFactory.UNARY : + if (token == TT_ARGUMENTS_OPEN) { + getNextToken(); + if (token == TT_ARGUMENTS_CLOSE) { + getNextToken(); + } else { + args = new ArrayList(); + while (true) { + temp = createNextNode(null); + if (temp!=null) { + args.add(temp); + } + if (token != TT_COMMA) { + break; + } + getNextToken(); + } + if (token == TT_ARGUMENTS_CLOSE) { + getNextToken(); + } + } + } temp = createNextNode(null); if (temp == null) { *************** *** 53,56 **** --- 77,83 ---- } list = MML_FACTORY.getRow(c.getTeXSymbol()); + if (args!=null) { + list.setArgs(args); + } list.add(temp); return list; *************** *** 80,84 **** list = MML_FACTORY.getRow(c.getTeXSymbol()); } ! if (stack!=null&&stack.size() > 0) { prev = stack.remove(stack.size() - 1); list.add(prev); --- 107,111 ---- list = MML_FACTORY.getRow(c.getTeXSymbol()); } ! if (stack != null && stack.size() > 0) { prev = stack.remove(stack.size() - 1); list.add(prev); *************** *** 179,182 **** --- 206,210 ---- return MML_FACTORY.getIdentifier(str); case TT_AMPERSAND : + case TT_COMMA: case TT_CHARACTER : str = fOperatorString; *************** *** 256,260 **** } } ! public void parse2CSS(StringBuffer buffer, boolean noTags) { Node node = createNode(); --- 284,288 ---- } } ! public void parse2CSS(StringBuffer buffer, boolean noTags) { Node node = createNode(); *************** *** 265,277 **** private Node getBegin() { ! if (token==TT_LIST_OPEN) { getNextToken(); } String str; ! if (token==TT_IDENTIFIER) { str = getIdentifier(); getNextToken(); ! if (! str.equals("array")) { ! if (token==TT_LIST_CLOSE) { getNextToken(); } --- 293,305 ---- private Node getBegin() { ! if (token == TT_LIST_OPEN) { getNextToken(); } String str; ! if (token == TT_IDENTIFIER) { str = getIdentifier(); getNextToken(); ! if (!str.equals("array")) { ! if (token == TT_LIST_CLOSE) { getNextToken(); } *************** *** 279,295 **** } } ! if (token==TT_LIST_CLOSE) { getNextToken(); } ! if (token==TT_LIST_OPEN) { getNextToken(); ! } int numColumns = 0; ! if (token==TT_IDENTIFIER) { str = getIdentifier(); numColumns = str.length(); getNextToken(); } ! if (token==TT_LIST_CLOSE) { getNextToken(); } --- 307,323 ---- } } ! if (token == TT_LIST_CLOSE) { getNextToken(); } ! if (token == TT_LIST_OPEN) { getNextToken(); ! } int numColumns = 0; ! if (token == TT_IDENTIFIER) { str = getIdentifier(); numColumns = str.length(); getNextToken(); } ! if (token == TT_LIST_CLOSE) { getNextToken(); } *************** *** 298,316 **** private void getEnd() { ! if (token==TT_LIST_OPEN) { getNextToken(); } ! if (token==TT_IDENTIFIER) { String str = getIdentifier(); getNextToken(); } ! if (token==TT_LIST_CLOSE) { getNextToken(); } ! } public Node createArray(int numColumns) { Row rowList; ! if (numColumns==1) { rowList = MML_FACTORY.getRow("vector"); } else { --- 326,344 ---- private void getEnd() { ! if (token == TT_LIST_OPEN) { getNextToken(); } ! if (token == TT_IDENTIFIER) { String str = getIdentifier(); getNextToken(); } ! if (token == TT_LIST_CLOSE) { getNextToken(); } ! } public Node createArray(int numColumns) { Row rowList; ! if (numColumns == 1) { rowList = MML_FACTORY.getRow("vector"); } else { *************** *** 322,326 **** Row colList; ! if (numColumns==1) { colList = MML_FACTORY.getRow("vectorrow"); } else { --- 350,354 ---- Row colList; ! if (numColumns == 1) { colList = MML_FACTORY.getRow("vectorrow"); } else { *************** *** 328,343 **** } while (token != TT_END && token != TT_EOF) { ! if (token!=TT_DOUBLE_BACKSLASH&&token!=TT_AMPERSAND) { node1 = createNextNode(null); if (node1 != null) { colList.add(node1); ! } } ! if (token==TT_AMPERSAND) { getNextToken(); } ! if (token==TT_DOUBLE_BACKSLASH) { rowList.add(colList); ! if (numColumns==1) { colList = MML_FACTORY.getRow("vectorrow"); } else { --- 356,371 ---- } while (token != TT_END && token != TT_EOF) { ! if (token != TT_DOUBLE_BACKSLASH && token != TT_AMPERSAND) { node1 = createNextNode(null); if (node1 != null) { colList.add(node1); ! } } ! if (token == TT_AMPERSAND) { getNextToken(); } ! if (token == TT_DOUBLE_BACKSLASH) { rowList.add(colList); ! if (numColumns == 1) { colList = MML_FACTORY.getRow("vectorrow"); } else { *************** *** 348,352 **** } if (token == TT_END) { ! if (colList.size()!=0) { rowList.add(colList); } --- 376,380 ---- } if (token == TT_END) { ! if (colList.size() != 0) { rowList.add(colList); } |
|
From: Klaus H. <js...@us...> - 2004-03-28 19:26:35
|
Update of /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15339/src/org/hartmath/tex2mml Modified Files: TeX2MathMLFactory.java Log Message: misc changes Index: TeX2MathMLFactory.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/TeX2MathMLFactory.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TeX2MathMLFactory.java 21 Mar 2004 16:58:58 -0000 1.6 --- TeX2MathMLFactory.java 28 Mar 2004 19:15:09 -0000 1.7 *************** *** 19,22 **** --- 19,26 ---- public final static String CSS_OPEN = "css_open"; public final static String CSS_CLOSE = "css_close"; + public final static String CSS_OPEN_SUP = "css_open_sup"; + public final static String CSS_CLOSE_SUP = "css_close_sup"; + public final static String CSS_OPEN_SUB = "css_open_sub"; + public final static String CSS_CLOSE_SUB = "css_close_sub"; public final static boolean USE_IDENTIFIERS = true; *************** *** 312,323 **** Map bigoplusAttr = new HashMap(); bigoplusAttr.put(UNDEROVER, "true"); ! bigoplusAttr.put(CSS_OPEN, "<Sum direct= \"+\">"); ! bigoplusAttr.put(CSS_CLOSE, "</Sum>"); Map bigotimesAttr = new HashMap(); bigotimesAttr.put(UNDEROVER, "true"); ! bigotimesAttr.put(CSS_OPEN, "<Prod direct=\"+\">"); ! bigotimesAttr.put(CSS_CLOSE, "</Prod>"); Map limAttr = new HashMap(); limAttr.put(UNDEROVER, "true"); Map bigcapAttr = new HashMap(); bigcapAttr.put(UNDEROVER, "true"); --- 316,329 ---- Map bigoplusAttr = new HashMap(); bigoplusAttr.put(UNDEROVER, "true"); ! bigoplusAttr.put(CSS_OPEN, "<SuM direct= \"+\">"); ! bigoplusAttr.put(CSS_CLOSE, "</SuM>"); Map bigotimesAttr = new HashMap(); bigotimesAttr.put(UNDEROVER, "true"); ! bigotimesAttr.put(CSS_OPEN, "<ProD direct=\"+\">"); ! bigotimesAttr.put(CSS_CLOSE, "</ProD>"); Map limAttr = new HashMap(); limAttr.put(UNDEROVER, "true"); + limAttr.put(CSS_OPEN_SUB, "<Lim>"); + limAttr.put(CSS_CLOSE_SUB, "</Lim>"); Map bigcapAttr = new HashMap(); bigcapAttr.put(UNDEROVER, "true"); |
|
From: Klaus H. <js...@us...> - 2004-03-28 19:26:15
|
Update of /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15271/src/org/hartmath/tex2mml Modified Files: Scanner.java Log Message: misc changes Index: Scanner.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/Scanner.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Scanner.java 19 Mar 2004 20:19:03 -0000 1.3 --- Scanner.java 28 Mar 2004 19:14:54 -0000 1.4 *************** *** 55,58 **** --- 55,59 ---- final static public int TT_DOUBLE_BACKSLASH = 56; final static public int TT_AMPERSAND = 57; + final static public int TT_BEGIN = 60; *************** *** 190,194 **** break; case ',' : ! token = TT_OPERATOR; fOperatorString = ","; break; --- 191,195 ---- break; case ',' : ! token = TT_COMMA; fOperatorString = ","; break; |
|
From: Klaus H. <js...@us...> - 2004-03-28 19:26:00
|
Update of /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15236/src/org/hartmath/tex2mml Modified Files: Row.java Log Message: misc changes Index: Row.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/Row.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Row.java 19 Mar 2004 20:19:03 -0000 1.3 --- Row.java 28 Mar 2004 19:14:39 -0000 1.4 *************** *** 15,18 **** --- 15,19 ---- ArrayList fList; + ArrayList fArgs; int fType; String fTeXSymbol; *************** *** 21,24 **** --- 22,26 ---- super("mrow", ""); fList = new ArrayList(); + fArgs = null; fType = TeX2MathMLFactory.MULTIPLE; fTeXSymbol = texSymbol; *************** *** 28,31 **** --- 30,34 ---- super(tag, ""); fList = new ArrayList(); + fArgs = null; fType = type; fTeXSymbol = texSymbol; *************** *** 380,382 **** --- 383,399 ---- } + /** + * @return Returns the args. + */ + public ArrayList getArgs() { + return fArgs; + } + + /** + * @param args The args to set. + */ + public void setArgs(ArrayList args) { + fArgs = args; + } + } \ No newline at end of file |
|
From: Klaus H. <js...@us...> - 2004-03-28 19:25:27
|
Update of /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2css/reflection/convert In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15153/src/org/hartmath/tex2css/reflection/convert Modified Files: Sup.java Log Message: misc changes Index: Sup.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2css/reflection/convert/Sup.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Sup.java 19 Mar 2004 20:19:03 -0000 1.2 --- Sup.java 28 Mar 2004 19:14:06 -0000 1.3 *************** *** 25,29 **** String cssOpen = nSub0.getAttribute(TeX2MathMLFactory.CSS_OPEN); String cssClose = nSub0.getAttribute(TeX2MathMLFactory.CSS_CLOSE); ! if (cssOpen!=null&&cssClose!=null) { buf.append(cssOpen); buf.append("<x>"); --- 25,29 ---- String cssOpen = nSub0.getAttribute(TeX2MathMLFactory.CSS_OPEN); String cssClose = nSub0.getAttribute(TeX2MathMLFactory.CSS_CLOSE); ! if (cssOpen != null && cssClose != null) { buf.append(cssOpen); buf.append("<x>"); *************** *** 35,43 **** return true; } ! // <D> ! // <x>overscript</x> ! // <g>Operator</g> ! // <x>underscript</x> ! // </D> buf.append("<D><x>"); row.get(1).convert2CSS(buf, true); --- 35,43 ---- return true; } ! // <D> ! // <x>overscript</x> ! // <g>Operator</g> ! // <x>underscript</x> ! // </D> buf.append("<D><x>"); row.get(1).convert2CSS(buf, true); *************** *** 52,65 **** } else { if (nSup0.containsAttribute(TeX2MathMLFactory.UNDEROVER)) { ! // <O> ! // <x>overscript</x> ! // <g>Operator</g> ! // </O> ! buf.append("<O><x>"); ! row.get(1).convert2CSS(buf, false); ! buf.append("</x><g>"); ! buf.append(nSup0.toString()); ! buf.append("</g></O>"); ! return true; } } --- 52,74 ---- } else { if (nSup0.containsAttribute(TeX2MathMLFactory.UNDEROVER)) { ! String cssOpen = nSup0.getAttribute(TeX2MathMLFactory.CSS_OPEN_SUP); ! String cssClose = nSup0.getAttribute(TeX2MathMLFactory.CSS_CLOSE_SUP); ! if (cssOpen != null && cssClose != null) { ! buf.append(cssOpen); ! row.get(1).convert2CSS(buf, true); ! buf.append(cssClose); ! return true; ! } else { ! // <O> ! // <x>overscript</x> ! // <g>Operator</g> ! // </O> ! buf.append("<O><x>"); ! row.get(1).convert2CSS(buf, false); ! buf.append("</x><g>"); ! buf.append(nSup0.toString()); ! buf.append("</g></O>"); ! return true; ! } } } |
|
From: Klaus H. <js...@us...> - 2004-03-28 18:51:49
|
Update of /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2css/reflection/convert In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8300/src/org/hartmath/tex2css/reflection/convert Modified Files: Sub.java Log Message: misc changes Index: Sub.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2css/reflection/convert/Sub.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Sub.java 19 Mar 2004 20:19:03 -0000 1.2 --- Sub.java 28 Mar 2004 18:40:28 -0000 1.3 *************** *** 24,28 **** String cssOpen = nSup0.getAttribute(TeX2MathMLFactory.CSS_OPEN); String cssClose = nSup0.getAttribute(TeX2MathMLFactory.CSS_CLOSE); ! if (cssOpen!=null&&cssClose!=null) { buf.append(cssOpen); buf.append("<x>"); --- 24,28 ---- String cssOpen = nSup0.getAttribute(TeX2MathMLFactory.CSS_OPEN); String cssClose = nSup0.getAttribute(TeX2MathMLFactory.CSS_CLOSE); ! if (cssOpen != null && cssClose != null) { buf.append(cssOpen); buf.append("<x>"); *************** *** 34,42 **** return true; } ! // <D> ! // <x>overscript</x> ! // <g>Operator</g> ! // <x>underscript</x> ! // </D> buf.append("<D><x>"); rowSup0.get(1).convert2CSS(buf, true); --- 34,42 ---- return true; } ! // <D> ! // <x>overscript</x> ! // <g>Operator</g> ! // <x>underscript</x> ! // </D> buf.append("<D><x>"); rowSup0.get(1).convert2CSS(buf, true); *************** *** 51,63 **** } else { if (nSub0.containsAttribute(TeX2MathMLFactory.UNDEROVER)) { ! if (!nSub0.getCSSOperator().equals("")) { ! // <U> ! // <g>Operator</g> ! // <x>underscript</x> ! // </U> buf.append("<U><g>"); buf.append(nSub0.toString()); buf.append("</g><x>"); ! row.get(1).convert2CSS(buf, false); buf.append("</x></U>"); --- 51,70 ---- } else { if (nSub0.containsAttribute(TeX2MathMLFactory.UNDEROVER)) { ! String cssOpen = nSub0.getAttribute(TeX2MathMLFactory.CSS_OPEN_SUB); ! String cssClose = nSub0.getAttribute(TeX2MathMLFactory.CSS_CLOSE_SUB); ! if (cssOpen != null && cssClose != null) { ! buf.append(cssOpen); ! row.get(1).convert2CSS(buf, true); ! buf.append(cssClose); ! return true; ! } else { ! // <U> ! // <g>Operator</g> ! // <x>underscript</x> ! // </U> buf.append("<U><g>"); buf.append(nSub0.toString()); buf.append("</g><x>"); ! row.get(1).convert2CSS(buf, false); buf.append("</x></U>"); |
|
From: Klaus H. <js...@us...> - 2004-03-28 18:49:02
|
Update of /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2css/reflection/convert In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7769/src/org/hartmath/tex2css/reflection/convert Modified Files: Sqrt.java Log Message: misc changes Index: Sqrt.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2css/reflection/convert/Sqrt.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Sqrt.java 21 Mar 2004 16:58:58 -0000 1.1 --- Sqrt.java 28 Mar 2004 18:37:40 -0000 1.2 *************** *** 1,9 **** package org.hartmath.tex2css.reflection.convert; import org.hartmath.tex2mml.IRowCSSConverter; import org.hartmath.tex2mml.Row; public class Sqrt implements IRowCSSConverter { ! /* * (non-Javadoc) --- 1,14 ---- package org.hartmath.tex2css.reflection.convert; + import java.util.ArrayList; + import org.hartmath.tex2mml.IRowCSSConverter; + import org.hartmath.tex2mml.Identifier; + import org.hartmath.tex2mml.Node; + import org.hartmath.tex2mml.Number; import org.hartmath.tex2mml.Row; public class Sqrt implements IRowCSSConverter { ! /* * (non-Javadoc) *************** *** 14,21 **** public boolean convert(StringBuffer buf, Row row) { if (row.size() == 1) { ! buf.append("("); ! row.get(0).convert2CSS(buf, false); ! buf.append(")<t>1/2</t>"); ! return true; } return false; --- 19,47 ---- public boolean convert(StringBuffer buf, Row row) { if (row.size() == 1) { ! ArrayList args = row.getArgs(); ! if (args != null && args.size() > 0) { ! if (! (row.get(0) instanceof Number || row.get(0) instanceof Identifier) ) { ! buf.append("("); ! } ! row.get(0).convert2CSS(buf, false); ! if (! (row.get(0) instanceof Number || row.get(0) instanceof Identifier) ) { ! buf.append(")"); ! } ! buf.append("<t>1/"); ! ((Node) args.get(0)).convert2CSS(buf, false); // nth root ! buf.append("</t>"); ! return true; ! } else { ! if (! (row.get(0) instanceof Number || row.get(0) instanceof Identifier) ) { ! buf.append("("); ! } ! row.get(0).convert2CSS(buf, false); ! if (! (row.get(0) instanceof Number || row.get(0) instanceof Identifier) ) { ! buf.append(")"); ! } ! buf.append("<t>1/2</t>"); ! return true; ! } ! } return false; |
|
From: Klaus H. <js...@us...> - 2004-03-28 17:37:08
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/test/filter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26107/WEB-INF/src/org/hartmath/server/test/filter Modified Files: WikipediaFilterTest.java Log Message: parser changes Index: WikipediaFilterTest.java =================================================================== RCS file: /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/test/filter/WikipediaFilterTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WikipediaFilterTest.java 9 Mar 2004 20:13:10 -0000 1.1 --- WikipediaFilterTest.java 28 Mar 2004 17:25:48 -0000 1.2 *************** *** 39,46 **** public void testParser() { ! assertEquals( ! "test <span class=\"nobr\"><a href=\"http://www.hmath.org\">http://www.hmath.org</a></span><br/><span class=\"nobr\"><a href=\"http://www.hmath.org\">http://www.hmath.org</a></span>", filter.filter("test http://www.hmath.org<br/>http://www.hmath.org", context)); - assertEquals("asssřzzz", --- 39,46 ---- public void testParser() { ! assertEquals("<h2><a name=\"test_head\"> test head </a></h2>", ! filter.filter("== test head ==", context)); ! assertEquals("test <span class=\"nobr\"><a href=\"http://www.hmath.org\">http://www.hmath.org</a></span><br/><span class=\"nobr\"><a href=\"http://www.hmath.org\">http://www.hmath.org</a></span>", filter.filter("test http://www.hmath.org<br/>http://www.hmath.org", context)); assertEquals("asssřzzz", |
|
From: Klaus H. <js...@us...> - 2004-03-28 17:36:29
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/macro In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25985/WEB-INF/src/org/hartmath/server/macro Added Files: AppletMacro.java Log Message: parser changes --- NEW FILE: AppletMacro.java --- package org.hartmath.server.macro; import java.io.IOException; import java.io.Writer; import org.radeox.macro.parameter.MacroParameter; import org.snipsnap.app.Application; /* * An applet macro. This Macro displays applets * * @author jsurfer */ public class AppletMacro extends HMathMacro { private String[] paramDescription = { }; public AppletMacro() { } public String getName() { return "applet"; } public String getDescription() { return "Insert an applet."; } public String[] getParamDescription() { return paramDescription; } public void execute(Writer writer, MacroParameter params) throws IllegalArgumentException, IOException { if (params.getLength() == 0) { String copy = params.getContent(); // de-escape tag delimiters copy = copy.replaceAll("<", "<"); copy = copy.replaceAll(">", ">"); copy = copy.replaceAll("\n", " "); copy = copy.replaceAll("\r", " "); writer.write( "<center><applet code=\""+params.getContent()+".class\" " + "codebase=\"" + Application.get().getConfiguration().getUrl("/lib/m14_jar") +"\" " + "width=\"600\" height=\"500\" " + "alt=\"Applet © Walter Fendt\" " + "archive=\""+params.getContent()+".jar, M14English.jar\" id=\"f1\">\n"); writer.write("</applet></center><center><a href=\"http://www.walter-fendt.de\">© Walter Fendt 1997 - 2004</a></center>"); // <applet code="Kugelvolumen.class" // archive="Kugelvolumen.jar, M14English.jar" // codebase="../m14_jar" width=480 height=400> // </applet> } else { throw new IllegalArgumentException("Number of arguments does not match"); } } } |
|
From: Klaus H. <js...@us...> - 2004-03-28 17:35:46
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/filter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25883/WEB-INF/src/org/hartmath/server/filter Modified Files: WikipediaFilter.java Log Message: parser changes Index: WikipediaFilter.java =================================================================== RCS file: /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/filter/WikipediaFilter.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** WikipediaFilter.java 21 Mar 2004 17:18:08 -0000 1.4 --- WikipediaFilter.java 28 Mar 2004 17:24:26 -0000 1.5 *************** *** 59,63 **** */ ! public class WikipediaFilter extends FilterSupport implements CacheFilter { private FilterContext fContext; private RenderEngine fWikiEngine; --- 59,63 ---- */ ! public class WikipediaFilter extends FilterSupport implements CacheFilter, IWikipediaFilterConstants { private FilterContext fContext; private RenderEngine fWikiEngine; *************** *** 804,807 **** --- 804,812 ---- continue; } + } + if (levelMinus==2) { + copyWhite(fWhiteStart, fWhiteStartPosition, 2); + fWhiteStart = false; + return TokenSTRIKETHROUGH; } break; *************** *** 837,850 **** String urlString = new String(fSource, urlStartPosition - 1, fCurrentPosition - urlStartPosition); fCurrentPosition--; ! // Does our engine know images? ! if (fWikiEngine instanceof ImageRenderEngine) { ! fResult.append(((ImageRenderEngine) fWikiEngine).getExternalImageLink()); ! } ! fResult.append("<span class=\"nobr\">"); ! fResult.append("<a href=\""); ! fResult.append(Encoder.escape(urlString)); ! fResult.append("\">"); ! fResult.append(Encoder.toEntity(urlString.charAt(0)) + urlString.substring(1)); ! fResult.append("</a></span>"); continue; } --- 842,846 ---- String urlString = new String(fSource, urlStartPosition - 1, fCurrentPosition - urlStartPosition); fCurrentPosition--; ! createExternalLink(urlString); continue; } *************** *** 970,973 **** --- 966,983 ---- } + private void createExternalLink(String urlString) { + + // Does our engine know images? + if (fWikiEngine instanceof ImageRenderEngine) { + fResult.append(((ImageRenderEngine) fWikiEngine).getExternalImageLink()); + } + fResult.append("<span class=\"nobr\">"); + fResult.append("<a href=\""); + fResult.append(Encoder.escape(urlString)); + fResult.append("\">"); + fResult.append(Encoder.toEntity(urlString.charAt(0)) + urlString.substring(1)); + fResult.append("</a></span>"); + } + private void handleTeXMath(String mathContent, boolean inlineExpression) { // TODO clean this up *************** *** 1005,1016 **** break; default : ! fResult.append(fResult); } } private void handleSnipLink(String name) { if (name != null) { // User probably wrote [http://radeox.org] instead of http://radeox.org ! if (name.indexOf("http://") != -1) { ! fResult.append("<div class=\"error\">Do not surround URLs with [...].</div>"); } else { // trim the name and unescape it --- 1015,1030 ---- break; default : ! copyWhite(mathContent); ! } } private void handleSnipLink(String name) { if (name != null) { + int index = name.indexOf("http://"); // User probably wrote [http://radeox.org] instead of http://radeox.org ! if (index != -1) { ! createExternalLink(name.substring(index)); ! // show error ! // fResult.append("<div class=\"error\">Do not surround URLs with [...].</div>"); } else { // trim the name and unescape it *************** *** 1697,1700 **** --- 1711,1719 ---- final static int TokenHTML_STRONG_OPEN = 242; + final static int TokenHTML_VAR_OPEN = 245; + final static int TokenHTML_VAR_CLOSE = 246; + final static int TokenHTML_CODE_OPEN = 247; + final static int TokenHTML_CODE_CLOSE = 248; + final static int TokenHTML_MATH_OPEN = 400; final static int TokenHTML_MATH_CLOSE = 401; *************** *** 1756,1760 **** final static Token HTML_SUP_OPEN = new OpenTagToken(TokenHTML_SUP_OPEN, "sup", "<sup class=\"sup\">"); ! final static Token HTML_MATH_OPEN = new OpenTagToken(TokenHTML_MATH_CLOSE, "math", "<math class=\"math\">"); final static Token HTML_MATH_CLOSE = new CloseTagToken(TokenHTML_MATH_OPEN, "math", "</math>"); --- 1775,1779 ---- final static Token HTML_SUP_OPEN = new OpenTagToken(TokenHTML_SUP_OPEN, "sup", "<sup class=\"sup\">"); ! final static Token HTML_MATH_OPEN = new OpenTagToken(TokenHTML_MATH_CLOSE, "math", "<math>"); final static Token HTML_MATH_CLOSE = new CloseTagToken(TokenHTML_MATH_OPEN, "math", "</math>"); *************** *** 1762,1893 **** final static Token LIST_UL_START = new Token(TokenLIST_UL_START); final static HashMap OPEN_TAGS = new HashMap(); final static HashMap CLOSE_TAGS = new HashMap(); final static HashSet ENTITY_SET = new HashSet(); - final static String[] ENTITY_STRINGS = - { - "amp", - "lt", - "gt", - "quot", - "nbsp", - "iexcl", - "cent", - "pound", - "curren", - "yen", - "trade", - "copy", - "reg", - "euro", - "brvbar", - "brkbar", - "sect", - "uml", - "die", - "ordf", - "laquo", - "not", - "shy", - "reg", - "macr", - "hibar", - "deg", - "plusmn", - "sup2", - "sup3", - "acute", - "micro", - "para", - "middot", - "cedil", - "sup1", - "ordm", - "raquo", - "frac14", - "frac12", - "frac34", - "iquest", - "Agrave", - "Aacute", - "Acirc", - "Atilde", - "Auml", - "Aring", - "AElig", - "Ccedil", - "Egrave", - "Eacute", - "Ecirc", - "Euml", - "lgrave", - "lacute", - "lcirc", - "luml", - "ETH", - "Ntilde", - "Ograve", - "Oacute", - "Ocirc", - "Otilde", - "Ouml", - "times", - "Oslash", - "Ugrave", - "Uacute", - "Ucirc", - "Uuml", - "Yacute", - "THORN", - "szlig", - "agrave", - "aacute", - "acirc", - "atilde", - "auml", - "aring", - "aelig", - "ccedil", - "egrave", - "eacute", - "ecirc", - "euml", - "igrave", - "iacute", - "icirc", - "iuml", - "eth", - "ntilde", - "ograve", - "oacute", - "ocirc", - "otilde", - "ouml", - "divide", - "oslash", - "ugrave", - "uacute", - "ucirc", - "uuml", - "yacute", - "thorn", - "yuml", - "iquest", - "iexcl", - "sect", - "para", - "dagger", - "Dagger", - "bull", - "mdash", - "lsaquo", - "rsaquo", - "laquo", - "raquo", - "lsquo", - "rsquo", - "ldquo", - "rdquo" }; private static Log log = LogFactory.getLog(WikipediaFilter.class); --- 1781,1793 ---- final static Token LIST_UL_START = new Token(TokenLIST_UL_START); + final static Token HTML_VAR_CLOSE = new CloseTagToken(TokenHTML_VAR_CLOSE, "var", "</var>"); + final static Token HTML_VAR_OPEN = new OpenTagToken(TokenHTML_VAR_OPEN, "var", "<var>"); + final static Token HTML_CODE_CLOSE = new CloseTagToken(TokenHTML_CODE_CLOSE, "code", "</code>"); + final static Token HTML_CODE_OPEN = new OpenTagToken(TokenHTML_CODE_OPEN, "code", "<code>"); + final static HashMap OPEN_TAGS = new HashMap(); final static HashMap CLOSE_TAGS = new HashMap(); final static HashSet ENTITY_SET = new HashSet(); private static Log log = LogFactory.getLog(WikipediaFilter.class); *************** *** 1932,1935 **** --- 1832,1840 ---- CLOSE_TAGS.put("blockquote", HTML_BLOCKQUOTE_CLOSE); + OPEN_TAGS.put("var", HTML_PRE_OPEN); + CLOSE_TAGS.put("var", HTML_PRE_CLOSE); + OPEN_TAGS.put("code", HTML_CODE_OPEN); + CLOSE_TAGS.put("code", HTML_CODE_CLOSE); + OPEN_TAGS.put("sub", HTML_SUB_OPEN); CLOSE_TAGS.put("sub", HTML_SUB_CLOSE); *************** *** 1986,1991 **** --- 1891,1900 ---- fContext = context; fWikiEngine = context.getRenderContext().getRenderEngine(); + try { SnipMacroParameter params = (SnipMacroParameter) fContext.getMacroParameter(); fSnip = params.getSnipRenderContext().getSnip(); + } catch (ClassCastException e) { + e.printStackTrace(); + } return filter(input, 0); } |
|
From: Klaus H. <js...@us...> - 2004-03-28 17:35:10
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/filter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25744/WEB-INF/src/org/hartmath/server/filter Added Files: IWikipediaFilterConstants.java Log Message: parser changes --- NEW FILE: IWikipediaFilterConstants.java --- package org.hartmath.server.filter; public interface IWikipediaFilterConstants { final static String[] ENTITY_STRINGS = { "amp", "lt", "gt", "quot", "nbsp", "iexcl", "cent", "pound", "curren", "yen", "trade", "copy", "reg", "euro", "brvbar", "brkbar", "sect", "uml", "die", "ordf", "laquo", "not", "shy", "reg", "macr", "hibar", "deg", "plusmn", "sup2", "sup3", "acute", "micro", "para", "middot", "cedil", "sup1", "ordm", "raquo", "frac14", "frac12", "frac34", "iquest", "Agrave", "Aacute", "Acirc", "Atilde", "Auml", "Aring", "AElig", "Ccedil", "Egrave", "Eacute", "Ecirc", "Euml", "lgrave", "lacute", "lcirc", "luml", "ETH", "Ntilde", "Ograve", "Oacute", "Ocirc", "Otilde", "Ouml", "times", "Oslash", "Ugrave", "Uacute", "Ucirc", "Uuml", "Yacute", "THORN", "szlig", "agrave", "aacute", "acirc", "atilde", "auml", "aring", "aelig", "ccedil", "egrave", "eacute", "ecirc", "euml", "igrave", "iacute", "icirc", "iuml", "eth", "ntilde", "ograve", "oacute", "ocirc", "otilde", "ouml", "divide", "oslash", "ugrave", "uacute", "ucirc", "uuml", "yacute", "thorn", "yuml", "iquest", "iexcl", "sect", "para", "mdash", "lsaquo", "rsaquo", "laquo", "raquo", "lsquo", "rsquo", "ldquo", "rdquo", "fnof", "Alpha", "Beta", "Gamma", "Delta", "Epsilon", "Zeta", "Eta", "Theta", "Iota", "Kappa", "Lambda", "Mu", "Nu", "Xi", "Omicron", "Pi", "Rho", "Sigma", "Tau", "Upsilon", "Phi", "Chi", "Psi", "Omega", "alpha", "beta", "gamma", "delta", "epsilon", "zeta", "eta", "theta", "iota", "kappa", "lambda", "mu", "nu", "xi", "omicron", "pi", "rho", "sigmaf", "sigma", "tau", "upsilon", "phi", "chi", "psi", "omega", "thetasym", "upsih", "piv", "bull", "hellip", "prime", "Prime", "oline", "frasl", "weierp", "image", "real", "trade", "alefsym", "larr", "uarr", "rarr", "darr", "harr", "crarr", "lArr", "dArr", "hArr", "forall", "part", "exist", "empty", "nabla", "isin", "notin", "ni", "prod", "sum", "minus", "lowast", "radic", "prop", "infin", "ang", "and", "or", "cap", "cup", "int", "there4", "sim", "cong", "asymp", "ne", "equiv", "le", "ge", "sub", "sup", "nsub", "sube", "supe", "oplus", "otimes", "perp", "sdot", "lceil", "rceil", "lfloor", "rfloor", "lang", "rang", "loz", "spades", "clubs", "hearts", "diams", "OElig", "oelig", "Scaron", "scaron", "Yuml", "circ", "tilde", "ensp", "emsp", "thinsp", "zwnj", "zwj", "lrm", "rlm", "ndash", "mdash", "lsquo", "rsquo", "sbquo", "ldquo", "rdquo", "bdquo", "dagger", "Dagger", "permil", }; } |