# builtin text filters # called before text_to_html # # use web filters for processing html/hypertext module TextFilter def comments_percent_style( content ) # remove comments # % comments # %begin multiline comment # %end multiline comment # track statistics comments_multi = 0 comments_single = 0 comments_end = 0 # remove multi-line comments content.gsub!(/^%begin.*?%end/m) do |match| comments_multi += 1 "" end # remove everyting starting w/ %end (note, can only be once in file) content.sub!(/^%end.*/m) do |match| comments_end += 1 "" end # hack/note: # note multi-line erb expressions/stmts might cause trouble # # %> gets escaped as special case (not treated as comment) # <% # whatever # %>