Sha256: cb7c9f4a30136deb53c508468a709b6c3775152d5e43334afb565ebceadbc95b
Contents?: true
Size: 898 Bytes
Versions: 2
Compression:
Stored size: 898 Bytes
Contents
module HtmlToHaml module NonHtmlSelectorBlocks module TagTypeMatchers TAG_TYPE_REGEX = "type=('|\")(.*?)('|\")" TAG_TYPE_FROM_REGEX = '\2' private def opening_tag?(tag:, in_block:) !in_block && tag =~ /#{opening_tag_regex}/ end def opening_tag_regex "<#{self.class::HTML_TAG_NAME}.*?>" end def closing_tag?(tag:, in_block:) in_block && tag =~ /#{closing_tag_regex}/ end def closing_tag_regex "<\/#{self.class::HTML_TAG_NAME}>" end def tag_type(tag:) specified_tag_type(tag: tag) || self.class::DEFAULT_TAG_TYPE end def specified_tag_type(tag:) type_match = tag.match(/#{self.class::TAG_TYPE_REGEX}/) type_match && type_match.to_s.gsub(/#{self.class::TAG_TYPE_REGEX}/, self.class::TAG_TYPE_FROM_REGEX).split('/').last end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
html-to-haml-0.0.6 | lib/html_to_haml/tools/non_html_selector_blocks/tag_type_matchers.rb |
html-to-haml-0.0.5 | lib/html_to_haml/tools/non_html_selector_blocks/tag_type_matchers.rb |