initial contribution
[phpeclipse.git] / archive / org.plog4u.wiki / src / org / plog4u / wiki / macro / code / XmlCodeFilter.java
1 /*
2  * This file is part of "SnipSnap Radeox Rendering Engine".
3  * 
4  * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel All Rights Reserved.
5  * 
6  * Please visit http://radeox.org/ for updates and contact.
7  * 
8  * --LICENSE NOTICE-- This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser
9  * General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any
10  * later version.
11  * 
12  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14  * 
15  * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free
16  * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --LICENSE NOTICE--
17  */
18 package org.plog4u.wiki.macro.code;
19
20 import org.radeox.macro.code.DefaultRegexCodeFormatter;
21 import org.radeox.macro.code.SourceCodeFormatter;
22
23 /*
24  * XmlCodeFilter colourizes Xml Code
25  * 
26  * @author stephan @team sonicteam
27  * 
28  * @version $Id: XmlCodeFilter.java,v 1.1 2004-12-24 11:11:13 axelcl Exp $
29  */
30
31 public class XmlCodeFilter extends DefaultRegexCodeFormatter implements SourceCodeFormatter {
32   private static final String KEYWORDS = "\\b(xsl:[^&\\s]*)\\b";
33
34   private static final String TAGS = "(</?.*?>)";
35
36   private static final String QUOTE = "\"(([^\"\\\\]|\\.)*)\"";
37
38   public XmlCodeFilter() {
39     super(QUOTE, "<b><font color=\"#2A00FF\">\"$1\"</font></b>");
40     addRegex(TAGS, "<b><font color=\"#7F9FBF\">$1</font></b>");
41     addRegex(KEYWORDS, "<b><font color=\"#750055\">$1</font></b>");
42   }
43
44   public String getName() {
45     return "xml";
46   }
47 }