Render a breadcrumb like menu.

    Override ``pages/breadcrumb.html`` if you want to change the
    design.

    :param page: the current page
    :param url: not used anymore
512116
def pages_breadcrumb(context, page, url='/'):
    
    lang = context.get('lang', pages_settings.PAGE_DEFAULT_LANGUAGE)
    page = get_page_from_string_or_id(page, lang)
    pages_navigation = None
    if page:
        pages_navigation = page.get_ancestors()
    context.update({'pages_navigation': pages_navigation, 'page': page})
    return context
718061
def html_page_context(app, pagename, templatename, context, doctree):
    ''' 

    '''
    site = context['SITEMAP_BASE_URL']
    version = context['version']
    app.sitemap_links.add(site + version + '/' + pagename + ".html")
490038
public function render(array $breadcrumb) : void
    {
        $admin = ['link' => ':Base:Admin:Dashboard', 'title' => 'Admin'];

        if ($this->presenter->isLinkCurrent(':Base:Admin:Dashboard'))
        {
            $admin = ['title' => 'Admin'];
        }

        array_unshift($breadcrumb, $admin);

        $this->template->breadcrumb = $breadcrumb;

        $this->template->setFile(__DIR__ . '/templates/breadcrumb.latte');
        $this->template->render();
    }
222424
def pages_sub_menu(context, page, url='/'):
    
    lang = context.get('lang', pages_settings.PAGE_DEFAULT_LANGUAGE)
    page = get_page_from_string_or_id(page, lang)
    if page:
        root = page.get_root()
        children = root.get_children_for_frontend()
        context.update({'children': children, 'page': page})
    return context
811863
def page_menu(context, token):
    
    # First arg could be the menu template file name, or the parent page.
    # Also allow for both to be used.
    template_name = None
    parent_page = None
    parts = token.split_contents()[1:]
    for part in parts:
        part = Variable(part).resolve(context)
        if isinstance(part, str):
            template_name = part
        elif isinstance(part, Page):
            parent_page = part
    if template_name is None:
        try:
            template_name = context["menu_template_name"]
        except KeyError:
            error = "No template found for page_menu in: %s" % parts
            raise TemplateSyntaxError(error)
    context["menu_template_name"] = template_name
    if "menu_pages" not in context:
        try:
            user = context["request"].user
            slug = context["request"].path
        except KeyError:
            user = None
            slug = ""
        num_children = lambda id: lambda: len(context["menu_pages"][id])
        has_children = lambda id: lambda: num_children(id)() > 0
        rel = [m.__name__.lower()
               for m in Page.get_content_models()
               if not m._meta.proxy]
        published = Page.objects.published(for_user=user).select_related(*rel)
        # Store the current page being viewed in the context. Used
        # for comparisons in page.set_menu_helpers.
        if "page" not in context:
            try:
                context.dicts[0]["_current_page"] = published.exclude(
                    content_model="link").get(slug=slug)
            except Page.DoesNotExist:
                context.dicts[0]["_current_page"] = None
        elif slug:
            context.dicts[0]["_current_page"] = context["page"]
        # Some homepage related context flags. on_home is just a helper
        # indicated we're on the homepage. has_home indicates an actual
        # page object exists for the homepage, which can be used to
        # determine whether or not to show a hard-coded homepage link
        # in the page menu.
        home = home_slug()
        context.dicts[0]["on_home"] = slug == home
        context.dicts[0]["has_home"] = False
        # Maintain a dict of page IDs -> parent IDs for fast
        # lookup in setting page.is_current_or_ascendant in
        # page.set_menu_helpers.
        context.dicts[0]["_parent_page_ids"] = {}
        pages = defaultdict(list)
        for page in published.order_by("_order"):
            page.set_helpers(context)
            context["_parent_page_ids"][page.id] = page.parent_id
            setattr(page, "num_children", num_children(page.id))
            setattr(page, "has_children", has_children(page.id))
            pages[page.parent_id].append(page)
            if page.slug == home:
                context.dicts[0]["has_home"] = True
        # Include menu_pages in all contexts, not only in the
        # block being rendered.
        context.dicts[0]["menu_pages"] = pages
    # ``branch_level`` must be stored against each page so that the
    # calculation of it is correctly applied. This looks weird but if we do
    # the ``branch_level`` as a separate arg to the template tag with the
    # addition performed on it, the addition occurs each time the template
    # tag is called rather than once per level.
    context["branch_level"] = 0
    parent_page_id = None
    if parent_page is not None:
        context["branch_level"] = getattr(parent_page, "branch_level", 0) + 1
        parent_page_id = parent_page.id

    # Build the ``page_branch`` template variable, which is the list of
    # pages for the current parent. Here we also assign the attributes
    # to the page object that determines whether it belongs in the
    # current menu template being rendered.
    context["page_branch"] = context["menu_pages"].get(parent_page_id, [])
    context["page_branch_in_menu"] = False
    for page in context["page_branch"]:
        page.in_menu = page.in_menu_template(template_name)
        page.num_children_in_menu = 0
        if page.in_menu:
            context["page_branch_in_menu"] = True
        for child in context["menu_pages"].get(page.id, []):
            if child.in_menu_template(template_name):
                page.num_children_in_menu += 1
        page.has_children_in_menu = page.num_children_in_menu > 0
        page.branch_level = context["branch_level"]
        page.parent = parent_page
        context["parent_page"] = page.parent

        # Prior to pages having the ``in_menus`` field, pages had two
        # boolean fields ``in_navigation`` and ``in_footer`` for
        # controlling menu inclusion. Attributes and variables
        # simulating these are maintained here for backwards
        # compatibility in templates, but will be removed eventually.
        page.in_navigation = page.in_menu
        page.in_footer = not (not page.in_menu and "footer" in template_name)
        if page.in_navigation:
            context["page_branch_in_navigation"] = True
        if page.in_footer:
            context["page_branch_in_footer"] = True

    t = get_template(template_name)
    return t.render(Context(context))
