Recursively render layouts

 layouts - a list of the layouts
 payload - the payload for Liquid
 info    - the info for Liquid

 Returns nothing
543734
def render_all_layouts(layouts, payload, info)
      _renderer.layouts = layouts
      self.output = _renderer.place_in_layouts(output, payload, info)
    ensure
      @_renderer = nil # this will allow the modifications above to disappear
    end
400859
def render_document
      info = {
        :registers        => { :site => site, :page => payload["page"] },
        :strict_filters   => liquid_options["strict_filters"],
        :strict_variables => liquid_options["strict_variables"],
      }

      output = document.content
      if document.render_with_liquid?
        Jekyll.logger.debug "Rendering Liquid:", document.relative_path
        output = render_liquid(output, payload, info, document.path)
      end

      Jekyll.logger.debug "Rendering Markup:", document.relative_path
      output = convert(output.to_s)
      document.content = output

      if document.place_in_layout?
        Jekyll.logger.debug "Rendering Layout:", document.relative_path
        output = place_in_layouts(output, payload, info)
      end

      output
    end
526759
def render(cls, obj):
        
        class_hierarchy = inspect.getmro(type(obj))
        hooks = []
        for _, type_hooks in cls._display_hooks.items():
            for cls in class_hierarchy:
                if cls in type_hooks:
                    hooks.append(type_hooks[cls])
                    break

        data, metadata = {}, {}
        for hook in hooks:
            ret = hook(obj)
            if ret is None:
                continue
            d, md = ret
            data.update(d)
            metadata.update(md)
        return data, metadata
1233493
def _render_content_list(self, content, depth, dstack, **settings):
        
        result = []
        i = 0
        size = len(content)
        for value in content:
            ds = [(depth, i, size)]
            ds = dstack + ds
            if isinstance(value, dict):
                result.append(self._render_item(ds, "[{}]".format(i), **settings))
                result += self._render_content_dict(value, depth + 1, ds, **settings)
            elif isinstance(value, list):
                result.append(self._render_item(ds, "[{}]".format(i), **settings))
                result += self._render_content_list(value, depth + 1, ds, **settings)
            else:
                result.append(self._render_item(ds, value, **settings))
            i += 1
        return result
601590
def _render_content_dict(self, content, depth, dstack, **settings):
        
        result = []
        i = 0
        size = len(content)
        for key in sorted(content):
            ds = [(depth, i, size)]
            ds = dstack + ds
            if isinstance(content[key], dict):
                result.append(self._render_item(ds, key, **settings))
                result += self._render_content_dict(content[key], depth + 1, ds, **settings)
            elif isinstance(content[key], list):
                result.append(self._render_item(ds, key, **settings))
                result += self._render_content_list(content[key], depth + 1, ds, **settings)
            else:
                result.append(self._render_item(ds, key, content[key], **settings))
            i += 1
        return result
95864
public function render() {
        $request     = Request::me();
        $namespace   = $this->module->getViewNamespace();
        $appUri      = $request->getApplicationBaseUri();
        $nestedTiles = $this->nestedTiles;
        foreach ($nestedTiles as $tile) {
            $tile->setParent($this);
        }
        $properties  = $this->getMergedProperties();

        if (!defined($namespace.'APP')) {
            define($namespace.'APP', strLeft($appUri, -1));
        }
        if (!defined($namespace.'MODULE')) {
            $moduleUri = $appUri.$this->module->getPrefix();
            define($namespace.'MODULE', strLeft($moduleUri, -1));
        }

        $properties['request' ] = $request;
        $properties['response'] = Response::me();
        $properties['session' ] = $request->isSession() ? $request->getSession() : null;
        $properties['form'    ] = $request->getAttribute(ACTION_FORM_KEY);
        $properties['page'    ] = Page::me();

        if ($this->isPushModelSupport()) {
            $pageValues = Page::me()->values();
            $properties = \array_merge($properties, $pageValues);
        }

        $tileHint = false;
        if (Application::isAdminIP()) {
            $rootDir  = $this->di('config')['app.dir.root'];
            $file     = $this->fileName;
            $file     = strRightFrom($file, $rootDir.DIRECTORY_SEPARATOR, 1, false, $file);
            $file     = 'file="'.str_replace('\\', '/', $file).'"';
            $tile     = $this->name==self::GENERIC_NAME ? '':'tile="'.$this->name.'" ';
            $tileHint = $tile.$file;
            echo ($this->parent ? NL:'').'<!-- #begin: '.$tileHint.' -->'.NL;
        }

        includeFile($this->fileName, $nestedTiles + $properties);

        if ($tileHint) {
            echo NL.'<!-- #end: '.$tileHint.' -->'.NL;
        }
        return $this;
    }
