Skip to content

Commit f08cdc4

Browse files
committed
Fix to_code
1 parent b385c34 commit f08cdc4

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/crustache/syntax.cr

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module Crustache::Syntax
3535
node.to_code(io)
3636
flag = true
3737
end
38-
io << "] of Crustache::Syntax::Node)"
38+
io << "] of ::Crustache::Syntax::Node)"
3939
end
4040
end
4141

@@ -55,6 +55,23 @@ module Crustache::Syntax
5555
{% for type in %w(Section Invert) %}
5656
class {{ type.id }} < Template
5757
include Tag
58+
59+
def initialize(@value : String, @content : [] of Node); end
60+
61+
macro def to_code(io) : Nil
62+
io << "::\{{ @type.name.id }}.new("
63+
@value.inspect io
64+
io << ", ["
65+
flag = false
66+
@content.each do |node|
67+
io << ", " if flag
68+
node.to_code(io)
69+
flag = true
70+
end
71+
io << "] of ::Crustache::Syntax::Node)"
72+
io << ")"
73+
nil
74+
end
5875
end
5976
{% end %}
6077

0 commit comments

Comments
 (0)