370390
def render_startmenu(self, ctx, data):
        
        return startMenu(
            self.translator, self.pageComponents.navigation, ctx.tag)
386237
def zinnia_breadcrumbs(context, root_name='',
                       template='zinnia/tags/breadcrumbs.html',):
    
    path = context['request'].path
    context_object = get_context_first_object(
        context, ['object', 'category', 'tag', 'author'])
    context_page = context.get('page_obj')
    breadcrumbs = retrieve_breadcrumbs(
        path, context_object, context_page, root_name)

    return {'template': template,
            'breadcrumbs': breadcrumbs}
802453
def breadcrumb_raw(context, label, viewname, *args, **kwargs):
    
    append_breadcrumb(context, escape(label), viewname, args, kwargs)
    return ''
949594
def render_page(page, page_args):
    
    print(page_args)
    template_name = page.template if page.template else page.name
    template = "signage/pages/{}.html".format(template_name)
    if page.function:
        context_method = getattr(pages, page.function)
    else:
        context_method = getattr(pages, page.name)
    sign, request = page_args
    context = context_method(page, sign, request)
    return render_to_string(template, context)
54130
def show_page_path_params(page, optional_params = {})
      raise ArgumentError, 'Page is nil' if page.nil?
      url_params = {urlname: page.urlname}.update(optional_params)
      prefix_locale? ? url_params.update(locale: page.language_code) : url_params
    end
