/* Handling IRCv3 tags
335372
function _handleTags(username, tags, cb) {
    var self = this;

    self.userData = tags;
    self.userData.username = username;
    self.userData.special = [];

    if (typeof tags['emotes'] === 'string') {
        var emoticons = tags['emotes'].split('/');
        var emotes = {};

        for (var i = 0; i < emoticons.length; i++) {
            var parts = emoticons[i].split(':');
            emotes[parts[0]] = parts[1].split(',');
        }
        self.userData.emote = emotes;
    }

    if (tags['subscriber'] === '1') { self.userData.special.push('subscriber'); }
    if (tags['turbo'] === '1') { self.userData.special.push('turbo'); }
    if (typeof tags['user_type'] === 'string') { self.userData.special.push(tags['user_type']); }

    if (typeof cb == "function") {
        return cb(self.userData);
    }
}
180339
function Tag$1(impl, conf, innerHTML) {
  if ( impl === void 0 ) impl = {};
  if ( conf === void 0 ) conf = {};

  var opts = extend({}, conf.opts),
    parent = conf.parent,
    isLoop = conf.isLoop,
    isAnonymous = !!conf.isAnonymous,
    skipAnonymous = settings$1.skipAnonymousTags && isAnonymous,
    item = cleanUpData(conf.item),
    index = conf.index, // available only for the looped nodes
    instAttrs = [], // All attributes on the Tag when it's first parsed
    implAttrs = [], // expressions on this type of Tag
    expressions = [],
    root = conf.root,
    tagName = conf.tagName || getTagName(root),
    isVirtual = tagName === 'virtual',
    isInline = !isVirtual && !impl.tmpl,
    propsInSyncWithParent = [],
    dom;

  // make this tag observable
  if (!skipAnonymous) { observable$1(this); }
  // only call unmount if we have a valid __TAG_IMPL (has name property)
  if (impl.name && root._tag) { root._tag.unmount(true); }

  // not yet mounted
  this.isMounted = false;

  defineProperty(this, '__', {
    isAnonymous: isAnonymous,
    instAttrs: instAttrs,
    innerHTML: innerHTML,
    tagName: tagName,
    index: index,
    isLoop: isLoop,
    isInline: isInline,
    // tags having event listeners
    // it would be better to use weak maps here but we can not introduce breaking changes now
    listeners: [],
    // these vars will be needed only for the virtual tags
    virts: [],
    tail: null,
    head: null,
    parent: null,
    item: null
  });

  // create a unique id to this tag
  // it could be handy to use it also to improve the virtual dom rendering speed
  defineProperty(this, '_riot_id', ++__uid); // base 1 allows test !t._riot_id
  defineProperty(this, 'root', root);
  extend(this, { opts: opts }, item);
  // protect the "tags" and "refs" property from being overridden
  defineProperty(this, 'parent', parent || null);
  defineProperty(this, 'tags', {});
  defineProperty(this, 'refs', {});

  if (isInline || isLoop && isAnonymous) {
    dom = root;
  } else {
    if (!isVirtual) { root.innerHTML = ''; }
    dom = mkdom(impl.tmpl, innerHTML, isSvg(root));
  }

  /**
   * Update the tag expressions and options
   * @param   { * }  data - data we want to use to extend the tag properties
   * @returns { Tag } the current tag instance
   */
  defineProperty(this, 'update', function tagUpdate(data) {
    var nextOpts = {},
      canTrigger = this.isMounted && !skipAnonymous;

    // make sure the data passed will not override
    // the component core methods
    data = cleanUpData(data);
    extend(this, data);
    updateOpts.apply(this, [isLoop, parent, isAnonymous, nextOpts, instAttrs]);

    if (canTrigger && this.isMounted && isFunction(this.shouldUpdate) && !this.shouldUpdate(data, nextOpts)) {
      return this
    }

    // inherit properties from the parent, but only for isAnonymous tags
    if (isLoop && isAnonymous) { inheritFrom.apply(this, [this.parent, propsInSyncWithParent]); }
    extend(opts, nextOpts);
    if (canTrigger) { this.trigger('update', data); }
    updateAllExpressions.call(this, expressions);
    if (canTrigger) { this.trigger('updated'); }

    return this

  }.bind(this));

  /**
   * Add a mixin to this tag
   * @returns { Tag } the current tag instance
   */
  defineProperty(this, 'mixin', function tagMixin() {
    var this$1 = this;

    each(arguments, function (mix) {
      var instance, obj;
      var props = [];

      // properties blacklisted and will not be bound to the tag instance
      var propsBlacklist = ['init', '__proto__'];

      mix = isString(mix) ? mixin$1(mix) : mix;

      // check if the mixin is a function
      if (isFunction(mix)) {
        // create the new mixin instance
        instance = new mix();
      } else { instance = mix; }

      var proto = Object.getPrototypeOf(instance);

      // build multilevel prototype inheritance chain property list
      do { props = props.concat(Object.getOwnPropertyNames(obj || instance)); }
      while (obj = Object.getPrototypeOf(obj || instance))

      // loop the keys in the function prototype or the all object keys
      each(props, function (key) {
        // bind methods to this
        // allow mixins to override other properties/parent mixins
        if (!contains(propsBlacklist, key)) {
          // check for getters/setters
          var descriptor = Object.getOwnPropertyDescriptor(instance, key) || Object.getOwnPropertyDescriptor(proto, key);
          var hasGetterSetter = descriptor && (descriptor.get || descriptor.set);

          // apply method only if it does not already exist on the instance
          if (!this$1.hasOwnProperty(key) && hasGetterSetter) {
            Object.defineProperty(this$1, key, descriptor);
          } else {
            this$1[key] = isFunction(instance[key]) ?
              instance[key].bind(this$1) :
              instance[key];
          }
        }
      });

      // init method will be called automatically
      if (instance.init)
        { instance.init.bind(this$1)(); }
    });
    return this
  }.bind(this));

  /**
   * Mount the current tag instance
   * @returns { Tag } the current tag instance
   */
  defineProperty(this, 'mount', function tagMount() {
    var this$1 = this;

    root._tag = this; // keep a reference to the tag just created

    // Read all the attrs on this instance. This give us the info we need for updateOpts
    parseAttributes.apply(parent, [root, root.attributes, function (attr, expr) {
      if (!isAnonymous && RefExpr.isPrototypeOf(expr)) { expr.tag = this$1; }
      attr.expr = expr;
      instAttrs.push(attr);
    }]);

    // update the root adding custom attributes coming from the compiler
    implAttrs = [];
    walkAttrs(impl.attrs, function (k, v) { implAttrs.push({name: k, value: v}); });
    parseAttributes.apply(this, [root, implAttrs, function (attr, expr) {
      if (expr) { expressions.push(expr); }
      else { setAttr(root, attr.name, attr.value); }
    }]);

    // initialiation
    updateOpts.apply(this, [isLoop, parent, isAnonymous, opts, instAttrs]);

    // add global mixins
    var globalMixin = mixin$1(GLOBAL_MIXIN);

    if (globalMixin && !skipAnonymous) {
      for (var i in globalMixin) {
        if (globalMixin.hasOwnProperty(i)) {
          this$1.mixin(globalMixin[i]);
        }
      }
    }

    if (impl.fn) { impl.fn.call(this, opts); }

    if (!skipAnonymous) { this.trigger('before-mount'); }

    // parse layout after init. fn may calculate args for nested custom tags
    parseExpressions.apply(this, [dom, expressions, isAnonymous]);

    this.update(item);

    if (!isAnonymous && !isInline) {
      while (dom.firstChild) { root.appendChild(dom.firstChild); }
    }

    defineProperty(this, 'root', root);
    defineProperty(this, 'isMounted', true);

    if (skipAnonymous) { return }

    // if it's not a child tag we can trigger its mount event
    if (!this.parent) {
      this.trigger('mount');
    }
    // otherwise we need to wait that the parent "mount" or "updated" event gets triggered
    else {
      var p = getImmediateCustomParentTag(this.parent);
      p.one(!p.isMounted ? 'mount' : 'updated', function () {
        this$1.trigger('mount');
      });
    }

    return this

  }.bind(this));

  /**
   * Unmount the tag instance
   * @param { Boolean } mustKeepRoot - if it's true the root node will not be removed
   * @returns { Tag } the current tag instance
   */
  defineProperty(this, 'unmount', function tagUnmount(mustKeepRoot) {
    var this$1 = this;

    var el = this.root,
      p = el.parentNode,
      ptag,
      tagIndex = __TAGS_CACHE.indexOf(this);

    if (!skipAnonymous) { this.trigger('before-unmount'); }

    // clear all attributes coming from the mounted tag
    walkAttrs(impl.attrs, function (name) {
      if (startsWith(name, ATTRS_PREFIX))
        { name = name.slice(ATTRS_PREFIX.length); }

      remAttr(root, name);
    });

    // remove all the event listeners
    this.__.listeners.forEach(function (dom) {
      Object.keys(dom[RIOT_EVENTS_KEY]).forEach(function (eventName) {
        dom.removeEventListener(eventName, dom[RIOT_EVENTS_KEY][eventName]);
      });
    });

    // remove this tag instance from the global virtualDom variable
    if (tagIndex !== -1)
      { __TAGS_CACHE.splice(tagIndex, 1); }

    if (p || isVirtual) {
      if (parent) {
        ptag = getImmediateCustomParentTag(parent);

        if (isVirtual) {
          Object.keys(this.tags).forEach(function (tagName) {
            arrayishRemove(ptag.tags, tagName, this$1.tags[tagName]);
          });
        } else {
          arrayishRemove(ptag.tags, tagName, this);
          // remove from _parent too
          if(parent !== ptag) {
            arrayishRemove(parent.tags, tagName, this);
          }
        }
      } else {
        // remove the tag contents
        setInnerHTML(el, '');
      }

      if (p && !mustKeepRoot) { p.removeChild(el); }
    }

    if (this.__.virts) {
      each(this.__.virts, function (v) {
        if (v.parentNode) { v.parentNode.removeChild(v); }
      });
    }

    // allow expressions to unmount themselves
    unmountAll(expressions);
    each(instAttrs, function (a) { return a.expr && a.expr.unmount && a.expr.unmount(); });

    // custom internal unmount function to avoid relying on the observable
    if (this.__.onUnmount) { this.__.onUnmount(); }

    if (!skipAnonymous) {
      this.trigger('unmount');
      this.off('*');
    }

    defineProperty(this, 'isMounted', false);

    delete this.root._tag;

    return this

  }.bind(this));
}
463286
function validCustomTag(tag, attrs, lkey, value) {
      // catch the div placeholder for the iframe replacement
      if (tag === 'img' && attrs['ta-insert-video']) {
          if (lkey === 'ta-insert-video' || lkey === 'allowfullscreen' || lkey === 'frameborder' || (lkey === 'contenteditble' && value === 'false')) {
              return true;
          }
      }
      return false;
  }
