Docs: sort advanced params to the end (#15206)
This commit is contained in:
parent
ccc9e6c19a
commit
67d98707f8
1 changed files with 12 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue