{% macro timestamp(unix_ts) -%} {{ unix_ts | ts_datetime('%Y-%m-%d %H:%M')}} ST {%- endmacro %} {% macro subheader(title, desc='') -%}

{{title}}

{%- if desc -%}{{desc}}{%- endif -%}
{% if caller %}{{- caller() -}}{% endif %}
{%- endmacro %} {% macro pager(current_page, page_count, classes='', url='', args={}) -%} {%- if args -%} {#- remove the page query argument -#} {%- set fargs = dict(args.items() | rejectattr(0, 'equalto', 'page')) -%} {%- set url = url + (fargs | dict_to_query_string) + '&page=' -%} {%- else -%} {%- set url = url + '?page=' -%} {%- endif -%} {%- if current_page == 0 -%} {%- if page_count <= 3 -%} {%- for i in range(page_count) -%} {{i+1}} {%- endfor -%} {%- else -%} 1 2 {{page_count - 1}} {{page_count}} {%- endif -%} {%- else -%} {%- set left_start = [2, current_page - 1] | max -%} {%- set right_end = [page_count - 1, current_page + 1] | min -%} {%- if current_page != 1 -%} 1 {%- endif -%} {%- if left_start > 2 -%} {%- endif -%} {%- for i in range(left_start, current_page) -%} {{i}} {%- endfor -%} {%- if page_count > 0 -%} {%- endif -%} {%- for i in range(current_page + 1, right_end + 1) -%} {{i}} {%- endfor -%} {%- if right_end < page_count - 1 -%} {%- endif -%} {%- if page_count > 1 and current_page != page_count -%} {{page_count}} {%- endif -%} {%- endif -%} {%- endmacro %}