Rendering decorator

@param string $context
@return string
558135
public function render($context)
    {
        $values = array();

        foreach ($this->vars as $var) {
            $actualRow = $this->getRow()->getActualRow();
            $values[] = $actualRow[$var];
        }
        $value = vsprintf($this->value, $values);

        $this->getRow()->addVarAttr($this->name, $value);
        return $context;
    }
1039201
public function render($name, array $context = [])
    {
        $renderedHtml = $this->twig->render($name, $context);

        foreach ($this->postProcessors as $postProcessor) {
            if ($postProcessor instanceof PostProcessorInterface) {
                $renderedHtml = $postProcessor->process($renderedHtml, $name, $context, $this->twig);
            }
        }

        return $renderedHtml;
    }
399586
function renderTemplate(template, context) {
    var esc = $(document.createElement('div'));

    function handle(ph, escape) {
      var cur = context;
      $.each(ph.split('.'), function() {
        cur = cur[this];
      });
      return escape ? esc.text(cur || "").html() : cur;
    }

    return template.replace(/<([%#])([\w\.]*)\1>/g, function() {
      return handle(arguments[2], arguments[1] == '%' ? true : false);
    });
  }
47843
def render_context(self, context, *args, **kwargs):
        
        if getattr(context, '_with_template', None) is None:
            context._set_with_template(self)
        runtime._render_context(self,
                                self.callable_,
                                context,
                                *args,
                                **kwargs)
198342
def _render_context(self, template, block, **context):
        
        return u''.join(block(template.new_context(context)))
616165
public function render($type = 'html')
    {
        $row = $this->getTable()->getRow()->getActualRow();

        $value = '';

        if (is_array($row) || $row instanceof \ArrayAccess) {
            $value = (isset($row[$this->getHeader()->getName()])) ? $row[$this->getHeader()->getName()] : '';
        } elseif (is_object($row)) {
            $headerName = $this->getHeader()->getName();
            $methodName = 'get' . ucfirst($headerName);
            if (method_exists($row, $methodName)) {
                $value = $row->$methodName();
            } else {
                $value = (property_exists($row, $headerName)) ? $row->$headerName : '';
            }
        }

        foreach ($this->decorators as $decorator) {
            if ($decorator->validConditions()) {
                $value = $decorator->render($value);
            }
        }

        if ($type == 'html') {
            $ret = sprintf("<td %s>%s</td>", $this->getAttributes(), $value);
            $this->clearVar();
            return $ret;

        } else {
            return $value;
        }
    }
1328567
public function evaluateTwigFunc($context, $twig ) {

        $loader = new \Twig_Loader_Filesystem('.');
        $env = new \Twig_Environment($loader);

        $template = $env->createTemplate($twig);

        return $template->render($context);
    }
72055
private function fig_trans(Context $context) {

        //If a @source attribute is specified, and is equal to
        //the view's target language, then don't bother translating:
        //just render the contents.
        //However, even if the fig:trans tag does not specify a "source" attribute,
        //we may look up the optional default trans source attribute
        //defined at the template level.
        $source = $this->getAttribute('source', $context->getView()->defaultTransSource);

        //The $key is also needed in logging below, even if
        //source = view's language, in case of missing value,
        //so this is a good time to read it.
        $key = $this->getAttribute('key', null);
        $dictionaryName = $this->getAttribute('dict', null);

        // Do we have a dictionary ?
        $dictionary = $context->getDictionary($dictionaryName);
        // Maybe not, but at this stage it is not important, I only need
        // to know its source
        $dicSource = ($dictionary ? $dictionary->getSource() : null);
        if (

            ( (null == $source) &&	//no source on the trans tag
                ($dicSource == $context->getView()->getLanguage()) )
            ||
            ($source == $context->getView()->getLanguage()) ) {
            $context->pushDoNotRenderFigParams();
            $value = $this->renderChildren($context /*Do not render fig:param immediate children */);
            $context->popDoNotRenderFigParams();
        } else {
            //Cross-language dictionary mechanism:

            if(null == $key) {
                //Missing @key attribute : consider the text contents as the key.
                //throw new SyntaxErrorException($this->getCurrentFile()->getFilename(), $this->xmlLineNumber, $this->name, 'Missing @key attribute.');
                $key = $this->renderChildren($context);
            }
            //Ask current context to translate key:

            $value = $context->translate($key, $dictionaryName);
        }

        //Fetch the parameters specified as immediate children
        //of the macro call : <fig:param name="" value=""/>
        //TODO: Currently, the <fig:param> of a macro call cannot hold any fig:cond or fig:case conditions.
        $arguments = array();
        foreach ($this->children as $child) {
            if($child instanceof ViewElementTag) {
                if($child->name == $context->view->figNamespace . 'param') {
                    //If param is specified with an immediate value="" attribute :
                    if(isset($child->attributes['value'])) {
                        $arguments[$child->attributes['name']] = $this->evaluate($context, $child->attributes['value']);
                    }
                    //otherwise, the actual value is not scalar but is
                    //a nodeset in itself. Let's pre-render it and use it as text for the argument.
                    else {
                        $arguments[$child->attributes['name']] = $child->render($context);
                    }
                }
            }
        }

        //We must now perform the replacements of the parameters of the translation,
        //which are written in the shape : {paramName}
        //and are specified as extra attributes of the fig:trans tag, or child fig:param tags
        //(fig:params override inline attributes).
        $matches = array();
        while(preg_match('/{([^}]+)}/', $value, $matches)) {
            $attributeName = $matches[1];
            //If there is a corresponding fig:param, use it:
            if(array_key_exists($attributeName, $arguments)) {
                $attributeValue = $arguments[$attributeName];
            }
            //Otherwise, use the inline attribute.
            else {
                $attributeValue = $this->evalAttribute($context, $attributeName);
            }
            $value = str_replace('{' . $attributeName . '}', $attributeValue, $value);
        }

        //If the translated value is empty (ie. we did find an entry in the proper dictionary file,
        //but this entry has an empty value), it means that the entry remains to be translated by the person in charge.
        //So in the meantime we output the key.
        if($value == '') {
            $value = $key;
            // TODO: One might want to be notified, either by an exception or another mechanism (Context logging?).
        }

        return $value;
    }
939487
public function render($object, string $context = null): void
    {
        if ($this->noDirectory) {
            throw new NoTemplateFoundException("Cannot render object of class ".get_class($object). '. Directory ' .$this->directory.' does not exists.');
        }
        $fileName = $this->getTemplateFileName($object, $context);

        if ($fileName != false) {
            if (method_exists($object, 'getPrivateProperties')) {
                $array = $object->getPrivateProperties();
            } else {
                $array = get_object_vars($object);
            }
            if ($fileName['type'] == 'twig') {
                if (!isset($array['this'])) {
                    $array['this'] = $object;
                }
                echo $this->twig->render($fileName['fileName'], $array);
            } else {
                // Let's store the filename into the object ($this) in order to avoid name conflict between
                // the variables.
                $this->tmpFileName = $fileName;

                extract($array);
                // Let's create a local variable
                /*foreach ($array as $var__tplt=>$value__tplt) {
                    $$var__tplt = $value__tplt;
                }*/
                include $this->directory.'/'.$this->tmpFileName['fileName'];
            }
        } else {
            throw new NoTemplateFoundException("Cannot render object of class ".get_class($object).". No template found.");
        }
    }
1015708
public function render($context)
    {
        if ($this->place || $this->place == self::RESET_CONTEXT) {
            return sprintf('<img src="%s" alt="%s" />', $this->path, $this->alt);
        } elseif ($this->place == self::PRE_CONTEXT) {
            return sprintf('<img src="%s" alt="%s" />', $this->path, $this->alt) . $context;
        } else {
            return $context . sprintf('<img src="%s" alt="%s" />', $this->path, $this->alt);
        }
    }
59946
def render(self, context, request=None):
        """"""
        context['component'] = self
        return render_to_string(self.template_name, context, request)
1042560
public function render($context = [])
    {
        parent::render($context);
        $this->getEngine()->parse($this->template);
        $data = [
            'element' => $this->getElement(),
            'context' => $context,
            'renderer' => $this
        ];
        return $this->getEngine()->process($data);
    }
394814
public static function runtime($context) {
        $class = new \ReflectionClass($context['runtime']);
        $ret = '';
        $methods = static::getClassMethods($context, $class);

        $exports = array_keys($context['usedCount']['runtime']);

        while (true) {
            if (array_sum(array_map(function ($name) use (&$exports, $methods) {
                $n = 0;
                foreach ($methods[$name][1] as $child => $count) {
                    if (!in_array($child, $exports)) {
                       $exports[] = $child;
                       $n++;
                    }
                }
                return $n;
            }, $exports)) == 0) {
                break;
            }
        }

        foreach ($exports as $export) {
            $ret .= ($methods[$export][0] . "\n");
        }

        return $ret;
    }
920249
function RenderContext() {
		this._aBuffer = [];
		var that = this;
		this.add = function() {
			that._aBuffer.push.apply(that._aBuffer, arguments);
		};
		this.addWithParam = function(s, o) {
			for (var n in o) {
				var reg = new RegExp("\{" + n + "\}","g");
				s = s.replace(reg,o[n]);
			}
			that.add(s);
		};
		this.toString = function() {
			return that._aBuffer.join("");
		};
	}
1004859
protected function render() {
		$__context = $this->getContext();
		ob_start();
		extract( $__context, EXTR_OVERWRITE );
		/** @noinspection PhpIncludeInspection */
		include $this->getFilepath();
		return ob_get_clean();
	}
1001906
def render_template(template, **context):
    
    parts = template.split('/')
    renderer = _get_renderer(parts[:-1])
    return renderer.render(renderer.load_template(parts[-1:][0]), context)
986120
public function render($context = [])
    {
        $element = clone $this->element;

        $value = $this->element->getAttribute('value', false);
        if ($value !== false) {
            $this->element->getAttributes()->remove('value');
        }
        $html = parent::render($context);
        $this->element = $element;
        return $html;
    }