{# Return a stylesheet link tag. If asset, construct URL as `static/stylesheets/name.css`, else assume URL is name. #} {% macro stylesheet_tag(name, asset=True, blueprint='') %} {% endmacro %} {# Return a JavaScript link tag. If asset, construct URL as `static/javascripts/name.js`, else assume URL is name. #} {% macro javascript_tag(name, asset=True, blueprint='') %} {% endmacro %} {# Return a list item containing an anchor to the page. If the page is active, or is an ancestor of the active page, an 'active' class is added to the list item. #} {% macro list_link_tag(page, title) %}
  • {{ title }}
  • {% endmacro %} {# Return True if page is the active page, or if it is an ancestor of the active page. This is achieved by exploting the URL structure of a page. Take for example page='parent' This macro will return True for both g.active_page = 'parent' and g.active_page = 'parent/child' #} {% macro active_page_or_ancestor(page) %} {#- Strip off preceeding slash, if present This is useful if the macro is used with url_for, which will insert slashes at the beginning of the name -#} {%- if page.startswith('/') %}{% set page = page[1:] %}{% endif -%} {%- if page == g.active_page[0:page | length] -%} True {%- endif -%} {% endmacro %}