Render the value of an element's attribute
@param  {String|Object} values  VTree object for the attribute value
@param  {Context}       context current Context to evaluate in
@return {String}                String value for the attribute
326570
function renderAttributeString(values, context) {
  if (typeof values === 'string' || typeof values === 'boolean') {
    return values;
  }

  var buffer = '';
  var toString = new ToString();
  for (var i = 0; i < values.length; i++) {
    toString.clear();
    render(toString, values[i], context);
    buffer += toString.getOutput();
  }

  return buffer;
}
527649
function resolveAttributeValue(value, part) {
  if (isDirective(value)) {
    value = resolveDirectiveValue(value, part);
  }

  if (value === nothingString) {
    return value;
  }

  if (isTemplateResult(value)) {
    value = value.read();
  }

  if (isPrimitive(value)) {
    const string = typeof value !== 'string' ? String(value) : value;
    // Escape if not prefixed with unsafePrefixString, otherwise strip prefix
    return Buffer.from(
      string.indexOf(unsafePrefixString) === 0 ? string.slice(33) : escapeHTML(string)
    );
  } else if (Buffer.isBuffer(value)) {
    return value;
  } else if (isPromise(value)) {
    return value.then((value) => resolveAttributeValue(value, part));
  } else if (isSyncIterator(value)) {
    if (!Array.isArray(value)) {
      value = Array.from(value);
    }
    return Buffer.concat(
      value.reduce((values, value) => {
        value = resolveAttributeValue(value, part);
        // Flatten
        if (Array.isArray(value)) {
          return values.concat(value);
        }
        values.push(value);
        return values;
      }, [])
    );
  } else {
    throw Error('unknown AttributPart value', value);
  }
}
684561
def render_js_template(self, template_path, element_id, context=None):
        
        context = context or {}
        return u"<script type='text/template' id='{}'>\n{}\n</script>".format(
            element_id,
            self.render_template(template_path, context)
        )
404130
private function buildXMLAttributesString(Context $context) {
		$result = '';
		$matches = null;
		$attributes = $this->attributes;

		$runtimeAttributes = $context->getRuntimeAttributes();

		foreach($runtimeAttributes as $attributeName=>$runtimeAttr) {
			$attributes[$attributeName] = $runtimeAttr;
		}

		foreach($attributes as $attribute=>$value) {

			if( ! $context->view->isFigPrefix($attribute)) {
                // a flag attribute is to be processed differently because
                // it isn't a key=value pair.

                if ($value instanceof Flag) {
                    // Flag attribute: there is no value. We print only the name of the flag.
                    $result .= " $attribute";
                } else {

				    // We're potentially in presence of:
                    // - a plain scalar
                    // - an AdHoc instance
                    // - an array of the above.
                    // - an inline conditional attribute: InlineCondAttr

                    if ($value instanceof InlineCondAttr) {
                        /** @var InlineCondAttr $inlineCondAttr */
                        $inlineCondAttr = $value;
                        if ($this->evaluate($context, $inlineCondAttr->cond)) {
                            $value = $this->evaluate($context, $inlineCondAttr->val);
                        }
                        else {
                            continue;
                        }
                    }

                    if (! is_array($value)) {
                        $value = [$value];
                    }
                    $combined = '';
                    foreach ($value as $part) {
                        if ($part instanceof AdHoc) {
                            $evaluatedValue = $this->evaluate($context, $part->string);

                            if($evaluatedValue instanceof ViewElement) {
                                $evaluatedValue = $evaluatedValue->render($context);
                            }
                            if(is_array($evaluatedValue)) {
                                if(empty($evaluatedValue)) {
                                    $evaluatedValue = '';
                                } else {
                                    $message = 'Adhoc {' . $part->string . '} of attribute ' . $attribute . ' in tag "' . $this->name . '" evaluated to array.';
                                    throw new TagRenderingException($this->getTagName(), $this->getLineNumber(), $message);
                                }
                            } else if (is_object($evaluatedValue)
                                && ($evaluatedValue instanceof \DOMNode)) {

                                // Treat the special case of DOMNode descendants,
                                // for which we can evalute the text contents
                                $evaluatedValue = $evaluatedValue->nodeValue;
                            }

                            //The outcome of the evaluatedValue, coming from DB or other, might contain non-standard HTML characters.
                            //We assume that the FIG library targets HTML rendering.
                            //Therefore, let's have the outcome comply with HTML.
                            if(is_object($evaluatedValue)) {
                                //TODO: Log some warning!
                                $evaluatedValue = '### Object of class: ' . get_class($evaluatedValue) . ' ###';
                            } else {
                                $evaluatedValue = htmlspecialchars($evaluatedValue);
                            }

                            $part = $evaluatedValue;
                        }

                        // Append to what we had already (and if $part was a string in the first place,
                        // we use its direct value;
                        $combined .= $part;


                    }
                    $value = $combined;

                    $result .= " $attribute=\"$value\"";
				}
            }

        }
		return $result;
	}