520932
def sub_menu(
    context, menuitem_or_page, use_specific=None, allow_repeating_parents=None,
    apply_active_classes=None, template='', use_absolute_page_urls=None,
    add_sub_menus_inline=None, **kwargs
):
    
    validate_supplied_values('sub_menu', use_specific=use_specific,
                             menuitem_or_page=menuitem_or_page)

    max_levels = context.get(
        'max_levels', settings.DEFAULT_CHILDREN_MENU_MAX_LEVELS
    )

    if use_specific is None:
        use_specific = context.get(
            'use_specific', constants.USE_SPECIFIC_AUTO)

    if apply_active_classes is None:
        apply_active_classes = context.get('apply_active_classes', True)

    if allow_repeating_parents is None:
        allow_repeating_parents = context.get('allow_repeating_parents', True)

    if use_absolute_page_urls is None:
        use_absolute_page_urls = context.get('use_absolute_page_urls', False)

    if add_sub_menus_inline is None:
        add_sub_menus_inline = context.get('add_sub_menus_inline', False)

    if isinstance(menuitem_or_page, Page):
        parent_page = menuitem_or_page
    else:
        parent_page = menuitem_or_page.link_page

    original_menu = context.get('original_menu_instance')
    if original_menu is None:
        raise SubMenuUsageError()

    menu_class = original_menu.get_sub_menu_class()
    return menu_class.render_from_tag(
        context=context,
        parent_page=parent_page,
        max_levels=max_levels,
        use_specific=use_specific,
        apply_active_classes=apply_active_classes,
        allow_repeating_parents=allow_repeating_parents,
        use_absolute_page_urls=use_absolute_page_urls,
        add_sub_menus_inline=add_sub_menus_inline,
        template_name=template,
        **kwargs
    )
1237025
def init_breadcrumbs(self):
        
        g.breadcrumb.append(BreadcrumbItem(icon="home", url="/" + request.script_root))
970421
def _page_text(page, nowrap=False):
    
    title = page.data['title']
    title = "%s\n%s" % (title, "=" * len(title))

    desc = page.data.get('description')
    if desc:
        desc = "_%s_" % desc

    img = _text_image(page)

    pars = page.data.get('extext')

    if pars:
        # pars = pars.replace(' * ', '\n * ')
        pars = re.sub(r'[ ]+\*[ ]+', '* ', pars)

    if pars and not nowrap:
        parlist = []
        for par in pars.split("\n\n"):
            parlist.append("\n".join(textwrap.wrap(par)))

        disambiguation = page.data.get('disambiguation')
        if disambiguation:
            parlist.append(' * ' + "\n * ".join(page.data.get('links')))

        pars = "\n\n".join(parlist)

    url = '<%s>' % page.data['url']

    txt = []
    txt.append(title)
    txt.append(desc)
    txt.append(url)
    txt.append(pars)
    txt.append(img)

    return "\n\n".join([x for x in txt if x])
168237
def page(self):
        
        if not self._page:
            try:
                self._page = self.paginator.page(
                    self.query_dict.get('page', 1))
            except InvalidPage:
                raise HttpError("Invalid page", status=HTTP_400_BAD_REQUEST)
        return self._page
280918
function Render()
    {
        self::$currentPage = $this->page;
        self::$Title = self::$currentPage->GetTitle();
        self::$Description = self::$currentPage->GetDescription();
        self::$Keywords = self::$currentPage->GetKeywords();
        if ($this->page->GetType() == (string)PageType::NotFound())
        {
            header('HTTP/1.0 404 Not Found');
        }
        else if ($this->page->GetType() !== (string)PageType::Normal())
        {
            throw new \Exception('Internal phine error: not normal page called');
        }
        ob_start();
        require PathUtil::LayoutTemplate($this->layout);
        $result = ob_get_clean();
        $replacer = new Replacer();
        return $replacer->RealizeVariables($result);
    }
639831
def cms_fragment_render(identifier, page = @cms_page)
      node = page.fragment_nodes.detect { |n| n.identifier == identifier.to_s }
      return "" unless node
      node.renderable = true
      render inline: page.render([node])
    end
432591
def get_page_tpl_ctx(page, request):
    
    text = Template(page.text).render(Context())
    meta = MetaSeo(page)
    comments = get_object_comments(PageComment, page.id)
    comments_form = PageCommentForm(initial=get_comment_init(request, page))
    if page.slug == Page.MAIN_SLUG:
        crumbs = None
    else:
        crumbs = page.get_breadcrumbs()
    return {'page': page, 'comments': comments, 'comments_form': comments_form, 'text': text, 'meta': meta, 'crumbs': crumbs}