1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.peaseplate.internal.template;
21
22 import java.io.IOException;
23 import java.io.Writer;
24
25 import org.peaseplate.Template;
26 import org.peaseplate.TemplateException;
27 import org.peaseplate.internal.BuildContext;
28 import org.peaseplate.internal.chunk.MacroBlock;
29
30 public class MacroReference {
31
32 private final Template template;
33 private final MacroBlock macroBlock;
34
35 public MacroReference(Template template, MacroBlock macroBlock) {
36 super();
37
38 this.template = template;
39 this.macroBlock = macroBlock;
40 }
41
42 public Template getTemplate() {
43 return template;
44 }
45
46 public MacroBlock getMacroBlock() {
47 return macroBlock;
48 }
49
50 public void render(BuildContext context, Writer writer) throws TemplateException, IOException {
51 context.pushMessages(template.getMessages(template.getEngine()));
52
53 macroBlock.renderBlock(context, writer);
54
55 context.popMessages();
56 }
57
58 }