948067
function handleAttributeContext(attrNode, context) {
    if (!attrNode.type && attrNode.inherit !== 'inherit') attrNode.type = 'string';

    if (attrNode.map) {
        Object.keys(attrNode.map).forEach(mappingName => {
            const mapping = attrNode.map[mappingName];

            Object.keys(mapping).forEach(dataSourceName => {
                if (!context.dataSourceAttributes[dataSourceName]) {
                    throw new ImplementationError(
                        `Unknown DataSource "${dataSourceName}" in map${context.errorContext}`
                    );
                }

                context.dataSourceAttributes[dataSourceName].push(mapping[dataSourceName]);
            });
        });

        if ('value' in attrNode) {
            throw new ImplementationError(
                'Static "value" in combination with "map" makes no sense' + context.errorContext
            );
        }
    }
}
702276
@Override
    public Object render(Map<String, Object> context, LNode... nodes) {

        // The group-name is either the first token-expression, or if that is
        // null (indicating there is no name), give it the name PREPEND followed
        // by the number of expressions in the cycle-group.
        String groupName = nodes[0] == null ?
                PREPEND + (nodes.length - 1) :
                super.asString(nodes[0].render(context));

        // Prepend a groupName with a single- and double quote as to not
        // let the groupName conflict with other variable assignments
        groupName = PREPEND + groupName;

        Object obj = context.remove(groupName);

        List<Object> elements = new ArrayList<Object>();

        for (int i = 1; i < nodes.length; i++) {
            elements.add(nodes[i].render(context));
        }

        CycleGroup group;

        if (obj == null) {
            group = new CycleGroup(elements.size());
        }
        else {
            group = (CycleGroup) obj;
        }

        context.put(groupName, group);

        return group.next(elements);
    }
1119818
def _render(self, contexts, partials):
        """"""
        val = self._lookup(self.value, contexts)
        if val:
            return EMPTYSTRING
        return self._render_children(contexts, partials)
1239820
def render(self, name, value, attrs=None, renderer=None):
        
        if not hasattr(self, "editor_manifest"):
            self.editor_manifest = self.init_manifest(self.config_name)

        config = self.editor_manifest.get_config(self.config_name)
        if config.get('embed_config'):
            self.embed_config = True

        context = self.get_context(name, value, attrs)

        return self._render(self.template_name, context, renderer)
898610
function(element, property, values){
		values = Array.from(values);
		if (values[1] == null){
			values[1] = values[0];
			values[0] = element.getStyle(property);
		}
		var parsed = values.map(this.parse);
		return {from: parsed[0], to: parsed[1]};
	}
376718
def _render(self, value, format):
        
        template = '<script>\ndocument.write(moment(\"{t}\").{f});\n</script>'
        return Markup(template.format(t=value, f=format))
896803
function attributesToJavascript(template, attr) {
	var i, name, value, js = [];
	for (i in attr) {
		if (attr.hasOwnProperty(i)) {

			// Translate
			name = Template.HTML_ATTRIBUTES[i] ? Template.HTML_ATTRIBUTES[i] : i;

			// Potentially interpolated attributes
			if (typeof attr[i] === 'string') {
				if (attr[i].length > 0) {
					js.push(JSON.stringify(name) + ':' + (ontext(template, attr[i], {virtual: false}).pop() || new VText).toJavascript());
				} else {
					js.push(JSON.stringify(name) + ':""');
				}
			} else {
				js.push(JSON.stringify(name) + ':' + JSON.stringify(attr[i]));
			}
		}
	}

	return '{' + js.join(',') + '}';
}
1236368
private void renderAttribute(InternalStringBuilder buf, String name, String value)
    {
        assert (name != null);
        if (value == null)
            return;

        buf.append(" ");
        buf.append(name);
        buf.append("=\"");
        buf.append(value);
        buf.append("\"");
    }
475285
protected String getCellValue(final HtmlRenderingContext context, final int row, final int col,
            final Object value) {
        final String stringValue = LabelUtils.getValueLabel(value);
        return context.escapeHtml(stringValue);
    }
937486
public static String escapeAttributeValue(Object value, Context cx)
    {
        XMLLib xmlLib = currentXMLLib(cx);
        return xmlLib.escapeAttributeValue(value);
    }
