Matches a tag against the possible range tag candidates, and if no match
 is found, returns a dictionary element representing an unknown tag.

 @param [String] tag the element tag
 @return [DictionaryElement] a matched range element or an unknown element
503158
def unknown_or_range_element(tag)
      element = nil
      range_candidates(tag).each do |range_candidate_tag|
        if de = @elements[range_candidate_tag]
          element = DictionaryElement.new(tag, de.name, de.vrs, de.vm, de.retired)
          break
        end
      end
      # If nothing was matched, we are facing an unknown (but not private) tag:
      element ||= DictionaryElement.new(tag, 'Unknown', ['UN'], '1', '')
    end
799130
def get_tags(self, tagtype):
        '''  '''
        return [t for t in self.__tags if t.tagtype == tagtype]
828630
def SplitTag(self, tag):
      
      idx = tag.find(NS_SEP)
      if idx >= 0:
         return tag[:idx], tag[idx + 1:]
      else:
         return "", tag
313960
def tag!(tag, *args, &block)
      ele_id = nil

      # TODO: Move this logic to the tagset so that the tagset itself can validate + raise when invalid
      if @auto_validation && @tagset
        if !@tagset.tagset.has_key?(tag)
          raise InvalidXhtmlError, "no element `#{tag}' for #{tagset.doctype}"
        elsif args.last.respond_to?(:to_hash)
          attrs = args.last.to_hash

          if @tagset.forms.include?(tag) && attrs[:id]
            attrs[:name] ||= attrs[:id]
          end

          attrs.each do |k, v|
            atname = k.to_s.downcase.intern

            unless k =~ /:/ or @tagset.tagset[tag].include?(atname) or (@tagset == Markaby::HTML5 && atname.to_s =~ /^data-/)
              raise InvalidXhtmlError, "no attribute `#{k}' on #{tag} elements"
            end

            if atname == :id
              ele_id = v.to_s

              if @used_ids.has_key? ele_id
                raise InvalidXhtmlError, "id `#{ele_id}' already used (id's must be unique)."
              end
            end

            if AttrsBoolean.include? atname
              if v
                attrs[k] = atname.to_s
              else
                attrs.delete k
              end
            end
          end
        end
      end

      if block
        str = capture(&block)
        block = proc { text(str) }
      end

      f = fragment { @builder.tag!(tag, *args, &block) }
      @used_ids[ele_id] = f if ele_id
      f
    end
1179004
def has_tag?(name)
      tags.any? {|tag| tag.tag_name.to_s == name.to_s }
    end
