Check if tag is present inside template
503684
public function hasTag($tag)
    {
        if ($this->isTopTag($tag)) {
            return true;
        }

        return isset($this->tags[$tag]) && is_array($this->tags[$tag]);
    }
1294156
def has_template(self, uri):
        
        try:
            self.get_template(uri)
            return True
        except exceptions.TemplateLookupException:
            return False
1064331
def iselect(self, tag, limit=0):
        """"""

        for el in CSSMatch(self.selectors, tag, self.namespaces, self.flags).select(limit):
            yield el
802403
function isHTMLTag(html) {
    if (typeof HTMLElement === 'object') {
        return (html && (html instanceof HTMLElement));
    }

    return !!(html && html.nodeType && html.nodeType === 1);
}
87457
function detectTemplateId( HTMLCode ){

    var commentTagPattern = /<!--\s*InstanceBegin\s+template="\/([^"]+)"\s*[^>]*-->/,
        matchingResult = HTMLCode.match( commentTagPattern );

    if( matchingResult ){
        return matchingResult[1];
    }
    else {
        return null;
    }
}
1276008
function(el, tagName, tagData) {
                var helperTagCallback = tagData.options.attr('tags.' + tagName),
                    tagCallback = helperTagCallback || tags[tagName];

                // If this was an element like <foo-bar> that doesn't have a component, just render its content
                var scope = tagData.scope,
                    res;

                if (tagCallback) {
                    var reads = can.__clearReading();
                    res = tagCallback(el, tagData);
                    can.__setReading(reads);
                } else {
                    res = scope;
                }



                // If the tagCallback gave us something to render with, and there is content within that element
                // render it!
                if (res && tagData.subtemplate) {

                    if (scope !== res) {
                        scope = scope.add(res);
                    }
                    var result = tagData.subtemplate(scope, tagData.options);
                    var frag = typeof result === "string" ? can.view.frag(result) : result;
                    can.appendChild(el, frag);
                }
            }
1038704
function renderCustomTemplate(body, template, callback) {
  if(typeof callback !== 'function') {
    callback = function(){};
  }

  if(typeof template === 'function') {
    template(body, callback);
  }

  // if(typeof template === 'string') {

  // }
}
83279
function(options, cb) {
        let template, render;
        if(!options.params || !options.params.template || !options.params.template.content) {
            return utils.checkError('Missing template content', 727, cb);
        }

        try {
            template = handlebars.compile(options.params.template.content);
            if(options.params.template._id){
                if(!options.params.input.tags){
                    options.params.input.tags = {};
                }
                options.params.input.tags['soajs.template.id'] = options.params.template._id.toString();
            }
            render = template(options.params.input);
        }
        catch(e) {
            return utils.checkError(e, 727, cb);
        }

        return cb(null, { render });
    }
669181
def check_content(content, **kwargs):
    ''''''
    # valid html root tag
    try:
        # render elements tree from content
        tree = fragment_fromstring(content)
        # flag for prevent content rerendering, when no "active" urls found
        processed = False
        # django > 1.5 template boolean\None variables feature
        if isinstance(kwargs['parent_tag'], bool):
            if not kwargs['parent_tag']:
                kwargs['parent_tag'] = 'self'
            else:
                raise ImproperlyConfigured('''
                    parent_tag=True is not allowed
                ''')
        elif kwargs['parent_tag'] is None:
            kwargs['parent_tag'] = 'self'
        # if parent_tag is False\None\''\a\self
        # "active" status will be applied directly to "<a>"
        if kwargs['parent_tag'].lower() in ('a', 'self', ''):
            # xpath query to get all "<a>"
            urls = tree.xpath('.//a')
            # check "active" status for all urls
            for url in urls:
                if check_active(url, url, **kwargs):
                    # mark flag for rerendering content
                    processed = True
        # otherwise css_class must be applied to parent_tag
        else:
            # xpath query to get all parent tags
            elements = tree.xpath('.//{parent_tag}'.format(
                parent_tag=kwargs['parent_tag'],
            ))
            # check all elements for "active" "<a>"
            for element in elements:
                # xpath query to get all "<a>"
                urls = element.xpath('.//a')
                # check "active" status for all urls
                for url in urls:
                    if check_active(url, element, **kwargs):
                        # flag for rerendering content tree
                        processed = True
                        # stop checking other "<a>"
                        break
        # do not rerender content if no "active" urls found
        if processed:
            # render content from tree
            return tostring(tree, encoding='unicode')
    # not valid html root tag
    except ParserError:
        # raise an exception with configuration example
        raise ImproperlyConfigured('''
            content of {% activeurl %} must have valid html root tag
            for example
                {% activeurl %}
                    <ul>
                        <li>
                            <a href="/page/">page</a>
                        </li>
                        <li>
                            <a href="/other_page/">other_page</a>
                        </li>
                    </ul>
                {% endactiveurl %}
            in this case <ul> is valid content root tag
        ''')
    return content
688162
def is_break_tag(self, el):
        """"""

        name = sv.util.lower(el.name) if self.type != 'xhtml' else el.name
        return name in self.break_tags or name in self.user_break_tags
822948
def tag_present
      ptr = ::FFI::MemoryPointer.new(:int)
      Klass.getTagStatus(@handle, ptr)
      (ptr.get_int(0) == 0) ? false : true
    end
1181550
private boolean isValidTemplateElement(String template, String element) {

        List elements = new ArrayList(getTemplateElements(template));
        Iterator i = elements.iterator();
        while (i.hasNext()) {
            CmsDialogElement currElement = (CmsDialogElement)i.next();
            if (element.equals(currElement.getName())) {
                return true;
            }
        }

        return false;
    }
1118877
public static function _isset($value, array $params, Template $template)
    {
        if (!isset($value)) {
            return '';
        }
        //$template = clone $template;
        $placeholders = array_merge(
            !empty($params['addPlaceholders']) ? $template->findPlaceholders($params['addPlaceholders']) : [],
            ['output' => $value]
        );
        return $template->replaceByPrefix($params['then'], $placeholders);
    }
670572
def is_break_tag(self, el):
        """"""

        name = el.name
        return name in self.break_tags or name in self.user_break_tags
1087898
function applyTemplateContent(inst, node, nodeInfo) {
  if (nodeInfo.templateInfo) {
    node._templateInfo = nodeInfo.templateInfo;
  }
}
255563
function isHtml(path) {
  const node = path.getValue();
  return (
    hasLanguageComment(node, "HTML") ||
    isPathMatch(path, [
      node => node.type === "TemplateLiteral",
      (node, name) =>
        node.type === "TaggedTemplateExpression" &&
        node.tag.type === "Identifier" &&
        node.tag.name === "html" &&
        name === "quasi"
    ])
  );
}
445831
def is_in(property_name, set_values, *, present_optional=False, message=None):
    """"""
    def check(val):
      """Checks that a value is contained within a scope-enclosed set."""
      if val is None:
        return present_optional
      else:
        return val in set_values

    return Validation(check, property_name, message)