82181
function renderToString(vnode, context, opts, inner, isSvgMode) {
	if (vnode==null || typeof vnode==='boolean') {
		return '';
	}

	let nodeName = vnode.type,
		attributes = vnode.props,
		isComponent = false;
	context = context || {};
	opts = opts || {};

	let pretty = opts.pretty,
		indentChar = typeof pretty==='string' ? pretty : '\t';

	// #text nodes
	if (typeof vnode!=='object' && !nodeName) {
		return encodeEntities(vnode);
	}

	// components
	if (typeof nodeName==='function') {
		isComponent = true;
		if (opts.shallow && (inner || opts.renderRootComponent===false)) {
			nodeName = getComponentName(nodeName);
		}
		else {
			let props = getNodeProps(vnode),
				rendered;

			if (!nodeName.prototype || typeof nodeName.prototype.render!=='function') {
				// stateless functional components
				rendered = nodeName(props, context);
			}
			else {
				// class-based components
				let c = new nodeName(props, context);
				// turn off stateful re-rendering:
				c._disable = c.__x = true;
				c.props = props;
				c.context = context;
				if (c.componentWillMount) c.componentWillMount();
				rendered = c.render(c.props, c.state, c.context);

				if (c.getChildContext) {
					context = assign(assign({}, context), c.getChildContext());
				}
			}

			return renderToString(rendered, context, opts, opts.shallowHighOrder!==false);
		}
	}

	// render JSX to HTML
	let s = '', html;

	if (attributes) {
		let attrs = objectKeys(attributes);

		// allow sorting lexicographically for more determinism (useful for tests, such as via preact-jsx-chai)
		if (opts && opts.sortAttributes===true) attrs.sort();

		for (let i=0; i<attrs.length; i++) {
			let name = attrs[i],
				v = attributes[name];
			if (name==='children') continue;

			if (name.match(/[\s\n\\/='"\0<>]/)) continue;

			if (!(opts && opts.allAttributes) && (name==='key' || name==='ref')) continue;

			if (name==='className') {
				if (attributes.class) continue;
				name = 'class';
			}
			else if (isSvgMode && name.match(/^xlink:?./)) {
				name = name.toLowerCase().replace(/^xlink:?/, 'xlink:');
			}

			if (name==='style' && v && typeof v==='object') {
				v = styleObjToCss(v);
			}

			let hooked = opts.attributeHook && opts.attributeHook(name, v, context, opts, isComponent);
			if (hooked || hooked==='') {
				s += hooked;
				continue;
			}

			if (name==='dangerouslySetInnerHTML') {
				html = v && v.__html;
			}
			else if ((v || v===0 || v==='') && typeof v!=='function') {
				if (v===true || v==='') {
					v = name;
					// in non-xml mode, allow boolean attributes
					if (!opts || !opts.xml) {
						s += ' ' + name;
						continue;
					}
				}
				s += ` ${name}="${encodeEntities(v)}"`;
			}
		}
	}

	// account for >1 multiline attribute
	let sub = s.replace(/^\n\s*/, ' ');
	if (sub!==s && !~sub.indexOf('\n')) s = sub;
	else if (pretty && ~s.indexOf('\n')) s += '\n';

	s = `<${nodeName}${s}>`;
	if (String(nodeName).match(/[\s\n\\/='"\0<>]/)) throw s;

	let isVoid = String(nodeName).match(VOID_ELEMENTS);
	if (isVoid) s = s.replace(/>$/, ' />');

	let pieces = [];
	if (html) {
		// if multiline, indent.
		if (pretty && isLargeString(html)) {
			html = '\n' + indentChar + indent(html, indentChar);
		}
		s += html;
	}
	else if (vnode.props.children) {
        let hasLarge = ~s.indexOf('\n');
        let children = vnode.props.children;
        if (!Array.isArray(children)) {
            children = [children]
        }
        for (let i=0; i< children.length; i++) {
            let child = children[i];
            if (child!=null && child!==false) {
                let childSvgMode = nodeName==='svg' ? true : nodeName==='foreignObject' ? false : isSvgMode,
                    ret = renderToString(child, context, opts, true, childSvgMode);
                if (!hasLarge && pretty && isLargeString(ret)) hasLarge = true;
                if (ret) pieces.push(ret);
            }
        }

		if (pretty && hasLarge) {
			for (let i=pieces.length; i--; ) {
				pieces[i] = '\n' + indentChar + indent(pieces[i], indentChar);
			}
		}
	}

	if (pieces.length) {
		s += pieces.join('');
	}
	else if (opts && opts.xml) {
		return s.substring(0, s.length-1) + ' />';
	}

	if (!isVoid) {
		if (pretty && ~s.indexOf('\n')) s += '\n';
		s += `</${nodeName}>`;
	}

	return s;
}
788757
function render(ctxt, directive){
    var fn = typeof directive === 'function' ? directive : plugins.compile( directive, false, this[0] );
    for(var i = 0, ii = this.length; i < ii; i++){
      this[i] = replaceWith( this[i], fn( ctxt, false ));
    }
    context = null;
    return this;
  }
407293
function html(strings, ...values) {
  let template = templateCache.get(strings);

  if (template === undefined) {
    template = new Template(strings, defaultTemplateProcessor);
    templateCache.set(strings, template);
  }

  return templateResult(template, values);
}