905880
def render_children(node: Node, **child_args):
    """"""
    for xml_node in node.xml_node.children:
        child = render(xml_node, **child_args)
        node.add_child(child)
792053
function render(template, locals, layoutTemplates, cb) {
    if (!layoutTemplates) layoutTemplates = [];

    // We'll render templates from bottom to top of the stack, each template
    // being passed the rendered string of the previous ones as `body`
    var i = layoutTemplates.length - 1;

    var _stackRenderer = function(err, htmlStr) {
      if (err) return cb(err);

      if (i >= 0) {
        locals.body = htmlStr;
        renderTemplate(layoutTemplates[i--], locals, _stackRenderer);
      } else {
        cb(null, htmlStr);
      }
    };

    // Start the rendering with the innermost page template
    renderTemplate(template, locals, _stackRenderer);
  }
951690
def render_for_namespace view
      nmspc = params[:controller].include?('/') ? params[:controller].rpartition('/')[0] : nil
      # recurse down the namespace tree to see if we get any hits.
      until nmspc.blank?
        template = "layouts/#{nmspc}/_#{view}"
        partial = "layouts/#{nmspc}/#{view}"
        if lookup_context.template_exists?(template)
          return render(partial)
        end
        nmspc = nmspc.include?('/') ? nmspc.rpartition('/')[0] : nil
      end
    end
1055687
def render(self, get_params, module, _if=None):
        
        enough = False
        output = []
        valid = None

        if self.commands.show:
            valid = True
        if self.parent and self.commands.soft and _if is None:
            return None, self
        if _if:
            valid = True
        elif self.commands._if:
            valid = self.check_valid(get_params)
        if valid is not False:
            for item in self.content:
                if isinstance(item, Placeholder):
                    sub_valid, sub_output, enough = item.get(get_params, self)
                    output.append(sub_output)
                elif isinstance(item, Literal):
                    sub_valid = None
                    enough = True
                    output.append(item.text)
                elif isinstance(item, Block):
                    sub_valid, sub_output = item.render(get_params, module)
                    if sub_valid is None:
                        output.append(sub_output)
                    else:
                        output.extend(sub_output)
                valid = valid or sub_valid
        if not valid:
            if self.next_block:
                valid, output = self.next_block.render(
                    get_params, module, _if=self.commands._if
                )
            elif self.parent is None and (
                (not self.next_block and enough) or self.base_block
            ):
                valid = True
            else:
                output = []

        # clean
        color = self.commands.color
        if color and color[0] != "#":
            color_name = "color_%s" % color
            threshold_color_name = "color_threshold_%s" % color
            # substitute color
            color = (
                getattr(module, color_name, None)
                or getattr(module, threshold_color_name, None)
                or getattr(module.py3, color_name.upper(), None)
            )
            if color == "hidden":
                return False, []

        text = u""
        out = []
        if isinstance(output, str):
            output = [output]

        # merge as much output as we can.
        # we need to convert values to unicode for concatination.
        if python2:
            conversion = unicode  # noqa
            convertables = (str, bool, int, float, unicode)  # noqa
        else:
            conversion = str
            convertables = (str, bool, int, float, bytes)

        first = True
        last_block = None
        for index, item in enumerate(output):
            is_block = isinstance(item, Block)
            if not is_block and item:
                last_block = None
            if isinstance(item, convertables) or item is None:
                text += conversion(item)
                continue
            elif text:
                if not first and (text == "" or out and out[-1].get("color") == color):
                    out[-1]["full_text"] += text
                else:
                    part = {"full_text": text}
                    if color:
                        part["color"] = color
                    out.append(part)
                text = u""
            if isinstance(item, Composite):
                if color:
                    item.composite_update(item, {"color": color}, soft=True)
                out.extend(item.get_content())
            elif is_block:
                # if this is a block then likely it is soft.
                if not out:
                    continue
                for x in range(index + 1, len(output)):
                    if output[x] and not isinstance(output[x], Block):
                        valid, _output = item.render(get_params, module, _if=True)
                        if _output and _output != last_block:
                            last_block = _output
                            out.extend(_output)
                        break
            else:
                if item:
                    out.append(item)
            first = False

        # add any left over text
        if text:
            part = {"full_text": text}
            if color:
                part["color"] = color
            out.append(part)

        # process any min/max length commands
        max_length = self.commands.max_length
        min_length = self.commands.min_length

        if max_length or min_length:
            for item in out:
                if max_length is not None:
                    item["full_text"] = item["full_text"][:max_length]
                    max_length -= len(item["full_text"])
                if min_length:
                    min_length -= len(item["full_text"])
            if min_length > 0:
                out[0]["full_text"] = u" " * min_length + out[0]["full_text"]
                min_length = 0

        return valid, out
