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 %}