Relay Classic transforms to inline generated content.
161229
function createClassicNode(
  t: $FlowFixMe,
  path: Object,
  graphqlDefinition: DefinitionNode,
  state: BabelState,
): Object {
  if (graphqlDefinition.kind === 'FragmentDefinition') {
    return createFragmentConcreteNode(t, path, graphqlDefinition, state);
  }

  if (graphqlDefinition.kind === 'OperationDefinition') {
    return createOperationConcreteNode(t, path, graphqlDefinition, state);
  }

  throw new Error(
    'BabelPluginRelay: Expected a fragment, mutation, query, or ' +
      'subscription, got `' +
      graphqlDefinition.kind +
      '`.',
  );
}
905965
function generateMap(content, file, offset) {
  if (offset <= 0) {
    throw new RangeError('Offset parameter should be greater than zero.');
  }

  let generator = new sourceMap.SourceMapGenerator();
  let options = {
    locations: true,
    sourceType: 'module',
  };

  for (let token of tokenizer(content, options)) {
    let position = token.loc.start;

    generator.addMapping({
      source: file,
      original: {line: position.line + offset, column: position.column},
      generated: position,
      name: token.value,
    });
  }

  return generator.toJSON();
}
1094002
public void transform(Source pIn) throws JspException {
        try {
            // Create transformer
            Transformer transformer = TransformerFactory.newInstance()
                    .newTransformer(getSource(mStylesheetURI));

            // Store temporary output in a bytearray, as the transformer will
            // usually try to flush the stream (illegal operation from a custom
            // tag).
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            StreamResult out = new StreamResult(os);

            // Perform the transformation
            transformer.transform(pIn, out);

            // Write the result back to the JSP writer
            pageContext.getOut().print(os.toString());
        }
        catch (MalformedURLException murle) {
            throw new JspException(murle.getMessage(), murle);
        }
        catch (IOException ioe) {
            throw new JspException(ioe.getMessage(), ioe);
        }
        catch (TransformerException te) {
            throw new JspException("XSLT Trandformation failed: " + te.getMessage(), te);
        }
    }
1213098
def move_content_to_origin(self):
        """"""
        tcs = list(self.iter_tcs())
        origin_tc = tcs[0]
        for spanned_tc in tcs[1:]:
            origin_tc.append_ps_from(spanned_tc)
