From 195e683c8525db8f5435588489b0bc144d0c1edc Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 18 Nov 2019 09:23:03 +0100 Subject: [PATCH] use dictsort filter in template --- CHANGELOG.md | 1 + ansibledoctor/templates/readme/_toc.j2 | 2 +- ansibledoctor/templates/readme/_vars.j2 | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80dfd1a..36d28e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,3 +5,4 @@ * fix handling of multiline default values in template * FEATURE * use explicit marker to convert annotation values to json + * use dictsort filter in template for ordered variable list diff --git a/ansibledoctor/templates/readme/_toc.j2 b/ansibledoctor/templates/readme/_toc.j2 index b33aefe..660519e 100644 --- a/ansibledoctor/templates/readme/_toc.j2 +++ b/ansibledoctor/templates/readme/_toc.j2 @@ -3,7 +3,7 @@ {% set var = role.var | default({}) %} {% if var %} * [Default Variables](#default-variables) -{% for key, item in var.items() %} +{% for key, item in var | dictsort %} * [{{ key }}](#{{ key }}) {% endfor %} {% endif %} diff --git a/ansibledoctor/templates/readme/_vars.j2 b/ansibledoctor/templates/readme/_vars.j2 index 3aa213f..43dfd67 100644 --- a/ansibledoctor/templates/readme/_vars.j2 +++ b/ansibledoctor/templates/readme/_vars.j2 @@ -2,7 +2,7 @@ {% if var %} ## Default Variables -{% for key, item in var.items() %} +{% for key, item in var | dictsort %} ### {{ key }} {% if item.description is defined and item.description %}