File was renamed from src/main/java/com/xcong/farmer/cms/cms/template/TemplateConfiguration.java |
| | |
| | | package com.xcong.farmer.cms.cms.template; |
| | | package com.xcong.farmer.cms.core.template; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.xcong.farmer.cms.cms.node.PartNode; |
| | | import com.xcong.farmer.cms.cms.tag.TagsEnum; |
| | | import com.xcong.farmer.cms.core.node.PartNode; |
| | | import com.xcong.farmer.cms.core.tag.TagsEnum; |
| | | import org.jsoup.nodes.Document; |
| | | |
| | | import java.io.File; |
| | |
| | | this.templateLoader = templateLoader; |
| | | } |
| | | |
| | | public void process() { |
| | | public void process(Map<String, Object> map, String templateName) { |
| | | if (this.templateLoader == null) { |
| | | throw new RuntimeException("TemplateLoader do not able to be null"); |
| | | } |
| | | |
| | | List<Template> templates = templateLoader.templates(); |
| | | |
| | | if (CollUtil.isEmpty(templates)) { |
| | | return; |
| | | } |
| | | |
| | | for (Template template : templates) { |
| | | output(template); |
| | | } |
| | | this.templateLoader.data(map); |
| | | output(template(templateName)); |
| | | } |
| | | |
| | | public List<Template> templates() { |
| | | return this.templateLoader.templates(); |
| | | } |
| | | |
| | | public Template template(String templateName) { |
| | | return template(new File(path(this.templatePath) + templateName)); |
| | |
| | | return this.templateLoader.template(file); |
| | | } |
| | | |
| | | public void columnProcess(Long id, String templateName) { |
| | | Template template = template(templateName); |
| | | } |
| | | |
| | | public void columnProcess(String code, String templateName) { |
| | | |
| | | } |
| | | |
| | | public void articleProcess(Long id, String templateName) { |
| | | Map<String, Map<String, Object>> map = new HashMap<>(); |
| | | |
| | | Map<String, Object> data = new HashMap<>(); |
| | | data.put("id", id); |
| | | map.put(TagsEnum.ARTICLE.getName(), data); |
| | | } |
| | | // public void columnProcess(Map<String, Object> data, String templateName) { |
| | | // process; |
| | | // } |
| | | // |
| | | // |
| | | // public void articleProcess(Map<String, Object> data, String templateName) { |
| | | // process(data, templateName); |
| | | // } |
| | | |
| | | public void output(Template template) { |
| | | Document document = template.getDocument(); |