55983
function relaySkipHandleFieldTransform(
  context: CompilerContext,
): CompilerContext {
  return IRTransformer.transform(context, {
    LinkedField: visitField,
    ScalarField: visitField,
  });
}
1149047
function normalizeContent(content) {
  var fragment = document.createDocumentFragment();
  var i, len;

  if (isNode(content)) {
    return content;
  } else {
    len = content.length;
    for (i = 0; i < len; i++) { fragment.appendChild(content[i]); }
    return fragment;
  }
}
1340884
function buildJsFileContent(lines) {
    var ls = lines
        .map(l => l
            // remove space at beginning of line
            .replace(/^\s*/g, "")
            // remove space at end of line
            .replace(/\s*$/g, "")
            // convert \ to \\
            .replace(/\\/g, "\\\\")
            // convert " to \"
            .replace(/"/g, "\\\"")
            // convert " { " to "{"
            .replace(/\s*\{\s*/g, "{")
            // convert " : " to ":"
            .replace(/\s*:\s*/g, ":"))
        .join("")
        // remove comments
        .replace(/\/\*.+?\*\//g, "");

    return [
        // add css string
        `var css = "${ls}";`,
        "var enabled = false;",
        "",
        // add function which injects css into page
        "function enable () {",
        "\tif (enabled) return;",
        "\tenabled = true;",
        "",
        "\tvar el = document.createElement('style');",
        "\tel.innerHTML = css;",
        "",
        "\tvar parent = document.head || document.body;",
        "\tparent.firstChild ?",
        "\t\tparent.insertBefore(el, parent.firstChild) :",
        "\t\tparent.appendChild(el);",
        "}",
        "",
        "export {",
        "\tenable",
        "}"
    ].join("\n");
}
1121547
def transform_incoming(self, son, collection):
        """"""
        return self._transform_incoming(copy.deepcopy(son), collection)
161010
function transform(transformerCtx, options) {
    var html = options.template;
    for (var i = 0; i < transformers.length; i++) {
        html = transformers[i](html, transformerCtx, options);
    }
    return html;
}
440731
def transform(self, line, _continue_prompt):
        """'"""

        # Capture the original line
        orig_line = line

        # Get tokens from all the currently active namespace
        ns_token_set = set([token for nspace in self.shell.all_ns_refs for token in nspace])

        # Build up token set and info out of the incoming line
        token_list = re.split(' |;|,|(|)|\'|"', line)
        token_list = [item for item in token_list if item != None and item != '']
        num_tokens = len(token_list)
        first_token = token_list[0]
        token_set = set(token_list)       

        # Very conservative logic (but possibly flawed)
        # 1) Lines with any of these symbols ; , ' " ( ) aren't touched
        # 2) Need to have more than one token
        # 3) First token in line must be in the workbench command set
        # 4) If first token is 'help' than all other tokens are quoted
        # 5) Otherwise only tokens that are not in any of the namespace are quoted

        # Fixme: Horse shit temp hack for load_sample
        # 0) If load_sample do special processing
        if first_token == 'load_sample':
            # If the second arg isn't in namespace quote it
            if token_list[1] not in ns_token_set:
                line = line.replace(token_list[1], '"'+token_list[1]+'",')
            return line

        # Fixme: Horse shit temp hack for pivot
        # 0) If pivot do special processing
        if first_token == 'pivot':
            # Quote all other tokens
            for token in token_list:
                if token not in ns_token_set:
                    line = line.replace(token, '"' + token + '",')
            return line

        # 1) Lines with any of these symbols ; , ' " ( ) aren't touched
        skip_symbols = [';', ',', '\'', '"', '(', ')']
        if any([sym in line for sym in skip_symbols]):
            return line

        # 2) Need to have more than one token
        # 3) First token in line must be in the workbench command set
        if num_tokens > 1 and first_token in self.command_set:

            # 4) If first token is 'help' than all other tokens are quoted
            if first_token == 'help':
                token_set.remove('help')
                for token in token_set:
                    line = line.replace(token, '"'+token+'"')

            # 5) Otherwise only tokens that are not in any of the namespace are quoted
            else: # Not help
                for token in token_set:
                    if token not in ns_token_set:
                        line = line.replace(token, '"'+token+'"')

        # Return the processed line
        return line
742135
function processNodeContentWithPosthtml(node, options) {
	return function (content) {
		return processWithPostHtml(options.plugins, path.join(path.dirname(options.from), node.attrs.href), content, [function (tree) {
			// remove <content> tags and replace them with node's content
			return tree.match(match('content'), function () {
				return node.content || '';
			});
		}]);
	};
}
253407
function transformDefaultClassExports(content) {
  return content.replace(/^(\s*)export default (abstract )?class ([\w]+)/mg, function(m0, m1, m2, m3) {
    return m1 + 'export { ' + m3 + ' as default, ' + m3 + ' };\n' +
      m1 + (m2 || '') + 'class ' + m3
  })
}
436343
function IconvHtmlStream(options) {
    this.buff = new Buffer([]);
    this.isBuffering = true;
    this.conv = null;
    options = options || {};
    this.rewrite = (options.rewrite !== false);
    this.inputEncoding = 'utf8';
    this.encoding = options.encoding = 'utf8'; // this is the *output* encoding
    this.conv = iconv.getEncoder(this.inputEncoding);
    Transform.call(this, options);
}
464129
public void startElementContents(ElementBox elem)
    {
        //setup transformations for the contents
        AffineTransform at = Transform.createTransform(elem);
        if (at != null)
        {
            savedTransforms.put(elem, g.getTransform());
            g.transform(at);
        }
    }
776059
function transformCode(transformFn, code, url) {
  let source;
  if (url != null) {
    source = url;
  } else {
    source = 'Inline Babel script';
    inlineScriptCount++;
    if (inlineScriptCount > 1) {
      source += ' (' + inlineScriptCount + ')';
    }
  }

  return transformFn(
    code,
    {
      filename: source,
      ...babelOpts
    }
  ).code;
}
770500
function transformMedia(media, customMedias) {
	const transpiledMedias = [];

	for (const index in media.nodes) {
		const { value, nodes } = media.nodes[index];
		const key = value.replace(customPseudoRegExp, '$1');

		if (key in customMedias) {
			for (const replacementMedia of customMedias[key].nodes) {
				// use the first available modifier unless they cancel each other out
				const modifier = media.modifier !== replacementMedia.modifier
					? media.modifier || replacementMedia.modifier
				: '';
				const mediaClone = media.clone({
					modifier,
					// conditionally use the raws from the first available modifier
					raws: !modifier || media.modifier
						? { ...media.raws }
					: { ...replacementMedia.raws },
					type: media.type || replacementMedia.type,
				});

				// conditionally include more replacement raws when the type is present
				if (mediaClone.type === replacementMedia.type) {
					Object.assign(mediaClone.raws, {
						and: replacementMedia.raws.and,
						beforeAnd: replacementMedia.raws.beforeAnd,
						beforeExpression: replacementMedia.raws.beforeExpression
					});
				}

				mediaClone.nodes.splice(index, 1, ...replacementMedia.clone().nodes.map(node => {
					// use raws and spacing from the current usage
					if (media.nodes[index].raws.and) {
						node.raws = { ...media.nodes[index].raws };
					}

					node.spaces = { ...media.nodes[index].spaces };

					return node;
				}));

				// remove the currently transformed key to prevent recursion
				const nextCustomMedia = getCustomMediasWithoutKey(customMedias, key);
				const retranspiledMedias = transformMedia(mediaClone, nextCustomMedia);

				if (retranspiledMedias.length) {
					transpiledMedias.push(...retranspiledMedias);
				} else {
					transpiledMedias.push(mediaClone);
				}
			}

			return transpiledMedias;
		} else if (nodes && nodes.length) {
			transformMediaList(media.nodes[index], customMedias);
		}
	}

	return transpiledMedias;
}
661139
def _transform(self, data, escape_html, replace_links, replace_cosmetic, transform_newlines, **context):
        
        url_matches = {}
        if self.replace_links and replace_links:
            # If we're replacing links in the text (i.e. not those in [url] tags) then we need to be
            # careful to pull them out before doing any escaping or cosmetic replacement.
            pos = 0
            while True:
                match = _url_re.search(data, pos)
                if not match:
                    break
                # Replace any link with a token that we can substitute back in after replacements.
                token = '{{ bbcode-link-%s }}' % len(url_matches)
                url_matches[token] = self._link_replace(match, **context)
                start, end = match.span()
                data = data[:start] + token + data[end:]
                # To be perfectly accurate, this should probably be len(data[:start] + token), but
                # start will work, because the token itself won't match as a URL.
                pos = start
        if escape_html:
            data = self._replace(data, self.REPLACE_ESCAPE)
        if replace_cosmetic:
            data = self._replace(data, self.REPLACE_COSMETIC)
        # Now put the replaced links back in the text.
        for token, replacement in url_matches.items():
            data = data.replace(token, replacement)
        if transform_newlines:
            data = data.replace('\n', '\r')
        return data