Make templates compatible with StrictUndefined

Dactyl v0.8.0 required
This commit is contained in:
mDuo13
2019-02-15 19:08:05 -08:00
parent f55c9de626
commit 6c464cc27b
12 changed files with 88 additions and 91 deletions

View File

@@ -1858,7 +1858,6 @@ pages:
- md: references/rippled-api/admin-rippled-methods/admin-rippled-methods.md - md: references/rippled-api/admin-rippled-methods/admin-rippled-methods.md
html: admin-rippled-methods.html html: admin-rippled-methods.html
blurb: Admin methods are meant only for trusted personnel in charge of keeping the server operational. Admin methods include commands for managing, monitoring, and debugging the server.
funnel: Docs funnel: Docs
doc_type: References doc_type: References
supercategory: rippled API supercategory: rippled API

View File

@@ -11,9 +11,7 @@
import re import re
def filter_soup(soup, **kwargs): def filter_soup(soup, **kwargs):
print("currentpage", kwargs["currentpage"])
""" """
Adds an external link marker to external links Adds an external link marker to external links
and makes them open in new tabs. and makes them open in new tabs.

View File

@@ -55,10 +55,10 @@
</head> </head>
<body class="xrp-ledger-dev-portal {% if currentpage.sidebar != "disabled" %}sidebar-primary {% endif %}{% block bodyclasses %}{% endblock %}"> <body class="xrp-ledger-dev-portal {% if currentpage.sidebar is undefined or currentpage.sidebar != "disabled" %}sidebar-primary {% endif %}{% block bodyclasses %}{% endblock %}">
<nav class="navbar fixed-top navbar-expand-lg navbar-light bg-white"> <nav class="navbar fixed-top navbar-expand-lg navbar-light bg-white">
<a href="{% if target.no_cover %}/{% else %}index.html{% endif %}" class="navbar-brand"><img src="assets/img/XRPLedger_DevPortal_Gray.svg" class="logo" width="120" height="35" alt="XRP Ledger Dev Portal" /></a> <a href="{% if target.no_cover is defined and target.no_cover %}/{% else %}index.html{% endif %}" class="navbar-brand"><img src="assets/img/XRPLedger_DevPortal_Gray.svg" class="logo" width="120" height="35" alt="XRP Ledger Dev Portal" /></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarHolder" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarHolder" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
@@ -67,8 +67,8 @@
{% set funnels = [] %} {% set funnels = [] %}
{% for page in pages %} {% for page in pages %}
{% if page.funnel is defined and page.funnel not in funnels %} {% if page.funnel is defined and page.funnel not in funnels %}
{% set thisfunneltop = pages|selectattr('funnel', 'equalto', page.funnel)|first %} {% set thisfunneltop = pages|selectattr('funnel', 'defined_and_equalto', page.funnel)|first %}
<li class="nav-item{% if currentpage == thisfunneltop %} active{% elif currentpage.funnel == thisfunneltop.name %} active-parent{% endif %}"> <li class="nav-item{% if currentpage == thisfunneltop %} active{% elif currentpage.funnel is defined and currentpage.funnel == thisfunneltop.name %} active-parent{% endif %}">
<a class="nav-link" href="{{ thisfunneltop.html }}">{{ thisfunneltop.name }}</a> <a class="nav-link" href="{{ thisfunneltop.html }}">{{ thisfunneltop.name }}</a>
</li> </li>
{% set _ = funnels.append(page.funnel) %} {% set _ = funnels.append(page.funnel) %}
@@ -90,20 +90,20 @@
<div class="container-fluid" role="document" id="main_content_wrapper"> <div class="container-fluid" role="document" id="main_content_wrapper">
<div class="row"> <div class="row">
<!-- Right sidebar first so it's at the beginning for mobile layouts --> <!-- Right sidebar first so it's at the beginning for mobile layouts -->
{% if currentpage.sidebar != "disabled" and currentpage.sidebar != "left_only" %} {% if currentpage.sidebar is undefined or (currentpage.sidebar != "disabled" and currentpage.sidebar != "left_only") %}
<aside class="right-sidebar col-lg-3 order-lg-4 p-0" role="complementary"> <aside class="right-sidebar col-lg-3 order-lg-4 p-0" role="complementary">
{% block right_sidebar %}{% endblock %} {% block right_sidebar %}{% endblock %}
</aside> </aside>
{% endif %} {% endif %}
<!-- main column --> <!-- main column -->
<main class="main {% if currentpage.sidebar == "disabled" %}col-md-12{% else %}col-md-7 col-lg-6{% endif %} order-md-3 p-0 {% block mainclasses %}{% endblock %}" role="main" id="main_content_body"> <main class="main {% if currentpage.sidebar is defined and currentpage.sidebar == "disabled" %}col-md-12{% else %}col-md-7 col-lg-6{% endif %} order-md-3 p-0 {% block mainclasses %}{% endblock %}" role="main" id="main_content_body">
{% block breadcrumbs %} {% block breadcrumbs %}
{% include 'template-breadcrumbs.html' %} {% include 'template-breadcrumbs.html' %}
{% endblock %} {% endblock %}
{% block main %}{% endblock %} {% block main %}{% endblock %}
</main> </main>
{% if currentpage.sidebar != "disabled" %} {% if currentpage.sidebar is undefined or currentpage.sidebar != "disabled" %}
<!-- Left sidebar last so it's at the end for mobile --> <!-- Left sidebar last so it's at the end for mobile -->
<aside class="sidebar col-md-5 col-lg-3 p-0 order-md-1" role="complementary"> <aside class="sidebar col-md-5 col-lg-3 p-0 order-md-1" role="complementary">
{% block left_sidebar %} {% block left_sidebar %}

