Link an element with compiled configuration
343497
function linkElement(compileData, options){
          angular.extend(compileData.locals, options);

          var element = compileData.link(options.scope);

          // Search for parent at insertion time, if not specified
          options.element = element;
          options.parent = findParent(element, options);
          if (options.themable) $mdTheming(element);

          return element;
        }
264953
def add_link(self, rel, value, href=None):
        
        links_node = self.metadata.find('links')
        if links_node is None:
            links_node = ioc_et.make_links_node()
            self.metadata.append(links_node)
        link_node = ioc_et.make_link_node(rel, value, href)
        links_node.append(link_node)
        return True
457423
def _attach_config(mfg_event, record):
  """"""
  if 'config' not in record.metadata:
    return
  attachment = mfg_event.attachment.add()
  attachment.name = 'config'
  attachment.value_binary = _convert_object_to_json(record.metadata['config'])
  attachment.type = test_runs_pb2.TEXT_UTF8
975987
protected function compile()
	{
		// get included elements
		if($this->objWrapper->getType() == ContentWrapper\Model::TYPE_START) {
			$this->Template->count = ContentWrapper\Repository::countRelatedElements($this->objWrapper);

			$cssID = $this->cssID;

			if($cssID[0] == '') {
				$cssID[0] = sprintf($this->strIdentifier, $this->id);
				$this->cssID = $cssID;
			}
		}
		// generate css identifier
		else {
			$start = \ContentModel::findByPk($this->bootstrap_parentId);

			if($start !== null) {
				$start = new Attributes($start);
				$start->registerNamespaceAttributes($this->arrBootstrapAttributes);
				$start->cssID = deserialize($start->cssID, true);

				$this->Template->start = $start;

				if($start->cssID[0] == '') {
					$cssID = $start->cssID;
					$cssID[0] = sprintf($this->strIdentifier, $start->id);
					$this->cssID = $cssID;
				}
				else {
					$this->cssID = $start->cssID;
				}
			}
		}

		$this->Template->identifier = $this->cssID[0];
	}
744031
function (rootdir, configData, platform) {
        var configFiles = lib.getConfigFilesByTargetAndParent(rootdir, platform),
            type = 'configFile';

        for (var key in configFiles) {
            if (configFiles.hasOwnProperty(key)) {
                var configFile = configFiles[key];

                var keyParts = key.split('|');
                var target = keyParts[0];
                var parent = keyParts[1];
                var items = configData[target] || [];

                configFile.getchildren().forEach(function (element) {
                    items.push({
                        parent: parent,
                        type: type,
                        destination: element.tag,
                        data: element
                    });
                });

                configData[target] = items;
            }
        }
    }
148694
function compile(
  source,
  filename = '',
  includeModule = false,
  debugMode = false,
) {
  let res
  let resName
  let errors

  try {
    const [moduleName, bsCode, diagnosticErrors] = Retyped.compile(filename, source, debugMode)
    const fmtCode = format(bsCode)
    res = fmtCode
    resName = moduleName
    errors = diagnosticErrors
  } catch (e) {
    console.error(e)
    throw new Error(`${e[0][0]}`)
  }

  if (res.includes('SYNTAX ERROR>')) {
    throw new Error(res)
  }

  if (!includeModule) {
    return res
  } else {
    return {
      moduleName: resName,
      bsCode: res,
      diagnosticErrors: errors
    }
  }
}
1218423
def iter_links_link_element(self, element):
        '''
        '''
        rel = element.attrib.get('rel', '')
        stylesheet = 'stylesheet' in rel
        icon = 'icon' in rel
        inline = stylesheet or icon

        if stylesheet:
            link_type = LinkType.css
        elif icon:
            link_type = LinkType.media
        else:
            link_type = None

        for attrib_name, link in self.iter_links_by_attrib(element):
            yield LinkInfo(
                element=element, tag=element.tag, attrib=attrib_name,
                link=link,
                inline=inline, linked=not inline,
                base_link=None,
                value_type='plain',
                link_type=link_type
            )
