Sha256: 83b1d8945684f8921130100e9cafb55445afd918592e86916f7118c6083cef6a
Contents?: true
Size: 795 Bytes
Versions: 7
Compression:
Stored size: 795 Bytes
Contents
require 'hamlit/concerns/error' require 'hamlit/concerns/indentable' module Hamlit module Parsers module Comment include Concerns::Indentable def parse_comment(scanner) assert_scan!(scanner, /\//) ast = [:html, :comment] text = (scanner.scan(/.+/) || '').strip if text.empty? content = with_indented { parse_lines } return ast << [:multi, [:static, "\n"], *content] elsif !text.match(/\[.*\]/) if has_block? syntax_error!('Illegal nesting: nesting within a tag that already has content is illegal.') end return ast << [:static, " #{text} "] end content = with_indented { parse_lines } [:haml, :comment, text, content] end end end end
Version data entries
7 entries across 7 versions & 1 rubygems