@@ -46,6 +46,10 @@ def visit_call_node(node)
4646 return compile_plain_helper ( node )
4747 elsif fragment_helper? ( node )
4848 return compile_fragment_helper ( node )
49+ elsif comment_helper? ( node )
50+ return compile_comment_helper ( node )
51+ elsif raw_helper? ( node )
52+ return compile_raw_helper ( node )
4953 end
5054 end
5155
@@ -194,6 +198,19 @@ def compile_fragment_helper_block(node)
194198 )
195199 end
196200
201+ def compile_comment_helper ( node )
202+ [
203+ buffer ( "<!-- " ) ,
204+ visit_phlex_block ( node . block ) ,
205+ buffer ( " -->" ) ,
206+ ]
207+ end
208+
209+ def compile_raw_helper ( node )
210+ @current_buffer = nil
211+ node
212+ end
213+
197214 private def ensure_new_line
198215 proc ( &:ensure_new_line )
199216 end
@@ -293,6 +310,14 @@ def compile_fragment_helper_block(node)
293310 node . name == :fragment && own_method_without_scope? ( node )
294311 end
295312
313+ private def comment_helper? ( node )
314+ node . name == :comment && own_method_without_scope? ( node )
315+ end
316+
317+ private def raw_helper? ( node )
318+ node . name == :raw && own_method_without_scope? ( node )
319+ end
320+
296321 ALLOWED_OWNERS = [ Phlex ::SGML , Phlex ::HTML , Phlex ::SVG ]
297322 private def own_method_without_scope? ( node )
298323 ALLOWED_OWNERS . include? ( @component . instance_method ( node . name ) . owner )
0 commit comments