742240
def render_children(self, block, view_name=None, context=None):
        
        results = []
        for child_id in block.children:
            child = self.get_block(child_id)
            result = self.render_child(child, view_name, context)
            results.append(result)
        return results
1060442
def render_children(self, context, fragment, can_reorder=True, can_add=False):
        
        contents = []

        child_context = {'reorderable_items': set()}
        if context:
            child_context.update(context)

        for child_id in self.children:
            child = self.runtime.get_block(child_id)
            if can_reorder:
                child_context['reorderable_items'].add(child.scope_ids.usage_id)
            view_to_render = 'author_view' if hasattr(child, 'author_view') else 'student_view'
            rendered_child = child.render(view_to_render, child_context)
            fragment.add_frag_resources(rendered_child)

            contents.append({
                'id': text_type(child.scope_ids.usage_id),
                'content': rendered_child.content
            })

        fragment.add_content(self.runtime.render_template("studio_render_children_view.html", {
            'items': contents,
            'xblock_context': context,
            'can_add': can_add,
            'can_reorder': can_reorder,
        }))
1001629
def render options = {}
      validate!
      options = fill_options(options)

      open = render_open_tag(options)
      inner = render_children(options)
      close = render_close_tag(options)

      if options[:pretty]
        indent = ' ' * (options[:indent] * options[:depth])
        out = indent.dup
        out << open << "\n"
        out << inner if inner
        out << indent << close << "\n" if close && !close.empty?
        out
      else
        out = open
        out << inner if inner
        out << close if close
        out
      end
    end
296934
def render(self, content = None, **settings):
        
        (content, settings) = self.get_setup(content, **settings)
        return self._render(content, **settings)
593846
def render
      rendered_items = ''

      list.list_items.each do |list_item|
        rendered_items += render_item(list_item)
      end

      content_tag opts[:wrapper_element], rendered_items, html_options, false
    end
941714
def render options = {}
      validate!
      self.compose do
        # Allow 'yield' to embed all children
        self.children.each do |child|
          fragment child
        end
      end.render(options)
    end
839574
def render_liquid(content, payload, info, path = nil)
      template = site.liquid_renderer.file(path).parse(content)
      template.warnings.each do |e|
        Bunto.logger.warn "Liquid Warning:",
          LiquidRenderer.format_error(e, path || document.relative_path)
      end
      template.render!(payload, info)
    # rubocop: disable RescueException
    rescue Exception => e
      Bunto.logger.error "Liquid Exception:",
        LiquidRenderer.format_error(e, path || document.relative_path)
      raise e
    end