539881
function withConfig(fn) {
  return (source, options={}) => {
    options.type = 'dom';
    options.client = options.client || rp;

    return fn(source, options);
  }
}
402105
function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective,
                        previousCompileContext) {
      if (!($compileNodes instanceof jqLite)) {
        // jquery always rewraps, whereas we need to preserve the original selector so that we can
        // modify it.
        $compileNodes = jqLite($compileNodes);
      }
      // We can not compile top level text elements since text nodes can be merged and we will
      // not be able to attach scope data to them, so we will wrap them in <span>
      forEach($compileNodes, function(node, index){
        if (node.nodeType == 3 /* text node */ && node.nodeValue.match(/\S+/) /* non-empty */ ) {
          $compileNodes[index] = node = jqLite(node).wrap('<span></span>').parent()[0];
        }
      });
      var compositeLinkFn =
              compileNodes($compileNodes, transcludeFn, $compileNodes,
                           maxPriority, ignoreDirective, previousCompileContext);
      return function publicLinkFn(scope, cloneConnectFn, transcludeControllers){
        assertArg(scope, 'scope');
        // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart
        // and sometimes changes the structure of the DOM.
        var $linkNode = cloneConnectFn
          ? JQLitePrototype.clone.call($compileNodes) // IMPORTANT!!!
          : $compileNodes;

        forEach(transcludeControllers, function(instance, name) {
          $linkNode.data('$' + name + 'Controller', instance);
        });

        // Attach scope only to non-text nodes.
        for(var i = 0, ii = $linkNode.length; i<ii; i++) {
          var node = $linkNode[i];
          if (node.nodeType == 1 /* element */ || node.nodeType == 9 /* document */) {
            $linkNode.eq(i).data('$scope', scope);
          }
        }
        safeAddClass($linkNode, 'ng-scope');
        if (cloneConnectFn) cloneConnectFn($linkNode, scope);
        if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode);
        return $linkNode;
      };
    }
426892
private function compileConfiguration()
    {
        $code = '';
        $configurationByWrapper = [];
        foreach ($this->configurations as $key => $configuration) {
            if(!isset($configurationByWrapper[$configuration->getIdWrapper()])){
                $configurationByWrapper[$configuration->getIdWrapper()] = [];
            }
            $data = array();
            $data['key'] = $configuration->getKey();
            $data['value'] = $configuration->getValue();
            $data['active'] = $configuration->getActive();
            $data['id'] = $configuration->getId();
            $configurationByWrapper[$configuration->getIdWrapper()][] = $data;
        }
        foreach ($configurationByWrapper as $id => $data) {
            $code .= sprintf("'%s' => %s,",$id,var_export($data,true));
        }

        return $code;
    }
536331
def _link_to(self, linked_picker):
        """"""
        yformat = self.config['options']['format'].replace('-01-01', '-12-31')
        self.config['options']['format'] = yformat
768953
function link (presetModulePath, keep) {
  debug(`input ${presetModulePath}`)

  console.log('update config file:')

  findConfigFiles(presetModulePath)
    .forEach(configFilePath => {
      updateConfigFiles(configFilePath, keep)
    })
}
1059164
private void relink(DOMOutputElement parent, Element element)
    {
        super.relink(parent);
        mParent = parent;
        mElement = element;
        parent.appendNode(element);
        mDefaultNsSet = false;
    }
