Skip to content
Snippets Groups Projects
Verified Commit 96b724c9 authored by Jake's avatar Jake
Browse files

added getters.html

parent 227aecb2
No related branches found
No related tags found
No related merge requests found
{%- macro category_by_name(catname, ignore_native = False) -%}
{%- if ignore_native -%}
{{- caller(null, sc.categories[catname], null) -}}
{%- else -%}
{%- for nativecat, catarticles in categories -%}
{%- if nativecat.name == catname -%}
{{- caller(nativecat, sc.categories[catname], catarticles) -}}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- endmacro -%}
{%- macro tag_by_name(tagname) -%}
{%- for nativetag, tagarticles in tags -%}
{%- if nativetag.name == tagname -%}
{%- if tagname in sc.categories -%}
{{- caller(nativetag, sc.categories[tagname], tagarticles) -}}
{%- else -%}
{{- caller(nativetag, None, tagarticles) -}}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- endmacro -%}
{%- macro article_by_slug(slug, lang) -%}
{%- for a in all_articles -%}
{%- if a.slug == slug and a.lang == lang -%}
{{- caller(a) -}}
{%- endif -%}
{%- endfor -%}
{%- endmacro -%}
{%- macro page_by_slug(slug, lang) -%}
{%- for p in pages -%}
{%- if p.slug == slug and p.lang == lang -%}
{{- caller(p) -}}
{%- endif -%}
{%- endfor -%}
{%- endmacro -%}
{%- macro article_or_page_by_slug(slug, lang) -%}
{%- for a in all_articles -%}
{%- if a.slug == slug and a.lang == lang -%}
{{- caller(a, "article") -}}
{%- endif -%}
{%- endfor -%}
{%- for p in pages -%}
{%- if p.slug == slug and p.lang == lang -%}
{{- caller(p, "page") -}}
{%- endif -%}
{%- endfor -%}
{%- endmacro -%}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment