{% macro chart_timeline(timeline, product, period='month') -%}
{% if timeline %} {% set max_count = timeline.most_common(1)[0][1] %}
{% for start_time, count in timeline.items() | sort %} {% endfor %}
{% for group in timeline | groupby('year') %} {{ group.grouper }} {% endfor %}
{% endif %}
{%- endmacro %} {% macro query_param_list(d, prefix="", wide=false, show_nulls=true, show_dicts=true, descriptions=None, fallback_dict={}) -%}
{% for key, value in d | dictsort if (show_dicts or value is not mapping) recursive %} {% if show_nulls or (value is not none) or (key in fallback_dict) %} {{- key -}} {%- if value is mapping -%} {{- loop(value.items()) -}} {%- elif value is none -%} {%- if key in fallback_dict -%} {% if fallback_dict[key] is not none %} {{- fallback_dict[key] | query_value -}} {% else %} {% endif %} {%- else -%} {%- endif -%} {%- else -%} {{- value | query_value -}} {%- endif -%} {% endif %} {% endfor %}
{%- endmacro %} {% macro _show_raw_keyval(value) -%} {%- if value is string or value is number -%} {{ value }} {%- elif value is mapping -%} {%- for key, val in value.items() %}
{{ key }}: {{ _show_raw_keyval(val) }}
{%- endfor %} {# A string is an iterable, so we check for it above #} {%- elif value is iterable -%} {# If it's a long list, make is expandable/collapsable #} {% if value | length > 20 %}
[ [{{ value | length }} items...] {%- for item in value %}
{{ _show_raw_keyval(item) }},
{% endfor %} ]
{% else %} [ {%- for item in value %}
{{ _show_raw_keyval(item) }}
{% endfor %} ]
{% endif %} {%- else -%} {{ value | torapidjson}} {%- endif -%} {%- endmacro %} {% macro show_raw_document(doc) -%}
{{ _show_raw_keyval(doc) }}
{%- endmacro %}