701194
function urlEncodeIfNecessary(s) {
		var regex = /[\\\"<>\.;]/;
		var hasBadChars = regex.exec(s) != null;
		return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
	}
17625
def last_tag_protocol
      tag = ::FFI::MemoryPointer.new(:string)
	  proto = ::FFI::MemoryPointer.new(:int)
      Klass.getLastTag2(@handle, tag, proto)
      Phidgets::FFI::RFIDTagProtocol[proto.get_int(0)]
	end
873478
function updateHandlerTags(handler) {
  let { event, tags, goesBefore, goesAfter } = handler
  let eventTags = events[event] && events[event].tags

  if (!tags || !tags.length || !eventTags) {
    return handler
  }

  tags = expandImplied(tags, eventTags, 'implies')

  for (let i = 0; i < tags.length; i++) {
    let tag = tags[i]
    let tagGoesBefore = eventTags[tag] && eventTags[tag].goesBefore
    let tagGoesAfter = eventTags[tag] && eventTags[tag].goesAfter

    if (tagGoesBefore) {
      goesBefore = goesBefore || []
      goesBefore.push(...tagGoesBefore)
    }

    if (tagGoesAfter) {
      goesAfter = goesAfter || []
      goesAfter.push(...tagGoesAfter)
    }
  }

  goesBefore = goesBefore && expandImplied(goesBefore, eventTags, 'impliedBy')
  goesAfter = goesAfter && expandImplied(goesAfter, eventTags, 'impliedBy')

  handler.tags = tags
  handler.goesBefore = goesBefore
  handler.goesAfter = goesAfter

  return handler
}
260917
function _processCollectedTags($source)
        {
            $to_replace = array();
            $ordered = array();
            foreach(self::$tag_collections as $tag_name=>$tags)
            {
//              if this block has a collection order use it
                if(isset(self::$_tag_order[$tag_name]) === true)
                {
                    $pos = self::$_tag_order[$tag_name];
                    $ordered[$pos] = $tags;
                    continue;
                }
//              the source should be modified by the collection script
                $tag_func_name = ucwords(str_replace(array('_', '-'), ' ', $tag_name));
                $tag_func_name = strtolower(substr($tag_func_name, 0, 1)).substr($tag_func_name, 1);
                $tag_func_name = str_replace(' ', '', $this->_options['tag_callback_prefix'].$tag_func_name);
                if($this->_options['tag_global_callback'] !== false)
                {
                    $tags = call_user_func($this->_options['tag_global_callback'], 'collection', $tag_func_name, $tags, $source);
                }
                else
                {
                    $tags = call_user_func($tag_func_name, $tags, $source);
                }
                
                if($tags === -1)
                {
                    $source = self::throwError($tag_name, 'tag collection parsed however callback "'.$tag_func_name.'" returned -1.');
                }
                else if(is_array($tags) === false)
                {
                    $source = self::throwError($tag_name, 'tag collection parsed however callback "'.$tag_func_name.'" did not return the array of process tags.');
                }
                else if(count($tags) > 0)
                {
//                  input the parsed tags back into the source or store for re-intergration
                    foreach ($tags as $key => $tag)
                    {
                        if(strpos($source, $tag['tag']) !== false)
                        {
                            $source = str_replace($tag['tag'], $tag['parsed'], $source);
                        }
                        else
                        {
//                          do a reverse tag lookup here as the tag was not found in the source, thus it must be buried and un processed
                            array_push($to_replace, $tag);
                        }
                    }
                }
            }
            foreach($ordered as $key=>$tags)
            {
//              the source should be modified by the collection script
                $tag_func_name = ucwords(str_replace(array('_', '-'), ' ', $tag_name));
                $tag_func_name = strtolower(substr($tag_func_name, 0, 1)).substr($tag_func_name, 1);
                $tag_func_name = str_replace(' ', '', $this->_options['tag_callback_prefix'].$tag_func_name);
                $tags = call_user_func($tag_func_name, $tags);
                if($tags === -1)
                {
                    $source = self::throwError($tag['name'], 'tag collection parsed however callback "'.$tag_func_name.'" returned -1.');
                }
            }
            return $this->_doBuriedReplacements($to_replace, $source);
        }
54882
public void invokeTaglib(final IJRubyContext rcon, JellyContext context, XMLOutput output, String uri, String localName, Map<RubySymbol,?> attributes, final RubyProc proc) throws JellyException {
        TagScript tagScript = createTagScript(context, uri, localName);

        if (attributes!=null) {
            for (Entry<RubySymbol, ?> e : attributes.entrySet()) {
                tagScript.addAttribute(e.getKey().asJavaString(), new ConstantExpression(e.getValue()));
            }
        }
        
        if (proc!=null) {
            final Ruby runtime = ((IRubyObject)rcon).getRuntime();

            tagScript.setTagBody(new Script() {
                public Script compile() throws JellyException {
                    return this;
                }

                public void run(JellyContext context, XMLOutput output) throws JellyTagException {
                    JellyContext oc = rcon.getJellyContext();
                    XMLOutput oo = rcon.getOutput();
                    try {
                        rcon.setJellyContext(context);
                        rcon.setOutput(output);
                        proc.getBlock().yield(runtime.getCurrentContext(),null);
                    } finally {
                        rcon.setJellyContext(oc);
                        rcon.setOutput(oo);
                    }
                }
            });
        }
        tagScript.run(context, output);
    }
633210
function getRawTag(value) {
  var isOwn = hasOwnProperty$1.call(value, symToStringTag$1),
      tag = value[symToStringTag$1];

  try {
    value[symToStringTag$1] = undefined;
    var unmasked = true;
  } catch (e) {}

  var result = nativeObjectToString.call(value);
  if (unmasked) {
    if (isOwn) {
      value[symToStringTag$1] = tag;
    } else {
      delete value[symToStringTag$1];
    }
  }
  return result;
}
1246217
function() {
        var updateRegex = _.bind(function () {
                // Allows checking for a nick that contains 'the_nick' or '<punctuation>the_nick<punctuation>'
                // .. where <punctuation> is any character not allowed in an IRC nick
                var regex_valid_nick_chars = 'a-z0-9_\\-{}[\\]^`|\\\\';
                var regex_nicks = Object.keys(this.nick_cache)
                    .map(_.escapeRegExp)
                    .join('|');

                this.nick_regex = new RegExp(
                    '^[^'+regex_valid_nick_chars+']?(' + regex_nicks + ')[^'+regex_valid_nick_chars+']?$', 'i'
                );
            }, this);

        function getNick (member) {
            return member.get('nick').toLowerCase();
        };

        this.nick_cache = Object.create(null);
        this.nick_regex = null;

        this.on('reset', function() {
            this.nick_cache = _.reduce(this.models, function(memo, member) {
                memo[getNick(member)] = member;
                return memo;
            }, Object.create(null));
            updateRegex();
        });

        this.on('add', function(member) {
            this.nick_cache[getNick(member)] = member;
            updateRegex();
        });

        this.on('remove', function(member) {
            delete this.nick_cache[getNick(member)];
            updateRegex();
        });

        this.on('change:nick', function(member) {
            this.nick_cache[getNick(member)] = member;
            delete this.nick_cache[member.previous('nick').toLowerCase()];
            updateRegex();
        });
    }
304962
def read_all_tags(taglib, id3v2_frames, id3v1_tag = nil, **opts)
      frames = []
      id3v2_frames.each { |frame_id| frames += id3v2_frames(taglib, frame_id) }

      data = []
      # only check id3v1 if no id3v2 frames found
      if frames.empty?
        data << id3v1_tag(taglib, id3v1_tag) unless id3v1_tag.nil?
      else
        frames.each { |frame| data << data_from_frame(frame, **opts) }
      end

      data.compact
    end
337917
private void renderTag(Tag tag, StringBuilder buffer) {
        buffer.append(tag.name()).append(' ');
        // Special handling for @param <T> tags
        // See http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html#@param
        if ((tag instanceof ParamTag) && ((ParamTag) tag).isTypeParameter()) {
            ParamTag paramTag = (ParamTag) tag;
            buffer.append("<" + paramTag.parameterName() + ">");
            String text = paramTag.parameterComment();
            if (text.length() > 0) {
                buffer.append(' ').append(render(text, true));
            }
            return;
        }
        buffer.append(render(tag.text(), true));
    }
1242518
@Override
    public Iterable<Tag> httpRequestTags(@Nullable HttpServletRequest request,
                                         @Nullable HttpServletResponse response,
                                         @Nullable Object handler,
                                         @Nullable Throwable ex) {
        return Arrays.asList(WebMvcTags.method(request), WebMvcTags.uri(request, response),
            WebMvcTags.exception(ex), WebMvcTags.status(response), WebMvcTags.outcome(response));
    }
1030702
function checkUriRaw(i) {
  const start = i;
  let l;

  while (i < tokensLength) {
    if (checkInterpolation(i) || checkVariable(i)) break;
    else if (l = checkUriRawCharacters(i)) i += l;
    else break;
  }

  tokens[start].uri_raw_end = i;

  return i - start;
}
659530
function decode(s, tag) {
	if (!decodeTag(s, tag)) {
		throw new error.ProtocolError('NODE_RDP_ASN1_BER_INVALID_TAG');
	}
	var length = decodeLength(s);
	
	if (length === 0) {
		return new type.Stream(0);
	}
	return new type.BinaryString(null,{ readLength : new type.CallableValue(length) }).read(s);
}
410300
def tcpPorts(self, req, tag):
        
        f = PortScrollingFragment(
            self.store,
            TCPPort,
            (TCPPort.portNumber,
             TCPPort.interface,
             FactoryColumn(TCPPort.factory)))
        f.setFragmentParent(self)
        f.docFactory = webtheme.getLoader(f.fragmentName)
        return tag[f]
472538
def zotero_inline_tags(parser, token):
    
    
    args = token.split_contents()
    length = len(args)
    if length == 2:
        rendered_node = RenderedAllNode(args[1])
    elif length == 3 and args[2].lower() == u'all':
        rendered_node = RenderedAllNode(args[1])
    elif length == 3 and args[2].lower() == u'media':
        rendered_node = RenderedMediaNode(args[1])
    elif length == 3 and args[2].lower() == u'formset':
        rendered_node = RenderedFormsetNode(args[1])
    else:
        raise t.TemplateSyntaxError('Incorrect arguments in %s.' % args[0])
    
    return rendered_node