Given the tag key of an opening section tag, find the corresponding closing
    tag (if it exists) and return information about that match.
338588
def section_end_info(template, tag_key, state, index):
    

    state.section.push(tag_key)
    match = None
    matchinfo = None
    search_index = index

    while state.section:
        match = state.tag_re.search(template, search_index)
        if not match:
            raise Exception("Open section %s never closed" % tag_key)

        matchinfo = get_match_info(template, match, state)

        # If we find a new section tag, add it to the stack and keep going
        if matchinfo['tag_type'] in ('#', '^'):
            state.section.push(matchinfo['tag_key'])
        # If we find a closing tag for the current section, 'close' it by
        # popping the stack
        elif matchinfo['tag_type'] == '/':
            if matchinfo['tag_key'] == state.section():
                state.section.pop()
            else:
                raise Exception(
                    'Unexpected section end: received %s, expected {{/%s}}' % (
                        repr(match.group(0)), tag_key))
        search_index = matchinfo['tag_end']

    return matchinfo
67303
def _get_match(self, key):
        

        return self._get_string_match(key=key) or \
            self._get_non_string_match(key=key)
528323
function findNextHTMLItem(editor) {
		var isFirst = true;
		return findItem(editor, false, function(content, searchPos){
			if (isFirst) {
				isFirst = false;
				return findOpeningTagFromPosition(content, searchPos);
			} else {
				return getOpeningTagFromPosition(content, searchPos);
			}
		}, function(tag, offset, selRange) {
			return getRangeForHTMLItem(tag, offset, selRange, false);
		});
	}
1214259
function (element, tagName) {
            if (tagName.indexOf(",") === -1)
                return element.getElementsByTagName(tagName);
            return element.querySelectorAll(tagName);
        }
347141
def map_tag_to_subfield(tag_type, line, cur_misc_txt, dest):
    """"""
    closing_tag = '</cds.%s>' % tag_type
    # extract the institutional report-number from the line:
    idx_closing_tag = line.find(closing_tag)
    # Sanity check - did we find a closing tag?
    if idx_closing_tag == -1:
        # no closing </cds.TAG> tag found - strip the opening tag and move past this
        # recognised reportnumber as it is unreliable:
        identified_citation_element = None
        line = line[len('<cds.%s>' % tag_type):]
    else:
        tag_content = line[:idx_closing_tag]
        identified_citation_element = {'type': tag_type,
                                       'misc_txt': cur_misc_txt,
                                       dest: tag_content}
        ending_tag_pos = idx_closing_tag + len(closing_tag)
        line = line[ending_tag_pos:]
        cur_misc_txt = u""

    return identified_citation_element, line, cur_misc_txt
616582
def __load_section(self, section_key):
        
        if self._sections[section_key] is not None: return

        articles = []
        for page in count(1):
            if page > 50:
                raise Exception('Last page detection is probably broken')

            url = '{domain}{section}&iMenuID=1&iSubMenuID={page}'.format(
                domain = DOMAIN,
                section = SECTIONS[section_key],
                page = page
            )

            body = self._session.get(url).content

            # This is a very hacky way of detecting the last page
            # that will probably break again in the future
            if "알수 없는 주소" in body: # "Unknown Address"
                break

            # Parse out all the article links
            root = html.fromstring(body)
            title_lines = root.find_class('ListNewsLineTitle')
            for title_line in title_lines:
                title_link = title_line.find('a')

                # The links do a JS open in a new window, so we need to parse
                # it out using this ugly, brittle junk
                href = title_link.get('href')
                match = re.match("javascript:article_open\('(.+)'\)", href)
                if not match:
                    raise Exception("The site's link format has changed and is not compatible")
                path = match.group(1).decode('string_escape')

                articles.append(Article(
                    self._session,
                    title_link.text_content().strip(),
                    DOMAIN + '/en/' + path
                ))

        self._sections[section_key] = articles
338824
public RequiredSearch tag(String tagKey, String tagValue) {
        return tags(Tags.of(tagKey, tagValue));
    }