View File

@@ -1,20 +1,20 @@
<nav class="breadcrumbs-wrap {% if currentpage.sidebar == 'disabled' %}p-3 px-sm-4{% else %}p-3{% endif %}" aria-label="breacrumb"> <nav class="breadcrumbs-wrap {% if currentpage.sidebar is defined and currentpage.sidebar == 'disabled' %}p-3 px-sm-4{% else %}p-3{% endif %}" aria-label="breacrumb">
<ul class="breadcrumb bg-white"> <ul class="breadcrumb bg-white">
<li class="breadcrumb-item"><a href="{% if target.no_cover %}/{% else %}index.html{% endif %}">Home</a></li> <li class="breadcrumb-item"><a href="{% if target.no_cover is defined and target.no_cover %}/{% else %}index.html{% endif %}">Home</a></li>
{% if currentpage.funnel and currentpage != pages|selectattr('funnel', 'equalto', currentpage.funnel)|first %} {% if currentpage.funnel is defined and currentpage != pages|selectattr('funnel', 'defined_and_equalto', currentpage.funnel)|first %}
<li class="active breadcrumb-item"><a href="{{ (pages|selectattr('funnel', 'equalto', currentpage.funnel)|first).html }}">{{ currentpage.funnel }}</a></li> <li class="active breadcrumb-item"><a href="{{ (pages|selectattr('funnel', 'defined_and_equalto', currentpage.funnel)|first).html }}">{{ currentpage.funnel }}</a></li>
{% endif %} {% endif %}
{% if currentpage.doc_type and currentpage != pages|selectattr('doc_type', 'equalto', currentpage.doc_type)|first%} {% if currentpage.doc_type is defined and currentpage != pages|selectattr('doc_type', 'defined_and_equalto', currentpage.doc_type)|first%}
<li class="active breadcrumb-item"><a href="{{ (pages|selectattr('doc_type', 'equalto', currentpage.doc_type)|first).html }}">{{ currentpage.doc_type }}</a></li> <li class="active breadcrumb-item"><a href="{{ (pages|selectattr('doc_type', 'defined_and_equalto', currentpage.doc_type)|first).html }}">{{ currentpage.doc_type }}</a></li>
{% endif %} {% endif %}
{% if currentpage.supercategory and currentpage != pages|selectattr('supercategory', 'equalto', currentpage.supercategory)|first %} {% if currentpage.supercategory is defined and currentpage != pages|selectattr('supercategory', 'defined_and_equalto', currentpage.supercategory)|first %}
<li class="active breadcrumb-item"><a href="{{ (pages|selectattr('supercategory', 'equalto', currentpage.supercategory)|first).html }}">{{ currentpage.supercategory }}</a></li> <li class="active breadcrumb-item"><a href="{{ (pages|selectattr('supercategory', 'defined_and_equalto', currentpage.supercategory)|first).html }}">{{ currentpage.supercategory }}</a></li>
{% endif %} {% endif %}
{% if currentpage.category and currentpage != pages|selectattr('category', 'equalto', currentpage.category)|first %} {% if currentpage.category is defined and currentpage != pages|selectattr('category', 'defined_and_equalto', currentpage.category)|first %}
<li class="active breadcrumb-item"><a href="{{ (pages|selectattr('category', 'equalto', currentpage.category)|first).html }}">{{ currentpage.category }}</a></li> <li class="active breadcrumb-item"><a href="{{ (pages|selectattr('category', 'defined_and_equalto', currentpage.category)|first).html }}">{{ currentpage.category }}</a></li>
{% endif %} {% endif %}
{% if currentpage.subcategory and currentpage != pages|selectattr('subcategory', 'equalto', currentpage.subcategory)|first %} {% if currentpage.subcategory is defined and currentpage != pages|selectattr('subcategory', 'defined_and_equalto', currentpage.subcategory)|first %}
<li class="active breadcrumb-item"><a href="{{ (pages|selectattr('subcategory', 'equalto', currentpage.subcategory)|first).html }}">{{ currentpage.subcategory }}</a></li> <li class="active breadcrumb-item"><a href="{{ (pages|selectattr('subcategory', 'defined_and_equalto', currentpage.subcategory)|first).html }}">{{ currentpage.subcategory }}</a></li>
{% endif %} {% endif %}
<li class="active breadcrumb-item">{{ currentpage.name }}</li> <li class="active breadcrumb-item">{{ currentpage.name }}</li>
</ul> </ul>

View File

@@ -4,7 +4,7 @@
{% set funnels = [] %} {% set funnels = [] %}
{% for page in pages %} {% for page in pages %}
{% if page.funnel is defined and page.funnel not in funnels %} {% if page.funnel is defined and page.funnel not in funnels %}
{% set parent_page = pages|selectattr('funnel', 'equalto', page.funnel)|first %} {% set parent_page = pages|selectattr('funnel', 'defined_and_equalto', page.funnel)|first %}
<div class="col mx-xl-5 my-3 foot-nav-col"> <div class="col mx-xl-5 my-3 foot-nav-col">
<h5><a class="foot-nav-link" href="{{ parent_page.html }}">{{ parent_page.name }}</a><hr /></h5> <h5><a class="foot-nav-link" href="{{ parent_page.html }}">{{ parent_page.name }}</a><hr /></h5>

View File

