File was renamed from src/main/java/com/xcong/farmer/cms/cms/node/PartNode.java |
| | |
| | | package com.xcong.farmer.cms.cms.node; |
| | | package com.xcong.farmer.cms.core.node; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.xcong.farmer.cms.cms.template.Configuration; |
| | | import com.xcong.farmer.cms.core.template.Configuration; |
| | | import org.jsoup.nodes.Element; |
| | | |
| | | import java.util.HashMap; |
| | |
| | | private Element element; |
| | | private Element originalElement; |
| | | private String html; |
| | | private Map<String, Object> system; |
| | | |
| | | public PartNode(Element element) { |
| | | public PartNode(Element element, Map<String, Object> data) { |
| | | this.element = element.clone(); |
| | | this.originalElement = element; |
| | | this.system = data; |
| | | } |
| | | |
| | | public void parser() { |
| | |
| | | |
| | | public String parser(Element element, Map<String, Object> tagDataMap) { |
| | | AttrNode attrNode = new AttrNode(element, tagDataMap); |
| | | attrNode.systemData(this.system); |
| | | attrNode.parser(); |
| | | // attrNode.runDataInject(); |
| | | |
| | |
| | | |
| | | if (parseData == null) { |
| | | // 特殊处理。 如果有子节点标签@child,但数据中没有子节点数据,则将该子节点直接删除即直接返回空字符串 |
| | | if (!"@child".equals(attrNode.getTag())) { |
| | | if (attrNode.processContinue()) { |
| | | for (Element children : element.children()) { |
| | | String html = parser(children, tagDataMap); |
| | | result.append(html); |