From f17a3980d0dfec11c1db69503e930fa20b6684f8 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Thu, 07 Jul 2022 11:17:39 +0800 Subject: [PATCH] 20220606 --- src/main/java/com/xcong/farmer/cms/core/node/AttrNode.java | 27 +++++++++------------------ 1 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/xcong/farmer/cms/core/node/AttrNode.java b/src/main/java/com/xcong/farmer/cms/core/node/AttrNode.java index ce47824..b11eae9 100644 --- a/src/main/java/com/xcong/farmer/cms/core/node/AttrNode.java +++ b/src/main/java/com/xcong/farmer/cms/core/node/AttrNode.java @@ -52,22 +52,6 @@ this.parserData = parserData; } - public static void main(String[] args) { -// String data = "{id=[1,2,3], page=1, limit=5, field=art}"; -// Articles articles = new AttrNode().parserTag(data, Articles.class); - -// String value = "{id=${col.id}, page=1, limit=5, field=art}"; -// String pattern = "(?<=\\$\\{)[\\s\\S]*?(?=\\})"; -// Matcher matcher = Pattern.compile(pattern).matcher(value); -// while (matcher.find()) { -// String group = matcher.group(); -// System.out.println(1); -// } - - - System.out.println(1); - } - private boolean isNeedEmpty() { Elements children = this.element.children(); if (CollUtil.isNotEmpty(children)) { @@ -112,6 +96,7 @@ i++; try { + Template.TAGS.add(tagsEnum.getName()); // {id=${col.id}, page=1, limit=5, field=art} ${col.id} 形式需先设置值 String tagValue = attributes.get(tagsEnum.getName()); tagValue = attrValueFormat(tagValue); @@ -139,6 +124,10 @@ public void runDataInject() { Attributes attributes = this.element.attributes(); for (Attribute attribute : attributes) { + if (attribute.getKey().startsWith("\\$")) { + Template.TAGS.add(attribute.getKey()); + } + String key = attribute.getKey().replaceAll("\\$", ""); String value = attribute.getValue(); @@ -158,9 +147,7 @@ this.element.removeAttr("class"); this.element.attr("class", evaluate); } else if (value.contains( "${")) { - String result = attrValueFormat(value); - System.out.println(result); if ("text".equals(key)) { this.element.text(result); } else { @@ -258,4 +245,8 @@ public void systemData(Map<String, Object> systemData) { this.systemData = systemData; } + + public Object getSystemDataValue(String key) { + return this.systemData.get(key); + } } -- Gitblit v1.9.1