@@ -15,7 +15,7 @@
{% set githuburl = target.github_forkurl + "/edit/" {% set githuburl = target.github_forkurl + "/edit/"
+ target.github_branch + "/tool/" + currentpage.template %} + target.github_branch + "/tool/" + currentpage.template %}
{% endif %} {% endif %}
{% if target.is_pr_build and have_edit_link %} {% if target.is_pr_build is defined and target.is_pr_build and have_edit_link %}
{% set githuburl = githuburl + "?pr=/ripple/ripple-dev-portal/pull/" {% set githuburl = githuburl + "?pr=/ripple/ripple-dev-portal/pull/"
+ target.github_pr_id %} + target.github_pr_id %}
{% endif %} {% endif %}

View File

@@ -70,7 +70,7 @@
<h3 class="card-title"><img class="card-title-icon" src="assets/img/map.svg" alt="(map icon)" width="32" height="32" /> View Use Cases</h3> <h3 class="card-title"><img class="card-title-icon" src="assets/img/map.svg" alt="(map icon)" width="32" height="32" /> View Use Cases</h3>
</div><!--/.card-header--> </div><!--/.card-header-->
<div class="card-body"> <div class="card-body">
{% set parent_page = pages|selectattr("name", "equalto", "Use Cases")|first %} {% set parent_page = pages|selectattr("name", 'defined_and_equalto', "Use Cases")|first %}
{% set depth = 1 %} {% set depth = 1 %}
{% include 'template-page-children.html' %} {% include 'template-page-children.html' %}
</div><!--/.card-body--> </div><!--/.card-body-->
@@ -96,7 +96,7 @@
<div class="curated-links"> <div class="curated-links">
<ol> <ol>
{% for link in target.recently_updated %} {% for link in target.recently_updated %}
{% set linkpage = pages|selectattr("html", "equalto", link.html)|first %} {% set linkpage = pages|selectattr("html", 'defined_and_equalto', link.html)|first %}
<li><a href="{{linkpage.html}}">{{linkpage.name}}{% if link.date is defined %} <span class="recently-updated-date">({{link.date}})</span>{% endif %}</a></li> <li><a href="{{linkpage.html}}">{{linkpage.name}}{% if link.date is defined %} <span class="recently-updated-date">({{link.date}})</span>{% endif %}</a></li>
{% endfor %} {% endfor %}
</ol> </ol>

View File

@@ -13,7 +13,7 @@
{% set doc_types = [] %} {% set doc_types = [] %}
{% for page in pages %} {% for page in pages %}
{% if page.doc_type is defined and page.doc_type not in doc_types %} {% if page.doc_type is defined and page.doc_type not in doc_types %}
{% set doc_type_top = pages|selectattr('doc_type', 'equalto', page.doc_type)|first %} {% set doc_type_top = pages|selectattr('doc_type', 'defined_and_equalto', page.doc_type)|first %}
<div class="card"> <div class="card">
<div class="card-header bg-dark"> <div class="card-header bg-dark">
@@ -79,7 +79,7 @@
<div class="curated-links"> <div class="curated-links">
<ol> <ol>
{% for link in target.recently_updated %} {% for link in target.recently_updated %}
{% set linkpage = pages|selectattr("html", "equalto", link.html)|first %} {% set linkpage = pages|selectattr("html", 'defined_and_equalto', link.html)|first %}
<li><a href="{{linkpage.html}}">{{linkpage.name}}{% if link.date is defined %} <span class="recently-updated-date">({{link.date}})</span>{% endif %}</a></li> <li><a href="{{linkpage.html}}">{{linkpage.name}}{% if link.date is defined %} <span class="recently-updated-date">({{link.date}})</span>{% endif %}</a></li>
{% endfor %} {% endfor %}
</ol> </ol>

View File

@@ -12,8 +12,8 @@
<h2><a href="rippled-api.html">rippled API Reference</a></h2> <h2><a href="rippled-api.html">rippled API Reference</a></h2>
<p class="blurb">Use the <code>rippled</code> API to communicate with a <code>rippled</code> server, the core peer-to-peer server that manages the XRP Ledger.</p> <p class="blurb">Use the <code>rippled</code> API to communicate with a <code>rippled</code> server, the core peer-to-peer server that manages the XRP Ledger.</p>
<div class="card-deck pt-3 pt-sm-4"> <div class="card-deck pt-3 pt-sm-4">
{% for page in pages|selectattr("supercategory", "equalto", "rippled API")|list %} {% for page in pages|selectattr("supercategory", 'defined_and_equalto', "rippled API")|list %}
{% if loop.index != 1 and page == pages|selectattr("category", "equalto", page.category)|first %} {% if loop.index != 1 and page == pages|selectattr("category", 'defined_and_equalto', page.category)|first %}
<div class="card"> <div class="card">
<div class="card-header bg-dark"> <div class="card-header bg-dark">
<h3 class="card-title">{{page.name}}</h3> <h3 class="card-title">{{page.name}}</h3>
@@ -59,8 +59,8 @@
<p class="blurb">Here are a few other ways to interact with the XRP Ledger.</p> <p class="blurb">Here are a few other ways to interact with the XRP Ledger.</p>
<div class="card-deck pt-3 pt-sm-4"> <div class="card-deck pt-3 pt-sm-4">
{% for page in pages|selectattr("doc_type", "equalto", "References")|selectattr("supercategory", "ne", "rippled API") %} {% for page in pages|selectattr("doc_type", 'defined_and_equalto', "References")|selectattr("supercategory", "undefined_or_ne", "rippled API") %}
{% if loop.index != 1 and page == pages|selectattr("category", "equalto", page.category)|first %} {% if loop.index != 1 and page == pages|selectattr("category", 'defined_and_equalto', page.category)|first %}
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<h3 class="card-title"><a href="{{page.html}}">{{page.name}}</a></h3> <h3 class="card-title"><a href="{{page.html}}">{{page.name}}</a></h3>