1254081
async function compileConfig(config) {

  const linter = new Linter({
    resolver: new NodeResolver()
  });

  const resolvedRules = await linter.resolveConfiguredRules(config);

  // only process and serialize enabled rules
  const enabledRules = Object.keys(resolvedRules).reduce(function(enabledRules, key) {
    const value = resolvedRules[key];

    const { category } = linter.parseRuleValue(value);

    if (category !== 'off') {
      enabledRules[key] = value;
    }

    return enabledRules;
  }, {});

  const serializedRules = JSON.stringify(enabledRules, null, '  ');

  const preambleCode = `
var cache = {};

/**
 * A resolver that caches rules and configuration as part of the bundle,
 * making them accessible in the browser.
 *
 * @param {Object} cache
 */
function Resolver() {}

Resolver.prototype.resolveRule = function(pkg, ruleName) {

  const rule = cache[pkg + '/' + ruleName];

  if (!rule) {
    throw new Error('cannot resolve rule <' + pkg + '/' + ruleName + '>');
  }

  return rule;
};

Resolver.prototype.resolveConfig = function(pkg, configName) {
  throw new Error(
    'cannot resolve config <' + configName + '> in <' + pkg +'>'
  );
};

var resolver = new Resolver();

var rules = ${serializedRules};

var config = {
  rules: rules
};

var bundle = {
  resolver: resolver,
  config: config
};

export { resolver, config };

export default bundle;
`;

  const importCode = Object.keys(enabledRules).map((key, idx) => {

    const {
      pkg, ruleName
    } = linter.parseRuleName(key);

    return `
import rule_${idx} from '${pkg}/rules/${ruleName}';
cache['${pkg}/${ruleName}'] = rule_${idx};`;
  }).join('\n');

  return `${preambleCode}\n\n${importCode}`;
}
563216
function buildElementTag( def, code, varName ) {
    const attribs = extractAttribs( def );

    try {
        const arr = Object.keys( attribs.standard );
        code.requires[ "Tag" ] = "require('tfw.view').Tag";
        code.section.elements.define.push(
            "const " + varName + " = new Tag('" + def[ 0 ] + "'" +
            ( arr.length > 0 ? ', ' + JSON.stringify( arr ) : '' ) +
            ");" );

        const initAttribs = buildElementTagAttribsStandard( attribs.standard, code, varName );
        buildInitAttribsForTag( initAttribs, code, varName );
        buildElementEvents( attribs.special, code, varName );
        buildElementTagClassSwitcher( attribs.special, code, varName );
        buildElementTagAttribSwitcher( attribs.special, code, varName );
        buildElementTagStyle( attribs.special, code, varName );
        buildElementTagChildren( attribs.special, code, varName );
        buildElementTagOn( attribs.special, code, varName );
    } catch ( ex ) {
        throw ex + "\n...in tag \"" + varName + "\": " + limitJson( def );
    }
}
1103189
function (sourceBuffer, aNode, tagNameVariable) {
        var props = aNode.props;
        var bindDirective = aNode.directives.bind;
        var tagName = aNode.tagName;

        if (tagName) {
            sourceBuffer.joinString('<' + tagName);
        }
        else if (tagNameVariable) {
            sourceBuffer.joinString('<');
            sourceBuffer.joinRaw(tagNameVariable + ' || "div"');
        }
        else {
            sourceBuffer.joinString('<div');
        }

        // index list
        var propsIndex = {};
        each(props, function (prop) {
            propsIndex[prop.name] = prop;

            if (prop.name !== 'slot' && prop.expr.value != null) {
                sourceBuffer.joinString(' ' + prop.name + '="' + prop.expr.segs[0].literal + '"');
            }
        });

        each(props, function (prop) {
            if (prop.name === 'slot' || prop.expr.value != null) {
                return;
            }

            if (prop.name === 'value') {
                switch (tagName) {
                    case 'textarea':
                        return;

                    case 'select':
                        sourceBuffer.addRaw('$selectValue = '
                            + compileExprSource.expr(prop.expr)
                            + ' || "";'
                        );
                        return;

                    case 'option':
                        sourceBuffer.addRaw('$optionValue = '
                            + compileExprSource.expr(prop.expr)
                            + ';'
                        );
                        // value
                        sourceBuffer.addRaw('if ($optionValue != null) {');
                        sourceBuffer.joinRaw('" value=\\"" + $optionValue + "\\""');
                        sourceBuffer.addRaw('}');

                        // selected
                        sourceBuffer.addRaw('if ($optionValue === $selectValue) {');
                        sourceBuffer.joinString(' selected');
                        sourceBuffer.addRaw('}');
                        return;
                }
            }

            switch (prop.name) {
                case 'readonly':
                case 'disabled':
                case 'multiple':
                    if (prop.raw === '') {
                        sourceBuffer.joinString(' ' + prop.name);
                    }
                    else {
                        sourceBuffer.joinRaw('boolAttrFilter("' + prop.name + '", '
                            + compileExprSource.expr(prop.expr)
                            + ')'
                        );
                    }
                    break;

                case 'checked':
                    if (tagName === 'input') {
                        var valueProp = propsIndex.value;
                        var valueCode = compileExprSource.expr(valueProp.expr);

                        if (valueProp) {
                            switch (propsIndex.type.raw) {
                                case 'checkbox':
                                    sourceBuffer.addRaw('if (contains('
                                        + compileExprSource.expr(prop.expr)
                                        + ', '
                                        + valueCode
                                        + ')) {'
                                    );
                                    sourceBuffer.joinString(' checked');
                                    sourceBuffer.addRaw('}');
                                    break;

                                case 'radio':
                                    sourceBuffer.addRaw('if ('
                                        + compileExprSource.expr(prop.expr)
                                        + ' === '
                                        + valueCode
                                        + ') {'
                                    );
                                    sourceBuffer.joinString(' checked');
                                    sourceBuffer.addRaw('}');
                                    break;
                            }
                        }
                    }
                    break;

                default:
                    var onlyOneAccessor = false;
                    var preCondExpr;

                    if (prop.expr.type === ExprType.ACCESSOR) {
                        onlyOneAccessor = true;
                        preCondExpr = prop.expr;
                    }
                    else if (prop.expr.segs.length === 1) {
                        var interpExpr = prop.expr.segs[0];
                        var interpFilters = interpExpr.filters;

                        if (!interpFilters.length
                            || interpFilters.length === 1 && interpFilters[0].args.length === 0
                        ) {
                            onlyOneAccessor = true;
                            preCondExpr = prop.expr.segs[0].expr;
                        }
                    }

                    if (onlyOneAccessor) {
                        sourceBuffer.addRaw('if (' + compileExprSource.expr(preCondExpr) + ') {');
                    }

                    sourceBuffer.joinRaw('attrFilter("' + prop.name + '", '
                        + (prop.x ? 'escapeHTML(' : '')
                        + compileExprSource.expr(prop.expr)
                        + (prop.x ? ')' : '')
                        + ')'
                    );

                    if (onlyOneAccessor) {
                        sourceBuffer.addRaw('}');
                    }

                    break;
            }
        });

        if (bindDirective) {
            sourceBuffer.addRaw(
                '(function ($bindObj) {for (var $key in $bindObj) {'
                + 'var $value = $bindObj[$key];'
            );

            if (tagName === 'textarea') {
                sourceBuffer.addRaw(
                    'if ($key === "value") {'
                    + 'continue;'
                    + '}'
                );
            }

            sourceBuffer.addRaw('switch ($key) {\n'
                + 'case "readonly":\n'
                + 'case "disabled":\n'
                + 'case "multiple":\n'
                + 'case "multiple":\n'
                + 'html += boolAttrFilter($key, escapeHTML($value));\n'
                + 'break;\n'
                + 'default:\n'
                + 'html += attrFilter($key, escapeHTML($value));'
                + '}'
            );

            sourceBuffer.addRaw(
                '}})('
                + compileExprSource.expr(bindDirective.value)
                + ');'
            );
        }

        sourceBuffer.joinString('>');
    }
275375
function (config) {
			if (config) {
				if (config.element) {
					this.expect.element(config.element).to.be.present;
				} else {
					throw new Error('adminUIApp:must specify an element!');
				}
			} else {
				throw new Error('adminUIApp:invalid config specification!');
			}
			return this;
		}