From 67d98707f87c9b4e92df46cd9ff264f98ecafa1a Mon Sep 17 00:00:00 2001 From: Michael Geers Date: Fri, 2 Aug 2024 17:55:53 +0200 Subject: [PATCH] Docs: sort advanced params to the end (#15206) --- util/templates/documentation.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/util/templates/documentation.go b/util/templates/documentation.go index 004d7a18d..c041af521 100644 --- a/util/templates/documentation.go +++ b/util/templates/documentation.go @@ -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,