first commit
Tento commit je obsažen v:
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
|
||||
*
|
||||
* 知启蒙标记语言(zhiqim_zml)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_zml.htm
|
||||
*
|
||||
* This file is part of [zhiqim_zml].
|
||||
*
|
||||
* [zhiqim_zml] 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 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* [zhiqim_zml] 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 [zhiqim_zml].
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.zhiqim.zml.test;
|
||||
|
||||
import org.zhiqim.kernel.extend.HashMapSO;
|
||||
import org.zhiqim.zml.Zmls;
|
||||
|
||||
public class TestContent
|
||||
{
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
String content = "这是一段文本内容,里面有一个值为:"
|
||||
+ "<#if isAbc>"
|
||||
+ "${abc}"
|
||||
+ "<#else>"
|
||||
+ "${def}"
|
||||
+ "</#if>。";
|
||||
|
||||
HashMapSO variableMap = new HashMapSO();
|
||||
variableMap.put("abc", "知启蒙");
|
||||
variableMap.put("def", "标识引擎");
|
||||
variableMap.put("isAbc", false);
|
||||
|
||||
String result = Zmls.parse(content, variableMap);
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
|
||||
*
|
||||
* 知启蒙标记语言(zhiqim_zml)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_zml.htm
|
||||
*
|
||||
* This file is part of [zhiqim_zml].
|
||||
*
|
||||
* [zhiqim_zml] 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 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* [zhiqim_zml] 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 [zhiqim_zml].
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.zhiqim.zml.test;
|
||||
|
||||
import org.zhiqim.kernel.extend.HashMapSO;
|
||||
import org.zhiqim.kernel.extend.MapSO;
|
||||
import org.zhiqim.kernel.util.Files;
|
||||
import org.zhiqim.zml.Zmls;
|
||||
|
||||
public class TestEcho
|
||||
{
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
String content = Files.readUTF8("./resource/echo.zml");
|
||||
|
||||
MapSO variableMap = new HashMapSO();
|
||||
variableMap.put("name", "测试表达式");
|
||||
variableMap.put("loginUrl", "/login.htm");
|
||||
variableMap.put("styleColor", "f-blue");
|
||||
variableMap.put("hasAutoComplete", false);
|
||||
|
||||
String result = Zmls.parse(content, variableMap);
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
|
||||
*
|
||||
* 知启蒙标记语言(zhiqim_zml)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_zml.htm
|
||||
*
|
||||
* This file is part of [zhiqim_zml].
|
||||
*
|
||||
* [zhiqim_zml] 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 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* [zhiqim_zml] 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 [zhiqim_zml].
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.zhiqim.zml.test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.zhiqim.kernel.extend.HashMapSO;
|
||||
import org.zhiqim.kernel.extend.MapSO;
|
||||
import org.zhiqim.kernel.util.Files;
|
||||
import org.zhiqim.zml.Zmls;
|
||||
|
||||
public class TestFor
|
||||
{
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
String content = Files.readUTF8("./resource/for.zml");
|
||||
|
||||
List<String> list1 = new ArrayList<>();
|
||||
list1.add("11aaa 1111 aaaaa");
|
||||
list1.add("22bbb 2222 bbbbb");
|
||||
|
||||
List<String> list2 = new ArrayList<>();
|
||||
list2.add("aa111 aaaa 11111");
|
||||
list2.add("bb222 bbbb 22222");
|
||||
|
||||
List<List<String>> list = new ArrayList<>();
|
||||
list.add(list1);
|
||||
list.add(list2);
|
||||
|
||||
MapSO variableMap = new HashMapSO();
|
||||
variableMap.put("name", "测试表达式");
|
||||
variableMap.put("loginUrl", "/login.htm");
|
||||
variableMap.put("styleColor", "z-blue");
|
||||
variableMap.put("hasAutoComplete", false);
|
||||
variableMap.put("list", list);
|
||||
variableMap.put("list1", list1);
|
||||
|
||||
|
||||
String result = Zmls.parse(content, variableMap);
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
|
||||
*
|
||||
* 知启蒙标记语言(zhiqim_zml)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_zml.htm
|
||||
*
|
||||
* This file is part of [zhiqim_zml].
|
||||
*
|
||||
* [zhiqim_zml] 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 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* [zhiqim_zml] 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 [zhiqim_zml].
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.zhiqim.zml.test;
|
||||
|
||||
import org.zhiqim.kernel.Global;
|
||||
import org.zhiqim.kernel.extend.ArrayListS;
|
||||
import org.zhiqim.kernel.extend.HashMapSO;
|
||||
import org.zhiqim.kernel.extend.MapSO;
|
||||
import org.zhiqim.kernel.util.Files;
|
||||
import org.zhiqim.zml.Zmls;
|
||||
|
||||
|
||||
public class TestFunction
|
||||
{
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
String content = Files.readUTF8("./resource/function.zml");
|
||||
|
||||
Global.addClass("FArrayListS", ArrayListS.class);
|
||||
|
||||
MapSO variableMap = new HashMapSO();
|
||||
variableMap.put("name", "测试表达式");
|
||||
variableMap.put("loginUrl", "/login.htm");
|
||||
variableMap.put("styleColor", "f-blue");
|
||||
variableMap.put("hasAutoComplete", false);
|
||||
|
||||
String result = Zmls.parse(content, variableMap);
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
|
||||
*
|
||||
* 知启蒙标记语言(zhiqim_zml)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_zml.htm
|
||||
*
|
||||
* This file is part of [zhiqim_zml].
|
||||
*
|
||||
* [zhiqim_zml] 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 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* [zhiqim_zml] 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 [zhiqim_zml].
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.zhiqim.zml.test;
|
||||
|
||||
import org.zhiqim.kernel.extend.HashMapSO;
|
||||
import org.zhiqim.kernel.extend.MapSO;
|
||||
import org.zhiqim.kernel.util.Files;
|
||||
import org.zhiqim.zml.Zmls;
|
||||
|
||||
public class TestIf
|
||||
{
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
String content = Files.readUTF8("./resource/if.zml");
|
||||
|
||||
MapSO variableMap = new HashMapSO();
|
||||
variableMap.put("name", "测试表达式");
|
||||
variableMap.put("loginUrl", "/login.htm");
|
||||
variableMap.put("styleColor", "f-blue");
|
||||
variableMap.put("hasAutoComplete", true);
|
||||
variableMap.put("status", 2);
|
||||
variableMap.put("type", 3);
|
||||
|
||||
|
||||
String result = Zmls.parse(content, variableMap);
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
|
||||
*
|
||||
* 知启蒙标记语言(zhiqim_zml)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_zml.htm
|
||||
*
|
||||
* This file is part of [zhiqim_zml].
|
||||
*
|
||||
* [zhiqim_zml] 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 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* [zhiqim_zml] 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 [zhiqim_zml].
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.zhiqim.zml.test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.zhiqim.kernel.extend.HashMapSO;
|
||||
import org.zhiqim.kernel.extend.MapSO;
|
||||
import org.zhiqim.kernel.util.Files;
|
||||
import org.zhiqim.zml.Zml;
|
||||
import org.zhiqim.zml.ZmlEngine;
|
||||
import org.zhiqim.zml.Zmls;
|
||||
|
||||
public class TestInclude
|
||||
{
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
ZmlEngine engine = new ZmlEngine();
|
||||
engine.setFileZmlLoader(new File("./resource"));
|
||||
|
||||
String content = Files.readUTF8("./resource/include.zml");
|
||||
|
||||
MapSO variableMap = new HashMapSO();
|
||||
variableMap.put("name", "测试表达式");
|
||||
variableMap.put("loginUrl", "/login.htm");
|
||||
variableMap.put("styleColor", "f-blue");
|
||||
variableMap.put("hasAutoComplete", true);
|
||||
variableMap.put("status", 2);
|
||||
variableMap.put("type", 3);
|
||||
|
||||
Zml template = new Zml(engine, content);
|
||||
String result = Zmls.parse(template, variableMap);
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
|
||||
*
|
||||
* 知启蒙标记语言(zhiqim_zml)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_zml.htm
|
||||
*
|
||||
* This file is part of [zhiqim_zml].
|
||||
*
|
||||
* [zhiqim_zml] 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 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* [zhiqim_zml] 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 [zhiqim_zml].
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.zhiqim.zml.test;
|
||||
|
||||
import org.zhiqim.kernel.extend.HashMapSO;
|
||||
import org.zhiqim.kernel.extend.MapSO;
|
||||
import org.zhiqim.kernel.util.Files;
|
||||
import org.zhiqim.zml.Zmls;
|
||||
|
||||
public class TestOne
|
||||
{
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
String content = Files.readUTF8("./resource/one.zml");
|
||||
|
||||
MapSO variableMap = new HashMapSO();
|
||||
variableMap.put("name", "测试表达式");
|
||||
variableMap.put("loginUrl", "/login.htm");
|
||||
variableMap.put("styleColor", "f-blue");
|
||||
variableMap.put("hasAutoComplete", false);
|
||||
|
||||
String result = Zmls.parse(content, variableMap);
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
|
||||
*
|
||||
* 知启蒙标记语言(zhiqim_zml)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_zml.htm
|
||||
*
|
||||
* This file is part of [zhiqim_zml].
|
||||
*
|
||||
* [zhiqim_zml] 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 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* [zhiqim_zml] 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 [zhiqim_zml].
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.zhiqim.zml.test;
|
||||
|
||||
import org.zhiqim.zml.Zmls;
|
||||
|
||||
public class TestTemplateFormat
|
||||
{
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
String content = "1111\r\n${a}\r\n${a}\r\n <a class=\"f-font \r\n <#function abcdeff()>\r\n\r\n f-add\r\n\r\n </#function>\r\n 2222";
|
||||
System.out.println(content);
|
||||
System.out.println("=================================================");
|
||||
String result = Zmls.parse(content, "aa", "aa");
|
||||
System.out.println(result);
|
||||
System.out.println("=================================================");
|
||||
String result2 = Zmls.parse(content, "a", "1");
|
||||
System.out.println("=================================================");
|
||||
System.out.println(result2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
|
||||
*
|
||||
* 知启蒙标记语言(zhiqim_zml)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_zml.htm
|
||||
*
|
||||
* This file is part of [zhiqim_zml].
|
||||
*
|
||||
* [zhiqim_zml] 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 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* [zhiqim_zml] 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 [zhiqim_zml].
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.zhiqim.zml.test;
|
||||
|
||||
import org.zhiqim.kernel.Zhiqim;
|
||||
import org.zhiqim.kernel.annotation.AnAlias;
|
||||
import org.zhiqim.kernel.annotation.AnNew;
|
||||
import org.zhiqim.kernel.extend.ArrayListS;
|
||||
import org.zhiqim.kernel.extend.HashMapSO;
|
||||
import org.zhiqim.kernel.extend.MapSO;
|
||||
import org.zhiqim.kernel.util.Files;
|
||||
import org.zhiqim.kernel.util.Systems;
|
||||
import org.zhiqim.zml.Zmls;
|
||||
|
||||
@AnAlias("TestVar")
|
||||
@AnNew
|
||||
public class TestVar
|
||||
{
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
Zhiqim.loadClassAliasName(Systems.getClassPathList());
|
||||
|
||||
String content = Files.readUTF8("./resource/var.zml");
|
||||
|
||||
MapSO variableMap = new HashMapSO();
|
||||
variableMap.put("ArrayListS", ArrayListS.class);
|
||||
|
||||
String result = Zmls.parse(content, variableMap);
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
|
||||
*
|
||||
* 知启蒙标记语言(zhiqim_zml)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_zml.htm
|
||||
*
|
||||
* This file is part of [zhiqim_zml].
|
||||
*
|
||||
* [zhiqim_zml] 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 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* [zhiqim_zml] 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 [zhiqim_zml].
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.zhiqim.zml.test;
|
||||
|
||||
import org.zhiqim.kernel.extend.HashMapSO;
|
||||
import org.zhiqim.kernel.extend.MapSO;
|
||||
import org.zhiqim.kernel.util.Files;
|
||||
import org.zhiqim.zml.Zmls;
|
||||
|
||||
public class TestXML
|
||||
{
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
String content = Files.readUTF8("./resource/xml.xml");
|
||||
|
||||
MapSO variableMap = new HashMapSO();
|
||||
variableMap.put("name", "知启蒙名称");
|
||||
variableMap.put("version", "V1.4.1");
|
||||
variableMap.put("port", "50080");
|
||||
|
||||
String result = Zmls.parse(content, variableMap);
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
Odkázat v novém úkolu
Zablokovat Uživatele