701944
def parse_tag(text)
      match = text.scan(/%([-:\w]+)([-:\w.#\@]*)(.+)?/)[0]
      raise SyntaxError.new(Error.message(:invalid_tag, text)) unless match

      tag_name, attributes, rest = match

      if !attributes.empty? && (attributes =~ /[.#](\.|#|\z)/)
        raise SyntaxError.new(Error.message(:illegal_element))
      end

      new_attributes_hash = old_attributes_hash = last_line = nil
      object_ref = :nil
      attributes_hashes = {}
      while rest && !rest.empty?
        case rest[0]
        when ?{
          break if old_attributes_hash
          old_attributes_hash, rest, last_line = parse_old_attributes(rest)
          attributes_hashes[:old] = old_attributes_hash
        when ?(
          break if new_attributes_hash
          new_attributes_hash, rest, last_line = parse_new_attributes(rest)
          attributes_hashes[:new] = new_attributes_hash
        when ?[
          break unless object_ref == :nil
          object_ref, rest = balance(rest, ?[, ?])
        else; break
        end
      end

      if rest && !rest.empty?
        nuke_whitespace, action, value = rest.scan(/(<>|><|[><])?([=\/\~&!])?(.*)?/)[0]
        if nuke_whitespace
          nuke_outer_whitespace = nuke_whitespace.include? '>'
          nuke_inner_whitespace = nuke_whitespace.include? '<'
        end
      end

      if @options.remove_whitespace
        nuke_outer_whitespace = true
        nuke_inner_whitespace = true
      end

      if value.nil?
        value = ''
      else
        value.strip!
      end
      [tag_name, attributes, attributes_hashes, object_ref, nuke_outer_whitespace,
       nuke_inner_whitespace, action, value, last_line || @line.index + 1]
    end
529460
def matches?(selector)
      selector.each_pair do |key, value|
        return false unless matcher(key, value).matches?(value)
      end
      true
    end
1295575
def matches(self, tag, id, classes):
        
        element = self.elements[0]
        unmatched_ids = [name[1:] for name in element.names if name.startswith('#')]
        unmatched_classes = [name[1:] for name in element.names if name.startswith('.')]
        unmatched_tags = [name for name in element.names if name is not '*' and not name.startswith('#') and not name.startswith('.')]
        
        if tag and tag in unmatched_tags:
            unmatched_tags.remove(tag)

        if id and id in unmatched_ids:
            unmatched_ids.remove(id)

        for class_ in classes:
            if class_ in unmatched_classes:
                unmatched_classes.remove(class_)
        
        if unmatched_tags or unmatched_ids or unmatched_classes:
            return False

        else:
            return True
718732
private String getTagValue(String tag, String[] input, String defaultValue) {
		for (String arg : input) {
			Matcher matcher = CommandLineArgs.pattern.matcher(arg);
			// Get tagname and contents of tag
			if (matcher.find()) {
				String tagname = matcher.group(1);
				if (tag.equals(tagname)) {
					return matcher.group(2);
				}
			}
		}
		return defaultValue;
	}
984274
def _match_tag_regex(self, event_tag, search_tag):
        '''
        
        '''
        return self.cache_regex.get(search_tag).search(event_tag) is not None
996772
def tags(key = nil)
      if custom?
        tags = @data[:data][:sdk][:custom][:tags]
      else
        tags = @data[:data][key]
      end
      key ? tags[key] : tags
    end
160321
def at_match(self, match, predicate=None, index=None):
        
        return self.at_span(match.span, predicate, index)
372651
def _is_accepted(self, element_tag):
        ''''''
        element_tag = element_tag.lower()

        if self._ignored_tags is not None \
           and element_tag in self._ignored_tags:
            return False

        if self._followed_tags is not None:
            return element_tag in self._followed_tags
        else:
            return True
304639
def tag(self, *tags):
        
        if any([not isinstance(tag, collections.Hashable) for tag in tags]):
            raise TypeError('Every tag should be hashable')

        if not all(isinstance(tag, collections.Hashable) for tag in tags):
            raise TypeError('Tags must be hashable')
        self.tags.update(tags)
        return self
933741
def get_for_tag(self, tag):
        
        tag_filter = {'tag': tag}

        if isinstance(tag, six.integer_types):
            tag_filter = {'tag_id': tag}
        elif isinstance(tag, str):
            tag_filter = {'tag__slug': tag}

        return self.filter(id__in=[
            entry_tag.entry_id
            for entry_tag
            in EntryTag.objects.filter(**tag_filter)
        ])
230696
def parse(self, text):
        ''''''
        tags, results = [], []

        text = self.re_tag.sub(lambda m: self.sub_tag(m, tags, results), text)

        if self.strict and tags:
            markup = "%s%s%s" % (self.tag_sep[0], tags.pop(0), self.tag_sep[1])
            raise MismatchedTag('opening tag "%s" has no corresponding closing tag' % markup)

        if self.always_reset:
            if not text.endswith(Style.RESET_ALL):
                text += Style.RESET_ALL

        return text
649133
def find_within(tags, span, pointer)
      puts "--#{span}" if Chronic.debug
      return span if tags.empty?

      head = tags.shift
      head.start = (pointer == :future ? span.begin : span.end)
      h = head.this(:none)

      if span.cover?(h.begin) || span.cover?(h.end)
        find_within(tags, h, pointer)
      end
    end