Un-escape escaped tags so that they look as the users intended.
976865
private static String unescapeColors (String txt, boolean restore)
    {
        if (txt == null) return null;
        String prefix = restore ? "#" : "%";
        return ESCAPED_PATTERN.matcher(txt).replaceAll(prefix + "$1");
    }
577846
function (str) {
                if (!str) {
                    return str;
                }
                return String(str).replace(/[\uff-\uffff]/g, function (c) {
                    return escape(c).replace('%', '\\');
                });
            }
798401
def fix_tag(value):
    """"""
    if sys.version_info[0] == 2:
        return bytes(value)
    else:
        if type(value) == bytes:
            return value
        elif type(value) == str:
            return value.encode('ASCII')
        return str(value).encode('ASCII')
137836
def _escape_markdown_literals(string):
    
    literals = list("\\`*_{}[]()<>#+-.!:|")
    escape = lambda c: '\\' + c if c in literals else c
    return "".join(map(escape, string))
196318
def metablock(parsed):
    
    parsed = " ".join(parsed.replace("\n", "").split()).replace(" ,", ",")
    return escape(strip_tags(decode_entities(parsed)))
1314011
def _breakRemNewlines(tag):
	""""""
	for i,c in enumerate(tag.contents):
		if type(c) != bs4.element.NavigableString:
			continue
		c.replace_with(re.sub(r' {2,}', ' ', c).replace('\n',''))
677050
private String escapeToLower(String url) {
        String encodedUrl = StringUtils.urlEncode(url, UNSAFE_URL_CHARS_PATTERN, Charset.forName("UTF-8"));
        return encodedUrl;
    }
19255
function tokenizeEscape(match, value) {
    var index = tokenized.length;
    tokenized[index] = "'+\n_.escape(" + value + ") +\n'";
    return token + index;
  }
1136431
def removeHtmlTags(self, text):
		""""""
		sb = []
		text = self.removeHtmlComments(text)
		bits = text.split(u'<')
		sb.append(bits.pop(0))
		tagstack = []
		tablestack = tagstack
		for x in bits:
			m = _tagPattern.match(x)
			if not m:
				continue
			slash, t, params, brace, rest = m.groups()
			t = t.lower()
			badtag = False
			if t in _htmlelements:
				# Check our stack
				if slash:
					# Closing a tag...
					if t in _htmlsingleonly or len(tagstack) == 0:
						badtag = True
					else:
						ot = tagstack.pop()
						if ot != t:
							if ot in _htmlsingleallowed:
								# Pop all elements with an optional close tag
								# and see if we find a match below them
								optstack = []
								optstack.append(ot)
								while True:
									if len(tagstack) == 0:
										break
									ot = tagstack.pop()
									if ot == t or ot not in _htmlsingleallowed:
										break
									optstack.append(ot)
								if t != ot:
									# No match. Push the optinal elements back again
									badtag = True
									tagstack += reversed(optstack)
							else:
								tagstack.append(ot)
								# <li> can be nested in <ul> or <ol>, skip those cases:
								if ot not in _htmllist and t in _listtags:
									badtag = True
						elif t == u'table':
							if len(tablestack) == 0:
								bagtag = True
							else:
								tagstack = tablestack.pop()
					newparams = u''
				else:
					# Keep track for later
					if t in _tabletags and u'table' not in tagstack:
						badtag = True
					elif t in tagstack and t not in _htmlnest:
						badtag = True
					# Is it a self-closed htmlpair? (bug 5487)
					elif brace == u'/>' and t in _htmlpairs:
						badTag = True
					elif t in _htmlsingleonly:
						# Hack to force empty tag for uncloseable elements
						brace = u'/>'
					elif t in _htmlsingle:
						# Hack to not close $htmlsingle tags
						brace = None
					else:
						if t == u'table':
							tablestack.append(tagstack)
							tagstack = []
						tagstack.append(t)
					newparams = self.fixTagAttributes(params, t)
				if not badtag:
					rest = rest.replace(u'>', u'&gt;')
					if brace == u'/>':
						close = u' /'
					else:
						close = u''
					sb.append(u'<')
					sb.append(slash)
					sb.append(t)
					sb.append(newparams)
					sb.append(close)
					sb.append(u'>')
					sb.append(rest)
					continue
			sb.append(u'&lt;')
			sb.append(x.replace(u'>', u'&gt;'))

		# Close off any remaining tags
		while tagstack:
			t = tagstack.pop()
			sb.append(u'</')
			sb.append(t)
			sb.append(u'>\n')
			if t == u'table':
				if not tablestack:
					break
				tagstack = tablestack.pop()

		return u''.join(sb)
1099131
function unEscapeHtmlTags (text) {
  return text
    .replace(ampRegex, '&')
    .replace(ltRegex, '<')
    .replace(gtRegex, '>')
    .replace(quotRegex, '"')
    .replace(singleQuotRegex, '\'')
    .replace(singleQuotRegexAlt, '\'')
}
171804
function escapeColons(url) {
        var answer = url;
        if (_.startsWith(url, 'proxy')) {
            answer = url.replace(/:/g, '\\:');
        }
        else {
            answer = url.replace(/:([^\/])/, '\\:$1');
        }
        return answer;
    }
967108
function decodeTags (tags) {
  let elementType = 'p';
  const classes = [];
  tags.forEach(tag => {
    if (typeof tag !== 'string') return;
    const foundTag = tag.match(/^<([\w-]+)>$/);
    if (foundTag) {
      elementType = foundTag[1];
      return;
    }
    const foundClass = tag.match(/^\.([\w-]+)$/);
    if (foundClass) {
      classes.push(foundClass[1]);
      return;
    }
  });
  return {elementType, classes};
}
1294277
def _escape(self, text):
        """"""
        ret = EMPTYSTRING if text is None else str(text)
        if self.escape:
            return html_escape(ret)
        else:
            return ret
518793
function (text) {
			if (typeof text === 'undefined') {
				// Unescape characters
				if (node.C) {
					return node.C.replace(/\\([\\:\]])/g, '$1');
				} else {
					return '';
				}
			} else {
				// Escape characters
				node.C = text.replace(/[\\:\]]/g, '\\$&');
			}
		}
1064166
def encr_tags(self) -> dict:
        

        return {t: self._tags[t] for t in self.tags or {} if not t.startswith('~')} or None
745154
def do_striptags(value):
    
    if hasattr(value, '__html__'):
        value = value.__html__()
    return Markup(text_type(value)).striptags()
523601
function escape(content) {
    return content.replace(/(["'\\])/g, '\\$1')
      .replace(/[\f]/g, "\\f")
      .replace(/[\b]/g, "\\b")
      .replace(/[\n]/g, "\\n")
      .replace(/[\t]/g, "\\t")
      .replace(/[\r]/g, "\\r");
  }