[hmath-commits] org.hmath.server/WEB-INF/src/org/hartmath/server/macro CodeMacro.java,1.2,1.3
Status: Pre-Alpha
Brought to you by:
jsurfer
|
From: Klaus H. <js...@us...> - 2004-04-14 20:06:33
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/macro In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22664/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.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CodeMacro.java 2 Apr 2004 18:12:31 -0000 1.2 --- CodeMacro.java 14 Apr 2004 20:06:24 -0000 1.3 *************** *** 1,25 **** /* * 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-- */ --- 1,18 ---- /* * 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-- */ *************** *** 37,40 **** --- 30,34 ---- import org.apache.commons.logging.LogFactory; import org.hartmath.server.filter.INoParserBodyFilterMacro; + import org.hartmath.server.macro.code.AbstractCPPBasedCodeFilter; import org.radeox.api.engine.context.InitialRenderContext; import org.radeox.api.engine.context.RenderContext; *************** *** 48,57 **** /* ! * Macro for displaying programming language source code. CodeMacro knows about ! * different source code formatters which can be plugged into radeox to ! * display more languages. CodeMacro displays Java, Ruby or SQL code. ! * ! * @author stephan ! * @team sonicteam * @version $Id$ */ --- 42,50 ---- /* ! * Macro for displaying programming language source code. CodeMacro knows about different source code formatters which can be ! * plugged into radeox to display more languages. CodeMacro displays Java, Ruby or SQL code. ! * ! * @author stephan @team sonicteam ! * * @version $Id$ */ *************** *** 66,71 **** private String end; ! private String[] paramDescription = ! {"?1: syntax highlighter to use, defaults to java"}; public String[] getParamDescription() { --- 59,63 ---- private String end; ! private String[] paramDescription = { "?1: syntax highlighter to use, defaults to java" }; public String[] getParamDescription() { *************** *** 103,107 **** } else { formatters.put(name, formatter); ! log.debug("Loaded formatter: " + formatter.getClass() + " (" + name +")"); } } catch (Exception e) { --- 95,99 ---- } else { formatters.put(name, formatter); ! log.debug("Loaded formatter: " + formatter.getClass() + " (" + name + ")"); } } catch (Exception e) { *************** *** 119,124 **** } ! public void execute(Writer writer, MacroParameter params) ! throws IllegalArgumentException, IOException { SourceCodeFormatter formatter = null; --- 111,115 ---- } ! public void execute(Writer writer, MacroParameter params) throws IllegalArgumentException, IOException { SourceCodeFormatter formatter = null; *************** *** 129,137 **** System.err.println("Formatter not found."); 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); } --- 120,132 ---- System.err.println("Formatter not found."); formatter = (SourceCodeFormatter) formatters.get("java"); + result = formatter.filter(params.getContent(), nullContext); + } else if (formatter instanceof AbstractCPPBasedCodeFilter) { + result = formatter.filter(params.getContent(), nullContext); + } else { + result = formatter.filter(Encoder.escape(params.getContent()), nullContext); } } else { formatter = (SourceCodeFormatter) formatters.get(params.get("0")); ! result = formatter.filter(params.getContent(), nullContext); } |