From fa2f03d3e53f9c215ef2015a9e7b8496f20cdd93 Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Mon, 29 Sep 2008 23:34:14 +0000 Subject: [PATCH] remove converter git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@125 c66351dc-e62f-0410-b875-e3a5c0b9693f --- .../net.sf.webim.converter/.classpath | 7 - src/converter/net.sf.webim.converter/.project | 17 -- .../sf/webim/converter/ConverterHelper.java | 26 -- .../net/sf/webim/converter/JspConverter.java | 50 ---- .../net.sf.webim.converter/templates/conv.ltp | 20 -- .../net.sf.webim.converter/templates/php.ltp | 8 - .../net.sf.webim.converter/templates/x.ltp | 9 - .../net.sf.webim.converter/test/index.xml | 8 - src/converter/test.xml | 273 ------------------ src/converter/test.xml2 | 10 - 10 files changed, 428 deletions(-) delete mode 100644 src/converter/net.sf.webim.converter/.classpath delete mode 100644 src/converter/net.sf.webim.converter/.project delete mode 100644 src/converter/net.sf.webim.converter/src/net/sf/webim/converter/ConverterHelper.java delete mode 100644 src/converter/net.sf.webim.converter/src/net/sf/webim/converter/JspConverter.java delete mode 100644 src/converter/net.sf.webim.converter/templates/conv.ltp delete mode 100644 src/converter/net.sf.webim.converter/templates/php.ltp delete mode 100644 src/converter/net.sf.webim.converter/templates/x.ltp delete mode 100644 src/converter/net.sf.webim.converter/test/index.xml delete mode 100644 src/converter/test.xml delete mode 100644 src/converter/test.xml2 diff --git a/src/converter/net.sf.webim.converter/.classpath b/src/converter/net.sf.webim.converter/.classpath deleted file mode 100644 index f51b772d..00000000 --- a/src/converter/net.sf.webim.converter/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/converter/net.sf.webim.converter/.project b/src/converter/net.sf.webim.converter/.project deleted file mode 100644 index 7b02fd3f..00000000 --- a/src/converter/net.sf.webim.converter/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - net.sf.webim.converter - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/src/converter/net.sf.webim.converter/src/net/sf/webim/converter/ConverterHelper.java b/src/converter/net.sf.webim.converter/src/net/sf/webim/converter/ConverterHelper.java deleted file mode 100644 index 9d20f7aa..00000000 --- a/src/converter/net.sf.webim.converter/src/net/sf/webim/converter/ConverterHelper.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.sf.webim.converter; - -import net.sf.lapg.templates.api.impl.DefaultStaticMethods; -import net.sf.lapg.templates.model.xml.XmlData; -import net.sf.lapg.templates.model.xml.XmlNode; - - -public class ConverterHelper extends DefaultStaticMethods { - - - public boolean isNode(XmlNode element) { - return true; - } - - public boolean isNode(XmlData element) { - return false; - } - - public boolean containsColon(String s) { - return s.indexOf(":") >= 0; - } - - public String replaceColon(String s) { - return s.replace(':', '.'); - } -} diff --git a/src/converter/net.sf.webim.converter/src/net/sf/webim/converter/JspConverter.java b/src/converter/net.sf.webim.converter/src/net/sf/webim/converter/JspConverter.java deleted file mode 100644 index 8bfeecd9..00000000 --- a/src/converter/net.sf.webim.converter/src/net/sf/webim/converter/JspConverter.java +++ /dev/null @@ -1,50 +0,0 @@ -package net.sf.webim.converter; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.Reader; - -import net.sf.lapg.templates.api.EvaluationContext; -import net.sf.lapg.templates.api.impl.FolderTemplateLoader; -import net.sf.lapg.templates.api.impl.TemplateEnvironment; -import net.sf.lapg.templates.model.xml.XmlModel; -import net.sf.lapg.templates.model.xml.XmlNavigationFactory; -import net.sf.lapg.templates.model.xml.XmlNode; - -public class JspConverter { - - public static void main(String[] args) { - String toProcess = getFileContents("test/index.xml"); - - XmlNode root = XmlModel.load(toProcess); - - ConverterHelper helper = new ConverterHelper(); - TemplateEnvironment env = new TemplateEnvironment( - new XmlNavigationFactory(), - new FolderTemplateLoader(new File("templates"))); - EvaluationContext context = new EvaluationContext(root.getChildren()); - context.setVariable("helper", helper); - System.out.println(env.executeTemplate("conv.convertList", context, null)); - } - - private static String getFileContents(String file) { - StringBuffer contents = new StringBuffer(); - char[] buffer = new char[2048]; - int count; - try { - Reader in = new InputStreamReader(new FileInputStream(file)); - try { - while ((count = in.read(buffer)) > 0) { - contents.append(buffer, 0, count); - } - } finally { - in.close(); - } - } catch (IOException ioe) { - return null; - } - return contents.toString(); - } -} diff --git a/src/converter/net.sf.webim.converter/templates/conv.ltp b/src/converter/net.sf.webim.converter/templates/conv.ltp deleted file mode 100644 index 27a26dfa..00000000 --- a/src/converter/net.sf.webim.converter/templates/conv.ltp +++ /dev/null @@ -1,20 +0,0 @@ - -${template convert-} -${if helper.isNode(this)-} -${if helper.containsColon(tagName)-} -${call(`helper.replaceColon(tagName)`) this-} -${else-} -${this.getNodeDeclaration()-} -${call(convertList) children-} -${end-} -${else-} -${this-} -${end-} -${end} - - -${template convertList-} -${foreach child in this-} -${call(convert) child-} -${end-} -${end} \ No newline at end of file diff --git a/src/converter/net.sf.webim.converter/templates/php.ltp b/src/converter/net.sf.webim.converter/templates/php.ltp deleted file mode 100644 index e21523d0..00000000 --- a/src/converter/net.sf.webim.converter/templates/php.ltp +++ /dev/null @@ -1,8 +0,0 @@ - -${template hidden-} -${if attrs.value-} - -${else-} - -${end-} -${end} diff --git a/src/converter/net.sf.webim.converter/templates/x.ltp b/src/converter/net.sf.webim.converter/templates/x.ltp deleted file mode 100644 index 6f6edfd0..00000000 --- a/src/converter/net.sf.webim.converter/templates/x.ltp +++ /dev/null @@ -1,9 +0,0 @@ - -${template html-} - - -${call(conv.convertList)children-} - -${end} - - diff --git a/src/converter/net.sf.webim.converter/test/index.xml b/src/converter/net.sf.webim.converter/test/index.xml deleted file mode 100644 index c6ea5897..00000000 --- a/src/converter/net.sf.webim.converter/test/index.xml +++ /dev/null @@ -1,8 +0,0 @@ - - -A - - -B - - \ No newline at end of file diff --git a/src/converter/test.xml b/src/converter/test.xml deleted file mode 100644 index 58bcf5a0..00000000 --- a/src/converter/test.xml +++ /dev/null @@ -1,273 +0,0 @@ -<%@ page contentType="text/html; charset=utf-8" errorPage="/errors/error_page.jsp" %> -<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> -<%@ taglib prefix="tiles" uri="/tags/struts-tiles"%> -<%@ taglib prefix="html" uri="/tags/struts-html"%> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -<%@ taglib prefix="is" uri="imcenter.i_services.ru.tags"%> -<%@ taglib prefix="bean" uri="/tags/struts-bean"%> - - - - - - -<bean:message key="<%=titleKey%>" /> - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
- - - - - - - - - - - - - -
${ct.company.name}
-
- - - - - - - - -
- - - - - - - - - - -
- - - - -
-
- -
- - - - - - - - - - - - - - - - - -<%--jsponly--%> - - - - -<%--end--%> - -<%--jsponly--%> - -<%--end--%> - - -
-
-
-
- - - - - - -
-
-
- - - - -
-
-
- - - - - - - - - - -
- -
-
-
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- -
-
- - - - - - - - - - - - -
- -
-
- -
- - - - - - -
- - - -<%-- - - --%> -<%--jsponly--%> - -<%--end--%> - -
- Switch to Level2 - - -
-
- - - - - - - - - -
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/src/converter/test.xml2 b/src/converter/test.xml2 deleted file mode 100644 index 19c6d428..00000000 --- a/src/converter/test.xml2 +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - -Wow - - \ No newline at end of file