Docs: sort advanced params to the end (#15206)

This commit is contained in:
Michael Geers 2024-08-02 17:55:53 +02:00 • committed by GitHub
parent ccc9e6c19a
commit 67d98707f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,6 +3,7 @@ package templates
import (
"bytes"
_ "embed"
"slices"
"strconv"
"strings"
"text/template"
@ -77,6 +78,17 @@ func (t *Template) RenderDocumentation(product Product, lang string) ([]byte, er
filteredParams = append(filteredParams, param)
}
// all advanced params should be sorted to the end
slices.SortStableFunc(filteredParams, func(i, j Param) int {
if i.IsAdvanced() && !j.IsAdvanced() {
return 1
}
if !i.IsAdvanced() && j.IsAdvanced() {
return -1
}
return 0
})
data := map[string]interface{}{
"Template": t.Template,
"ProductBrand": product.Brand,