From 853b3da7f705938071156fadcddb668b7546e719 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Tue, 05 Jul 2022 17:37:55 +0800 Subject: [PATCH] fix 完成文件输出 --- src/main/java/com/xcong/farmer/cms/core/template/TemplateConfiguration.java | 33 ++------------------------------- 1 files changed, 2 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/xcong/farmer/cms/core/template/TemplateConfiguration.java b/src/main/java/com/xcong/farmer/cms/core/template/TemplateConfiguration.java index f6b078a..6fec7de 100644 --- a/src/main/java/com/xcong/farmer/cms/core/template/TemplateConfiguration.java +++ b/src/main/java/com/xcong/farmer/cms/core/template/TemplateConfiguration.java @@ -32,9 +32,9 @@ } this.templateLoader.data(map); - output(template(templateName)); + Template template = template(templateName); + template.output(this.outputPath); } - public Template template(String templateName) { return template(new File(path(this.templatePath) + templateName)); @@ -46,35 +46,6 @@ } return this.templateLoader.template(file); - } - -// 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(); - List<PartNode> partNodes = template.getPartNodes(); - StringBuilder sb = new StringBuilder(); - for (PartNode partNode : partNodes) { - sb.append(partNode.getHtml()); - } - document.body().empty().html(sb.toString()); - String outPath = path(this.outputPath); - - String html = document.html(); - try { - FileOutputStream outputStream = new FileOutputStream(outPath + template.getName()); - outputStream.write(html.getBytes()); - outputStream.close(); - } catch (IOException e) { - e.printStackTrace(); - } } private String path(String path) { -- Gitblit v1.9.1