Function: escapeNode
Escape the node part (also called local part) of a JID.

Parameters:
(String) node - A node (or local part).

Returns:
An escaped node (or local part).
344711
function (node)
    {
        if (typeof node !== "string") { return node; }
        return node.replace(/^\s+|\s+$/g, '')
            .replace(/\\/g,  "\\5c")
            .replace(/ /g,   "\\20")
            .replace(/\"/g,  "\\22")
            .replace(/\&/g,  "\\26")
            .replace(/\'/g,  "\\27")
            .replace(/\//g,  "\\2f")
            .replace(/:/g,   "\\3a")
            .replace(/</g,   "\\3c")
            .replace(/>/g,   "\\3e")
            .replace(/@/g,   "\\40");
    }
17466
function( node ){
			var out = '',
				j = 0;

			// we do not want the outer container
			if(node.childNodes && node.childNodes.length > 0){
				for (j = 0; j < node.childNodes.length; j++) {
					var text = this.walkTreeForHtml( node.childNodes[j] );
					if(text !== undefined){
						out += text;
					}
				}
			}

			return out;
		}
1303238
def _ensure_node(node: Union[str, AbstractNode]) -> AbstractNode:
    
    if isinstance(node, str):
        return Text(node)
    elif isinstance(node, Node):
        return node
    else:
        raise TypeError('Invalid type to append: {}'.format(node))
215926
function escapeXml (string) {
    return String(string).replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
  }
96268
function factory(options) {
  return escape

  // Escape punctuation characters in a node’s value.
  function escape(value, node, parent) {
    var self = this
    var gfm = options.gfm
    var commonmark = options.commonmark
    var pedantic = options.pedantic
    var markers = commonmark ? [dot, rightParenthesis] : [dot]
    var siblings = parent && parent.children
    var index = siblings && siblings.indexOf(node)
    var prev = siblings && siblings[index - 1]
    var next = siblings && siblings[index + 1]
    var length = value.length
    var escapable = escapes(options)
    var position = -1
    var queue = []
    var escaped = queue
    var afterNewLine
    var character
    var wordCharBefore
    var wordCharAfter
    var offset
    var replace

    if (prev) {
      afterNewLine = text(prev) && blankExpression.test(prev.value)
    } else {
      afterNewLine =
        !parent || parent.type === 'root' || parent.type === 'paragraph'
    }

    while (++position < length) {
      character = value.charAt(position)
      replace = false

      if (character === '\n') {
        afterNewLine = true
      } else if (
        character === backslash ||
        character === graveAccent ||
        character === asterisk ||
        (character === exclamationMark &&
          value.charAt(position + 1) === leftSquareBracket) ||
        character === leftSquareBracket ||
        character === lessThan ||
        (character === ampersand && prefix(value.slice(position)) > 0) ||
        (character === rightSquareBracket && self.inLink) ||
        (gfm && character === tilde && value.charAt(position + 1) === tilde) ||
        (gfm &&
          character === verticalBar &&
          (self.inTable || alignment(value, position))) ||
        (character === underscore &&
          // Delegate leading/trailing underscores to the multinode version below.
          position > 0 &&
          position < length - 1 &&
          (pedantic ||
            !alphanumeric(value.charAt(position - 1)) ||
            !alphanumeric(value.charAt(position + 1)))) ||
        (gfm && !self.inLink && character === colon && protocol(queue.join('')))
      ) {
        replace = true
      } else if (afterNewLine) {
        if (
          character === greaterThan ||
          character === numberSign ||
          character === asterisk ||
          character === dash ||
          character === plusSign
        ) {
          replace = true
        } else if (decimal(character)) {
          offset = position + 1

          while (offset < length) {
            if (!decimal(value.charAt(offset))) {
              break
            }

            offset++
          }

          if (markers.indexOf(value.charAt(offset)) !== -1) {
            next = value.charAt(offset + 1)

            if (!next || next === space || next === tab || next === lineFeed) {
              queue.push(value.slice(position, offset))
              position = offset
              character = value.charAt(position)
              replace = true
            }
          }
        }
      }

      if (afterNewLine && !whitespace(character)) {
        afterNewLine = false
      }

      queue.push(replace ? one(character) : character)
    }

    // Multi-node versions.
    if (siblings && text(node)) {
      // Check for an opening parentheses after a link-reference (which can be
      // joined by white-space).
      if (prev && prev.referenceType === shortcut) {
        position = -1
        length = escaped.length

        while (++position < length) {
          character = escaped[position]

          if (character === space || character === tab) {
            continue
          }

          if (character === leftParenthesis || character === colon) {
            escaped[position] = one(character)
          }

          break
        }

        // If the current node is all spaces / tabs, preceded by a shortcut,
        // and followed by a text starting with `(`, escape it.
        if (
          text(next) &&
          position === length &&
          next.value.charAt(0) === leftParenthesis
        ) {
          escaped.push(backslash)
        }
      }

      // Ensure non-auto-links are not seen as links.  This pattern needs to
      // check the preceding nodes too.
      if (
        gfm &&
        !self.inLink &&
        text(prev) &&
        value.charAt(0) === colon &&
        protocol(prev.value.slice(-6))
      ) {
        escaped[0] = one(colon)
      }

      // Escape ampersand if it would otherwise start an entity.
      if (
        text(next) &&
        value.charAt(length - 1) === ampersand &&
        prefix(ampersand + next.value) !== 0
      ) {
        escaped[escaped.length - 1] = one(ampersand)
      }

      // Escape exclamation marks immediately followed by links.
      if (
        next &&
        next.type === 'link' &&
        value.charAt(length - 1) === exclamationMark
      ) {
        escaped[escaped.length - 1] = one(exclamationMark)
      }

      // Escape double tildes in GFM.
      if (
        gfm &&
        text(next) &&
        value.charAt(length - 1) === tilde &&
        next.value.charAt(0) === tilde
      ) {
        escaped.splice(escaped.length - 1, 0, backslash)
      }

      // Escape underscores, but not mid-word (unless in pedantic mode).
      wordCharBefore = text(prev) && alphanumeric(prev.value.slice(-1))
      wordCharAfter = text(next) && alphanumeric(next.value.charAt(0))

      if (length === 1) {
        if (
          value === underscore &&
          (pedantic || !wordCharBefore || !wordCharAfter)
        ) {
          escaped.unshift(backslash)
        }
      } else {
        if (
          value.charAt(0) === underscore &&
          (pedantic || !wordCharBefore || !alphanumeric(value.charAt(1)))
        ) {
          escaped.unshift(backslash)
        }

        if (
          value.charAt(length - 1) === underscore &&
          (pedantic ||
            !wordCharAfter ||
            !alphanumeric(value.charAt(length - 2)))
        ) {
          escaped.splice(escaped.length - 1, 0, backslash)
        }
      }
    }

    return escaped.join('')

    function one(character) {
      return escapable.indexOf(character) === -1
        ? entities[character]
        : backslash + character
    }
  }
}
633787
def _format_node_name(self, record, node, extra=None):
        
        line = ""
        if extra is not None:
            line = "%s(offset=%s, %s)" % (node.__class__.__name__, hex(node.offset() - record.offset()), extra)
        else:
            line = "%s(offset=%s)" % (node.__class__.__name__, hex(node.offset() - record.offset()))

        if isinstance(node, e_nodes.VariantTypeNode):
            line += " --> %s" % (node.string())
        if isinstance(node, e_nodes.OpenStartElementNode):
            line += " --> %s" % (node.tag_name())
        if isinstance(node, e_nodes.AttributeNode):
            line += " --> %s" % (node.attribute_name().string())
        return line
752069
function inlineNode( node ) {
		return node.type == CKEDITOR.NODE_TEXT ||
			node.type == CKEDITOR.NODE_ELEMENT && DTD.$inline[ node.name ];
	}
1194475
def escape_string(self, value):
        
        if isinstance(value, EscapedString):
            return value.formatted(self._escaper)
        return self._escaper(value)
1216210
function formatNodeValue(node, profile) {
	if (node.value != null && reNl.test(node.value)) {
		const indent = profile.indent(1);
		return splitByLines(node.value).map((line, i) => `${indent}${i ? ' ' : '|'} ${line}`).join('\n');
	}

	return node.value;
}
407902
function escapedValue (data, info, str) {
    return he.escape(getValue(data, info, str) + '')
  }
709530
function inspectNode(node) {
            if (!node) {
                return "[No node]";
            }
            if (crashyTextNodes && isBrokenNode(node)) {
                return "[Broken node]";
            }
            if (isCharacterDataNode(node)) {
                return '"' + node.data + '"';
            }
            if (node.nodeType == 1) {
                var idAttr = node.id ? ' id="' + node.id + '"' : "";
                return "<" + node.nodeName + idAttr + ">[index:" + getNodeIndex(node) + ",length:" + node.childNodes.length + "][" + (node.innerHTML || "[innerHTML not supported]").slice(0, 25) + "]";
            }
            return node.nodeName;
        }
138832
def escape(self):
        
        if not self.escaped:
            post = sax.encoder.encode(self)
            escaped = post != self
            return Text(post, lang=self.lang, escaped=escaped)
        return self
1199723
def node(node, indent)
      # Pretty print
      if @settings[:pretty]
        indentation = ' ' * indent
        inline = Settings::INLINE_NODE.include? node[@value]

        indentate = proc do
          if @in_definition
            buffer "' ' * (indent + #{indent})"
          else
            buffer_freeze indentation
          end
        end

        if inline
          inline_last_sibling = @sibling_stack[-1][-1] ? Settings::INLINE_NODE.include?(@sibling_stack[-1][-1][1]) : true

          if @sibling_stack[-1][-1] && @sibling_stack[-1][-1][0] == :plain
            buffer_remove_trailing_newline
          end

          if @in_definition || @sibling_stack[-1].length == 1 || !inline_last_sibling
            indentate[]
          end
        else
          indentate[]
        end

        @sibling_stack[-1] << [node[@type], node[@value]]
        @sibling_stack << [[node[@type], node[@value]]]
      end

      # Add the tag opening, with leading whitespace to the code buffer
      buffer_freeze ' ' if node[@options][:leading_whitespace]
      buffer_freeze "<#{node[@value]}"

      # Evaluate node extension in the current context
      if node[@options][:extension]
        extension_name = buffer_set_variable :extension,
                                             node[@options][:extension][@value]

        extension = {
          name: extension_name,
          escaped: node[@options][:extension][@options][:escaped]
        }
      end

      # Evaluate and generate node attributes, then process each one to
      # by generating the required attribute code
      buffer_attributes node[@options][:attributes],
                        extension


      # Check if the current node is self enclosing. Self enclosing nodes
      # do not have any child elements
      if node[@options][:self_enclosing]
        # If the tag is self enclosing, it cannot have any child elements.
        buffer_freeze '>'

        # Pretty print
        buffer_freeze "\n" if @settings[:pretty]

        # If we mistakenly add children to self enclosing nodes,
        # process each child element as if it was correctly indented
        # node[@children].each do |child|
        #   root child, indent + @settings[:indent]
        # end
      else
        # Set tag ending code
        buffer_freeze '>'

        # Pretty print
        if @settings[:pretty]
          if node[@children].length > 0
            buffer_freeze "\n" unless inline
          end
          # @sibling_stack << [[node[@type], node[@value]]]
        end

        # Process each child element recursively, increasing indentation
        node[@children].each do |child|
          root child, indent + @settings[:indent]
        end

        inline_last_child = @sibling_stack[-1][-2] &&
                            (@sibling_stack[-1][-2][0] == :plain ||
                              Settings::INLINE_NODE.include?(@sibling_stack[-1][-2][1]))

        # Pretty print
        if @settings[:pretty]
          if node[@children].length > 1 && inline_last_child
            buffer_freeze "\n"
          end

          if node[@children].size > 0 && !inline
            indentate[]
          end
        end

        # Set tag closing code
        buffer_freeze "</#{node[@value]}>"
        buffer_freeze ' ' if node[@options][:trailing_whitespace]

        # Pretty print
        if @settings[:pretty]
          buffer_freeze "\n" if !inline || @in_definition
        end
      end

      if @settings[:pretty]
        @sibling_stack.pop
      end
    end
268397
def quote_edge(identifier):
    
    node, _, rest = identifier.partition(':')
    parts = [quote(node)]
    if rest:
        port, _, compass = rest.partition(':')
        parts.append(quote(port))
        if compass:
            parts.append(compass)
    return ':'.join(parts)
300083
def _xml_escape(data):
    """"""

    # ampersand must be replaced first
    from_symbols = '&><"\''
    to_symbols = ('&'+s+';' for s in "amp gt lt quot apos".split())
    for from_,to_ in zip(from_symbols, to_symbols):
        data = data.replace(from_, to_)
    return data
624925
function(node) {
			var label = node.name;
			//include id if present
			var match = /id=['"]\S*["']/.exec(node.raw); //$NON-NLS-0$
			if (match) {
				label = label + " " + match[0]; //$NON-NLS-0$
			}
			//include class if present
			match = /class=['"]\S*["']/.exec(node.raw); //$NON-NLS-0$
			if (match) {
				label = label + " " + match[0]; //$NON-NLS-0$
			}
			return label;
		}
854175
private void transformTextNode(Node node) {

        // only do some output if we are in writing mode
        if (m_write) {
            String helpString = node.getNodeValue();
            m_tempString.append(helpString);
        }
    }