View File

@@ -13,26 +13,26 @@
{% set parent_level = "home" %} {% set parent_level = "home" %}
{% set level_2 = "funnel" %} {% set level_2 = "funnel" %}
{% set childpages = pages %}{# special case for home #} {% set childpages = pages %}{# special case for home #}
{% elif parent_page == pages|selectattr("funnel", "equalto", parent_page.funnel)|first %} {% elif parent_page == pages|selectattr("funnel", 'defined_and_equalto', parent_page.funnel)|first %}
{% set parent_level = "funnel" %} {% set parent_level = "funnel" %}
{% set level_2 = "doc_type" %} {% set level_2 = "doc_type" %}
{% elif parent_page == pages|selectattr("doc_type", "equalto", parent_page.doc_type)|first %} {% elif parent_page.doc_type is defined and parent_page == pages|selectattr("doc_type", 'defined_and_equalto', parent_page.doc_type)|first %}
{% set parent_level = "doc_type" %} {% set parent_level = "doc_type" %}
{% set level_2 = "supercategory" %} {% set level_2 = "supercategory" %}
{% elif parent_page == pages|selectattr("supercategory", "equalto", parent_page.supercategory)|first %} {% elif parent_page.supercategory is defined and parent_page == pages|selectattr("supercategory", 'defined_and_equalto', parent_page.supercategory)|first %}
{% set parent_level = "supercategory" %} {% set parent_level = "supercategory" %}
{% set level_2 = "category" %} {% set level_2 = "category" %}
{% elif parent_page == pages|selectattr("category", "equalto", parent_page.category)|first %} {% elif parent_page.category is defined and parent_page == pages|selectattr("category", 'defined_and_equalto', parent_page.category)|first %}
{% set parent_level = "category" %} {% set parent_level = "category" %}
{% set level_2 = "subcategory" %} {% set level_2 = "subcategory" %}
{% elif parent_page == pages|selectattr("subcategory", "equalto", parent_page.subcategory)|first %} {% elif parent_page.subcategory is defined and parent_page == pages|selectattr("subcategory", 'defined_and_equalto', parent_page.subcategory)|first %}
{% set parent_level = "subcategory" %} {% set parent_level = "subcategory" %}
{% set level_2 = None %} {% set level_2 = None %}
{% else %} {% else %}
<!-- TEMPLATE ERROR: page {{parent_page.name}} is not the parent of anything? --> <!-- TEMPLATE ERROR: page {{parent_page.name}} is not the parent of anything? -->
{% endif %} {% endif %}
{% if parent_level != "home" %} {% if parent_level != "home" %}
{% set childpages = pages|selectattr(parent_level, "equalto", parent_page[parent_level])|list %} {% set childpages = pages|selectattr(parent_level, 'defined_and_equalto', parent_page[parent_level])|list %}
{% endif %} {% endif %}
{% macro print_children(parent, thosepages, indent_level, next_level_field, depth_limit) %} {% macro print_children(parent, thosepages, indent_level, next_level_field, depth_limit) %}
@@ -51,7 +51,7 @@
{% if onepage.category not in printed_next_levels %} {% if onepage.category not in printed_next_levels %}
{% set next_level_children = thosepages|selectattr("category", {% set next_level_children = thosepages|selectattr("category",
"equalto", onepage.category)|list %} 'defined_and_equalto', onepage.category)|list %}
{% set next_level_parent = next_level_children|first %} {% set next_level_parent = next_level_children|first %}
<li class="level-{{indent_level}}"><a href="{{next_level_parent.html}}">{{next_level_parent.name}}</a>{% if show_blurbs and next_level_parent.blurb is defined and indent_level == 1 %}<p class="blurb child-blurb">{{next_level_parent.blurb}}</p>{% endif %}</li> <li class="level-{{indent_level}}"><a href="{{next_level_parent.html}}">{{next_level_parent.name}}</a>{% if show_blurbs and next_level_parent.blurb is defined and indent_level == 1 %}<p class="blurb child-blurb">{{next_level_parent.blurb}}</p>{% endif %}</li>
{% if indent_level+1 <= depth_limit and next_level_field != None %} {% if indent_level+1 <= depth_limit and next_level_field != None %}
@@ -70,8 +70,8 @@
{% elif onepage[next_level_field] is defined %} {% elif onepage[next_level_field] is defined %}
{# might be a grandchild or lower #} {# might be a grandchild or lower #}
{% if onepage[next_level_field] not in printed_next_levels %} {% if onepage[next_level_field] not in printed_next_levels %}
{% set next_level_children = thosepages|selectattr(next_level_field, {% set next_level_children = thosepages|selectattr(next_level_field,'defined')|selectattr(next_level_field,
"equalto", onepage[next_level_field])|list %} 'defined_and_equalto', onepage[next_level_field])|list %}
{% set next_level_parent = next_level_children|first %} {% set next_level_parent = next_level_children|first %}
<li class="level-{{indent_level}}"><a href="{{next_level_parent.html}}">{{next_level_parent.name}}</a>{% if show_blurbs and next_level_parent.blurb is defined and indent_level == 1 %}<p class="blurb child-blurb">{{next_level_parent.blurb}}</p>{% endif %}</li> <li class="level-{{indent_level}}"><a href="{{next_level_parent.html}}">{{next_level_parent.name}}</a>{% if show_blurbs and next_level_parent.blurb is defined and indent_level == 1 %}<p class="blurb child-blurb">{{next_level_parent.blurb}}</p>{% endif %}</li>
{% if (indent_level+1 <= depth_limit and next_level_field != None) {% if (indent_level+1 <= depth_limit and next_level_field != None)

View File

@@ -3,35 +3,35 @@
<!--{############# Parent page link ###############################}--> <!--{############# Parent page link ###############################}-->
{% if currentpage.supercategory is defined %} {% if currentpage.supercategory is defined %}
<div class="sidenav_parent"> <div class="sidenav_parent">
{% if currentpage == (pages|selectattr('supercategory', 'equalto', currentpage.supercategory)|first) %} {% if currentpage == (pages|selectattr('supercategory', 'defined_and_equalto', currentpage.supercategory)|first) %}
<a class="active" href="{{ currentpage.html }}">{{ currentpage.supercategory }}</a> <a class="active" href="{{ currentpage.html }}">{{ currentpage.supercategory }}</a>
{% else %} {% else %}
<a href="{{ (pages|selectattr('supercategory', 'equalto', currentpage.supercategory)|first).html }}"><i class="fa fa-angle-double-left" aria-hidden="true"></i> {{ currentpage.supercategory }}</a> <a href="{{ (pages|selectattr('supercategory', 'defined_and_equalto', currentpage.supercategory)|first).html }}"><i class="fa fa-angle-double-left" aria-hidden="true"></i> {{ currentpage.supercategory }}</a>
{% endif %} {% endif %}
</div> </div>
{% elif currentpage.doc_type is defined %} {% elif currentpage.doc_type is defined %}
<div class="sidenav_parent"> <div class="sidenav_parent">
{% if currentpage == (pages|selectattr('doc_type', 'equalto', currentpage.doc_type)|first) %} {% if currentpage == (pages|selectattr('doc_type', 'defined_and_equalto', currentpage.doc_type)|first) %}
<a class="active" href="{{ currentpage.html }}">{{ currentpage.doc_type }}</a> <a class="active" href="{{ currentpage.html }}">{{ currentpage.doc_type }}</a>
{% else %} {% else %}
<a href="{{ (pages|selectattr('doc_type', 'equalto', currentpage.doc_type)|first).html }}"><i class="fa fa-angle-double-left" aria-hidden="true"></i> {{ currentpage.doc_type }}</a> <a href="{{ (pages|selectattr('doc_type', 'defined_and_equalto', currentpage.doc_type)|first).html }}"><i class="fa fa-angle-double-left" aria-hidden="true"></i> {{ currentpage.doc_type }}</a>
{% endif %} {% endif %}
</div> </div>
{% elif currentpage.funnel is defined %} {% elif currentpage.funnel is defined %}
<div class="sidenav_parent"> <div class="sidenav_parent">
{% if currentpage == (pages|selectattr('funnel', 'equalto', currentpage.funnel)|first) %} {% if currentpage == (pages|selectattr('funnel', 'defined_and_equalto', currentpage.funnel)|first) %}
<a class="active" href="{{ currentpage.html }}">{{ currentpage.funnel }}</a> <a class="active" href="{{ currentpage.html }}">{{ currentpage.funnel }}</a>
{% else %} {% else %}
<a href="{{ (pages|selectattr('funnel', 'equalto', currentpage.funnel)|first).html }}"><i class="fa fa-angle-double-left" aria-hidden="true"></i> {{ currentpage.funnel }}</a> <a href="{{ (pages|selectattr('funnel', 'defined_and_equalto', currentpage.funnel)|first).html }}"><i class="fa fa-angle-double-left" aria-hidden="true"></i> {{ currentpage.funnel }}</a>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
<!--{############# Sidebar links ###############################}--> <!--{############# Sidebar links ###############################}-->
{% if not pages|selectattr("funnel", "equalto", currentpage.funnel)|selectattr("category", "defined")|list|length %} {% if not pages|selectattr("funnel", 'defined_and_equalto', currentpage.funnel)|selectattr("category", "defined")|list|length %}
<!--{##### Case: no funnel categories, simple one-category sidebar ####}--> <!--{##### Case: no funnel categories, simple one-category sidebar ####}-->
{% set funnelpages = pages|selectattr("funnel", "equalto", currentpage.funnel)|list %} {% set funnelpages = pages|selectattr("funnel", 'defined_and_equalto', currentpage.funnel)|list %}
<div id="sidenav" aria-multiselectable="true"> <div id="sidenav" aria-multiselectable="true">
<div class="card active"> <div class="card active">
<div class="card-body"> <div class="card-body">
@@ -39,9 +39,9 @@
{% for page in funnelpages %} {% for page in funnelpages %}
{% if loop.index == 1 %}{# Skip the first element since it's linked by the funnel header #} {% if loop.index == 1 %}{# Skip the first element since it's linked by the funnel header #}
{% elif page == currentpage %} {% elif page == currentpage %}
<li><a class="active nosubcat-page" href="{{ page.html }}">{{ page.name }}{% if page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li> <li><a class="active nosubcat-page" href="{{ page.html }}">{{ page.name }}{% if page.status is defined and page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li>
{% else %} {% else %}
<li><a class="nosubcat-page" href="{{ page.html }}">{{ page.name }}{% if page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li> <li><a class="nosubcat-page" href="{{ page.html }}">{{ page.name }}{% if page.status is defined and page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</ul> </ul>
@@ -53,27 +53,27 @@
<!--{# Case: in a supercategory, show cards for that supercategory's categories #}--> <!--{# Case: in a supercategory, show cards for that supercategory's categories #}-->
<div id="sidenav" role="tablist" aria-multiselectable="true"> <div id="sidenav" role="tablist" aria-multiselectable="true">
{% for cat in categories %} {% for cat in categories %}
{% set catpages = pages|selectattr("category", "equalto", cat)|list %} {% set catpages = pages|selectattr("category", 'defined_and_equalto', cat)|list %}
{% if currentpage.funnel is defined %} {% if currentpage.funnel is defined %}
{% set catpages = catpages|selectattr("funnel", "equalto", currentpage.funnel)|list %} {% set catpages = catpages|selectattr("funnel", 'defined_and_equalto', currentpage.funnel)|list %}
{% endif %} {% endif %}
{% if currentpage.doc_type is defined %} {% if currentpage.doc_type is defined %}
{% set catpages = catpages|selectattr("doc_type", "equalto", currentpage.doc_type)|list %} {% set catpages = catpages|selectattr("doc_type", 'defined_and_equalto', currentpage.doc_type)|list %}
{% endif %} {% endif %}
{% set catpages = catpages|selectattr("supercategory", "equalto", currentpage.supercategory)|list %} {% set catpages = catpages|selectattr("supercategory", 'defined_and_equalto', currentpage.supercategory)|list %}
{% if catpages|length %} {% if catpages|length %}
{% set cat_parent = pages|selectattr('category', 'equalto', cat)|first %} {% set cat_parent = pages|selectattr('category', 'defined_and_equalto', cat)|first %}
<div class="card{% if currentpage.category == cat %} active{% endif %}"> <div class="card{% if currentpage.category is defined and currentpage.category == cat %} active{% endif %}">
<div class="card-header" role="tab" id="sidenav_cat_head_{{loop.index}}"> <div class="card-header" role="tab" id="sidenav_cat_head_{{loop.index}}">
<h5 class="card-title"> <h5 class="card-title">
{% if catpages|length > 1 %} {% if catpages|length > 1 %}
<a class="{% if currentpage.category != cat %}collapsed {% endif %}sidenav_cat_toggler" role="button" data-toggle="collapse" href="#sidenav_collapse_{{loop.index}}" aria-expanded="true" aria-controls="sidenav_collapse_{{loop.index}}">&nbsp;</a> <a class="{% if currentpage.category is undefined or currentpage.category != cat %}collapsed {% endif %}sidenav_cat_toggler" role="button" data-toggle="collapse" href="#sidenav_collapse_{{loop.index}}" aria-expanded="true" aria-controls="sidenav_collapse_{{loop.index}}">&nbsp;</a>
{% endif %} {% endif %}
<a class="sidenav_cat_title{% if currentpage == (cat_parent) %} active{% elif currentpage.category == cat %} active-parent{% endif %}" href="{{ cat_parent.html }}">{{ cat }}</a> <a class="sidenav_cat_title{% if currentpage == (cat_parent) %} active{% elif currentpage.category is defined and currentpage.category == cat %} active-parent{% endif %}" href="{{ cat_parent.html }}">{{ cat }}</a>
</h5> </h5>
</div><!-- /.card-header --> </div><!-- /.card-header -->
<div id="sidenav_collapse_{{loop.index}}" class="collapse{% if currentpage.category == cat %} show{% endif %}" role="tabpanel" aria-labelledby="sidenav_cat_head_{{loop.index}}"> <div id="sidenav_collapse_{{loop.index}}" class="collapse{% if currentpage.category is defined and currentpage.category == cat %} show{% endif %}" role="tabpanel" aria-labelledby="sidenav_cat_head_{{loop.index}}">
<div class="card-body"> <div class="card-body">
<ul class="sidebar_pagelist"> <ul class="sidebar_pagelist">
{% set printed_subcategories = [] %} {% set printed_subcategories = [] %}
@@ -81,25 +81,25 @@
{% if loop.index != 1 %}{# Skip the first element since it's linked by the category header #} {% if loop.index != 1 %}{# Skip the first element since it's linked by the category header #}
{% if page.subcategory is undefined %} {% if page.subcategory is undefined %}
{% if page == currentpage %} {% if page == currentpage %}
<li><a class="active nosubcat-page" href="{{ page.html }}">{{ page.name }}{% if page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li> <li><a class="active nosubcat-page" href="{{ page.html }}">{{ page.name }}{% if page.status is defined and page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li>
{% else %} {% else %}
<li><a class="nosubcat-page" href="{{ page.html }}">{{ page.name }}{% if page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li> <li><a class="nosubcat-page" href="{{ page.html }}">{{ page.name }}{% if page.status is defined and page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li>
{% endif %} {% endif %}
{% elif page.subcategory not in printed_subcategories %} {% elif page.subcategory not in printed_subcategories %}
{% if page == currentpage %} {% if page == currentpage %}
<li><a class="subcat-title active" href="#main_content_body">{{ page.name }}{% if page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li> <li><a class="subcat-title active" href="#main_content_body">{{ page.name }}{% if page.status is defined and page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li>
{% elif page.subcategory == currentpage.subcategory %} {% elif currentpage.subcategory is defined and page.subcategory == currentpage.subcategory %}
<li><a class="subcat-title active-parent" href="{{ page.html }}">{{ page.name }}{% if page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li> <li><a class="subcat-title active-parent" href="{{ page.html }}">{{ page.name }}{% if page.status is defined and page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li>
{% else %} {% else %}
<li><a class="subcat-title" href="{{ page.html }}">{{ page.name }}{% if page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li> <li><a class="subcat-title" href="{{ page.html }}">{{ page.name }}{% if page.status is defined and page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li>
{% endif %} {% endif %}
{% for subpage in catpages|selectattr('subcategory', 'equalto', page.subcategory) %} {% for subpage in catpages|selectattr('subcategory', 'defined_and_equalto', page.subcategory) %}
{% if subpage != page %} {% if subpage != page %}
{% if subpage == currentpage %} {% if subpage == currentpage %}
<li><a class="active subpage" href="#main_content_body">{{ subpage.name }}{% if subpage.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li> <li><a class="active subpage" href="#main_content_body">{{ subpage.name }}{% if subpage.status is defined and subpage.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li>
{% else %} {% else %}
<li><a class="subpage" href="{{ subpage.html }}">{{ subpage.name }}{% if subpage.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li> <li><a class="subpage" href="{{ subpage.html }}">{{ subpage.name }}{% if subpage.status is defined and subpage.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
@@ -120,9 +120,9 @@
{% else %} {% else %}
<!--{##### Case: Not in a supercategory, but siblings might be #}--> <!--{##### Case: Not in a supercategory, but siblings might be #}-->
{% set sidebar_pagelist = pages|selectattr("funnel", "equalto", currentpage.funnel)|list %} {% set sidebar_pagelist = pages|selectattr("funnel", 'defined_and_equalto', currentpage.funnel)|list %}
{% if currentpage.doc_type is defined %} {% if currentpage.doc_type is defined %}
{% set sidebar_pagelist = sidebar_pagelist|selectattr("doc_type", "equalto", currentpage.doc_type)|list %} {% set sidebar_pagelist = sidebar_pagelist|selectattr("doc_type", 'defined_and_equalto', currentpage.doc_type)|list %}
{% endif %} {% endif %}
{% set printed_modules = [] %} {% set printed_modules = [] %}
<div id="sidenav" role="tablist" aria-multiselectable="true"> <div id="sidenav" role="tablist" aria-multiselectable="true">
@@ -131,7 +131,7 @@
{% if page.supercategory not in printed_modules %} {% if page.supercategory not in printed_modules %}
<!--{################# Supercategory Card ####################}--> <!--{################# Supercategory Card ####################}-->
{% set supercat = page.supercategory %} {% set supercat = page.supercategory %}
{% set supercatpages = sidebar_pagelist|selectattr("supercategory", "equalto", page.supercategory)|list %} {% set supercatpages = sidebar_pagelist|selectattr("supercategory", 'defined_and_equalto', page.supercategory)|list %}
{% if supercatpages|length %} {% if supercatpages|length %}
{% set supercat_parent = supercatpages|first %} {% set supercat_parent = supercatpages|first %}
{% set _ = printed_modules.append(page.supercategory) %} {% set _ = printed_modules.append(page.supercategory) %}
@@ -152,14 +152,14 @@
{% for subpage in supercatpages %} {% for subpage in supercatpages %}
{% if loop.index != 1 %}{# Skip the first element since it's linked by the supercategory header #} {% if loop.index != 1 %}{# Skip the first element since it's linked by the supercategory header #}
{% if subpage.category not in printed_categories %} {% if subpage.category not in printed_categories %}
<li><a class="subcat-title" href="{{ subpage.html }}">{{ subpage.name }}{% if page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li> <li><a class="subcat-title" href="{{ subpage.html }}">{{ subpage.name }}{% if page.status is defined and page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li>
{% set category_members = supercatpages|selectattr('category', 'equalto', subpage.category)|list %} {% set category_members = supercatpages|selectattr('category', 'defined_and_equalto', subpage.category)|list %}
<!-- DEBUG: category_members is {{ category_members }} --> <!-- DEBUG: category_members is {{ category_members }} -->
{% for subsubpage in category_members %} {% for subsubpage in category_members %}
{% if subsubpage != subpage and (subsubpage.subcategory is undefined or {% if subsubpage != subpage and (subsubpage.subcategory is undefined or
subsubpage == category_members|selectattr('subcategory', 'equalto', subsubpage.subcategory)|first) %} subsubpage == category_members|selectattr('subcategory', 'defined_and_equalto', subsubpage.subcategory)|first) %}
<li><a class="subpage" href="{{ subsubpage.html }}">{{ subsubpage.name }}{% if subsubpage.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li> <li><a class="subpage" href="{{ subsubpage.html }}">{{ subsubpage.name }}{% if subsubpage.status is defined and subsubpage.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% set _ = printed_categories.append(subpage.category) %} {% set _ = printed_categories.append(subpage.category) %}
@@ -182,20 +182,20 @@
{% elif page.category is defined and page.category not in printed_modules %} {% elif page.category is defined and page.category not in printed_modules %}
<!--{################# Category Card ####################}--> <!--{################# Category Card ####################}-->
{% set cat = page.category %} {% set cat = page.category %}
{% set catpages = sidebar_pagelist|selectattr("category", "equalto", page.category)|list %} {% set catpages = sidebar_pagelist|selectattr("category", 'defined_and_equalto', page.category)|list %}
{% if catpages|length %} {% if catpages|length %}
{% set cat_parent = catpages|first %} {% set cat_parent = catpages|first %}
<div class="card{% if currentpage.category == cat %} active{% endif %}"> <div class="card{% if currentpage.category is defined and currentpage.category == cat %} active{% endif %}">
<div class="card-header" role="tab" id="sidenav_cat_head_{{loop.index}}"> <div class="card-header" role="tab" id="sidenav_cat_head_{{loop.index}}">
<h5 class="card-title"> <h5 class="card-title">
{% if catpages|length > 1 %} {% if catpages|length > 1 %}
<a class="{% if currentpage.category != cat %}collapsed {% endif %}sidenav_cat_toggler" role="button" data-toggle="collapse" href="#sidenav_collapse_{{loop.index}}" aria-expanded="true" aria-controls="sidenav_collapse_{{loop.index}}">&nbsp;</a> <a class="{% if currentpage.category is undefined or currentpage.category != cat %}collapsed {% endif %}sidenav_cat_toggler" role="button" data-toggle="collapse" href="#sidenav_collapse_{{loop.index}}" aria-expanded="true" aria-controls="sidenav_collapse_{{loop.index}}">&nbsp;</a>
{% endif %} {% endif %}
<a class="sidenav_cat_title{% if currentpage == (cat_parent) %} active{% elif currentpage.category == cat %} active-parent{% endif %}" href="{{ cat_parent.html }}">{{ cat }}</a> <a class="sidenav_cat_title{% if currentpage == (cat_parent) %} active{% elif currentpage.category is defined and currentpage.category == cat %} active-parent{% endif %}" href="{{ cat_parent.html }}">{{ cat }}</a>
</h5> </h5>
</div><!-- /.card-header --> </div><!-- /.card-header -->
<div id="sidenav_collapse_{{loop.index}}" class="collapse{% if currentpage.category == cat %} show{% endif %}" role="tabpanel" aria-labelledby="sidenav_cat_head_{{loop.index}}"> <div id="sidenav_collapse_{{loop.index}}" class="collapse{% if currentpage.category is defined and currentpage.category == cat %} show{% endif %}" role="tabpanel" aria-labelledby="sidenav_cat_head_{{loop.index}}">
<div class="card-body"> <div class="card-body">
<ul class="sidebar_pagelist"> <ul class="sidebar_pagelist">
{% set printed_subcategories = [] %} {% set printed_subcategories = [] %}
@@ -203,25 +203,25 @@
{% if loop.index != 1 %}{# Skip the first element since it's linked by the category header #} {% if loop.index != 1 %}{# Skip the first element since it's linked by the category header #}
{% if page.subcategory is undefined %} {% if page.subcategory is undefined %}
{% if page == currentpage %} {% if page == currentpage %}
<li><a class="active nosubcat-page" href="{{ page.html }}">{{ page.name }}{% if page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li> <li><a class="active nosubcat-page" href="{{ page.html }}">{{ page.name }}{% if page.status is defined and page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li>
{% else %} {% else %}
<li><a class="nosubcat-page" href="{{ page.html }}">{{ page.name }}{% if page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li> <li><a class="nosubcat-page" href="{{ page.html }}">{{ page.name }}{% if page.status is defined and page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li>
{% endif %} {% endif %}
{% elif page.subcategory not in printed_subcategories %} {% elif page.subcategory not in printed_subcategories %}
{% if page == currentpage %} {% if page == currentpage %}
<li><a class="subcat-title active" href="#main_content_body">{{ page.name }}{% if page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li> <li><a class="subcat-title active" href="#main_content_body">{{ page.name }}{% if page.status is defined and page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li>
{% elif page.subcategory == currentpage.subcategory %} {% elif page.subcategory is defined and currentpage.subcategory is defined and page.subcategory == currentpage.subcategory %}
<li><a class="subcat-title active-parent" href="{{ page.html }}">{{ page.name }}{% if page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li> <li><a class="subcat-title active-parent" href="{{ page.html }}">{{ page.name }}{% if page.status is defined and page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li>
{% else %} {% else %}
<li><a class="subcat-title" href="{{ page.html }}">{{ page.name }}{% if page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li> <li><a class="subcat-title" href="{{ page.html }}">{{ page.name }}{% if page.status is defined and page.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li>
{% endif %} {% endif %}
{% for subpage in catpages|selectattr('subcategory', 'equalto', page.subcategory) %} {% for subpage in catpages|selectattr('subcategory', 'defined_and_equalto', page.subcategory) %}
{% if subpage != page %} {% if subpage != page %}
{% if subpage == currentpage %} {% if subpage == currentpage %}
<li><a class="active subpage" href="#main_content_body">{{ subpage.name }}{% if subpage.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li> <li><a class="active subpage" href="#main_content_body">{{ subpage.name }}{% if subpage.status is defined and subpage.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li>
{% else %} {% else %}
<li><a class="subpage" href="{{ subpage.html }}">{{ subpage.name }}{% if subpage.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li> <li><a class="subpage" href="{{ subpage.html }}">{{ subpage.name }}{% if subpage.status is defined and subpage.status == "not_enabled" %} {% include 'template-status_not_enabled.html' %}{% endif %}</a></li>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}

View File

@@ -15,7 +15,7 @@
<div class="curated-links"> <div class="curated-links">
<ul> <ul>
{% for link in currentpage.useful_background %} {% for link in currentpage.useful_background %}
{% set linkpage = pages|selectattr("html", "equalto", link)|first %} {% set linkpage = pages|selectattr("html", 'defined_and_equalto', link)|first %}
<li><a href="{{linkpage.html}}">{{linkpage.name}}</a></li> <li><a href="{{linkpage.html}}">{{linkpage.name}}</a></li>
{% endfor %} {% endfor %}
</ol> </ol>