312556
def handle_starttag(self, tag, attrs):
        """"""
        if not tag == 'a':
            return

        for attr in attrs:
            if attr[0] == 'href':
                # Links look like: /pub/firefox/nightly/2015/
                # We have to trim the fragment down to the last item. Also to ensure we
                # always get it, we remove a possible final slash first
                url = urllib.unquote(attr[1])
                self.active_url = url.rstrip('/').split('/')[-1]

                return
82873
def tag(self, name, attrs=None, selfclosing=None):
        """"""
        if self.disable_tags > 0:
            return

        if name in self.linkable_tags and attrs and len(attrs) > 0:
            for attrib in attrs:
                if attrib[0] in self.linkable_attrs:
                    attrib[1] = INTERNAL_LINK.sub('{\g<1>}', attrib[1])

        super().tag(name, attrs, selfclosing)
701693
@Override
  protected void visitHtmlCloseTagNode(HtmlCloseTagNode node) {
    // This case occurs in the case where we encounter the end of a keyed element. If the open tag
    // mapped to this close tag contains a key node, pop the keyCounterStack to return
    // to the state before entering the keyed node.
    if (node.getTaggedPairs().size() == 1) {
      HtmlOpenTagNode openTag = (HtmlOpenTagNode) node.getTaggedPairs().get(0);
      if (openTag.getKeyNode() != null) {
        keyCounterStack.pop();
        getJsCodeBuilder().append(INCREMENTAL_DOM_POP_MANUAL_KEY.call());
      }
    }

    if (!node.getTagName().isDefinitelyVoid()) {
      emitClose(getTagNameCodeChunk(node.getTagName()));
    }
  }
794147
function () {
    var text = '[' + this.tag

    _.each(this.attrs.numeric, function (value) {
      if (/\s/.test(value)) {
        text += ' "' + value + '"'
      } else {
        text += ' ' + value
      }
    })

    _.each(this.attrs.named, function (value, name) {
      text += ' ' + name + '="' + value + '"'
    })

    // If the tag is marked as `single` or `self-closing`, close the
    // tag and ignore any additional content.
    if (this.type === 'single') {
      return text + ']'
    } else if (this.type === 'self-closing') {
      return text + ' /]'
    }

    // Complete the opening tag.
    text += ']'

    if (this.content) {
      text += this.content
    }

    // Add the closing tag.
    return text + '[/' + this.tag + ']'
  }
1279048
def _handle_tag_open_close(self):
        """"""
        self._emit(tokens.TagOpenClose())
        self._push(contexts.TAG_CLOSE)
        self._head += 1
578385
@JsonIgnore
    public String getTag(String key) {
        return (!Metric.ReservedField.isReservedField(key)) ? _tags.get(key) : null;
    }
833
def getEndTag(self):
        '''
            
        '''
        # If this is a self-closing tag, we have no end tag (opens and closes in the start)
        if self.isSelfClosing is True:
            return ''

        tagName = self.tagName

        # Do not add any indentation to the end of preformatted tags.
        if self._indent and tagName in PREFORMATTED_TAGS:
            return "</%s>" %(tagName, )

        # Otherwise, indent the end of this tag
        return "%s</%s>" %(self._indent, tagName)
976164
public Search tag(String tagKey, String tagValue) {
        return tags(Tags.of(tagKey, tagValue));
    }
527087
function (scanner, tag) {
  if (getClangle(scanner))
    return tag;

  if (getSlash(scanner)) {
    if (! getClangle(scanner))
      scanner.fatal("Expected `>` after `/`");
    tag.isSelfClosing = true;
    return tag;
  }

  return null;
}
267367
def generate_entry_between_tags(older_tag, newer_tag)
      filtered_issues, filtered_pull_requests = filter_issues_for_tags(newer_tag, older_tag)

      if newer_tag.nil? && filtered_issues.empty? && filtered_pull_requests.empty?
        # do not generate empty unreleased section
        return ""
      end

      newer_tag_link, newer_tag_name, newer_tag_time = detect_link_tag_time(newer_tag)

      # If the older tag is nil, go back in time from the latest tag and find
      # the SHA for the first commit.
      older_tag_name =
        if older_tag.nil?
          @fetcher.oldest_commit["sha"]
        else
          older_tag["name"]
        end

      Entry.new(options).generate_entry_for_tag(filtered_pull_requests, filtered_issues, newer_tag_name, newer_tag_link, newer_tag_time, older_tag_name)
    end