@@ -208,12 +208,33 @@ func getValuesTableTemplates() string {
208
208
valuesSectionBuilder .WriteString (`{{ define "chart.valuesHeader" }}## Values{{ end }}` )
209
209
210
210
valuesSectionBuilder .WriteString (`{{ define "chart.valuesTable" }}` )
211
+ valuesSectionBuilder .WriteString ("{{ if .Sections.Sections }}" )
212
+ valuesSectionBuilder .WriteString ("{{ range .Sections.Sections }}" )
213
+ valuesSectionBuilder .WriteString ("\n " )
214
+ valuesSectionBuilder .WriteString ("\n ### {{ .SectionName }}\n " )
215
+ valuesSectionBuilder .WriteString ("| Key | Type | Default | Description |\n " )
216
+ valuesSectionBuilder .WriteString ("|-----|------|---------|-------------|\n " )
217
+ valuesSectionBuilder .WriteString (" {{- range .SectionItems }}" )
218
+ valuesSectionBuilder .WriteString ("\n | {{ .Key }} | {{ .Type }} | {{ if .Default }}{{ .Default }}{{ else }}{{ .AutoDefault }}{{ end }} | {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }} |" )
219
+ valuesSectionBuilder .WriteString (" {{- end }}" )
220
+ valuesSectionBuilder .WriteString ("{{- end }}" )
221
+ valuesSectionBuilder .WriteString ("{{ if .Sections.DefaultSection.SectionItems}}" )
222
+ valuesSectionBuilder .WriteString ("\n " )
223
+ valuesSectionBuilder .WriteString ("\n ### {{ .Sections.DefaultSection.SectionName }}\n " )
224
+ valuesSectionBuilder .WriteString ("| Key | Type | Default | Description |\n " )
225
+ valuesSectionBuilder .WriteString ("|-----|------|---------|-------------|\n " )
226
+ valuesSectionBuilder .WriteString (" {{- range .Sections.DefaultSection.SectionItems }}" )
227
+ valuesSectionBuilder .WriteString ("\n | {{ .Key }} | {{ .Type }} | {{ if .Default }}{{ .Default }}{{ else }}{{ .AutoDefault }}{{ end }} | {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }} |" )
228
+ valuesSectionBuilder .WriteString (" {{- end }}" )
229
+ valuesSectionBuilder .WriteString ("{{ end }}" )
230
+ valuesSectionBuilder .WriteString ("{{ else }}" )
211
231
valuesSectionBuilder .WriteString ("| Key | Type | Default | Description |\n " )
212
232
valuesSectionBuilder .WriteString ("|-----|------|---------|-------------|\n " )
213
233
valuesSectionBuilder .WriteString (" {{- range .Values }}" )
214
234
valuesSectionBuilder .WriteString ("\n | {{ .Key }} | {{ .Type }} | {{ if .Default }}{{ .Default }}{{ else }}{{ .AutoDefault }}{{ end }} | {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }} |" )
215
235
valuesSectionBuilder .WriteString (" {{- end }}" )
216
236
valuesSectionBuilder .WriteString ("{{ end }}" )
237
+ valuesSectionBuilder .WriteString ("{{ end }}" )
217
238
218
239
valuesSectionBuilder .WriteString (`{{ define "chart.valuesSection" }}` )
219
240
valuesSectionBuilder .WriteString ("{{ if .Values }}" )
@@ -243,6 +264,9 @@ func getValuesTableTemplates() string {
243
264
{{ end }}
244
265
245
266
{{ define "chart.valuesTableHtml" }}
267
+ {{ if .Sections.Sections }}
268
+ {{- range .Sections.Sections }}
269
+ <h3>{{- .SectionName }}</h3>
246
270
<table>
247
271
<thead>
248
272
<th>Key</th>
@@ -251,7 +275,7 @@ func getValuesTableTemplates() string {
251
275
<th>Description</th>
252
276
</thead>
253
277
<tbody>
254
- {{- range .Values }}
278
+ {{- range .SectionItems }}
255
279
<tr>
256
280
<td>{{ .Key }}</td>
257
281
<td>{{ .Type }}</td>
@@ -261,65 +285,29 @@ func getValuesTableTemplates() string {
261
285
{{- end }}
262
286
</tbody>
263
287
</table>
264
- {{ end }}
265
-
266
- {{ define "chart.valuesSectionHtml" }}
267
- {{ if .Values }}
268
- {{ template "chart.valuesHeader" . }}
269
- {{ template "chart.valuesTableHtml" . }}
270
- {{ end }}
271
- {{ end }}
272
- ` )
273
-
274
- return valuesSectionBuilder .String ()
275
- }
276
-
277
- func getValuesTableSectionedTemplates () string {
278
- valuesSectionBuilder := strings.Builder {}
279
- valuesSectionBuilder .WriteString (`{{ define "chart.valuesSectionedHeader" }}## Values{{ end }}` )
280
-
281
- valuesSectionBuilder .WriteString (`{{ define "chart.valuesSectionedTable" }}` )
282
- valuesSectionBuilder .WriteString ("{{ range .Sections }}" )
283
- valuesSectionBuilder .WriteString ("\n " )
284
- valuesSectionBuilder .WriteString ("\n ### {{ .SectionName }}\n " )
285
- valuesSectionBuilder .WriteString ("| Key | Type | Default | Description |\n " )
286
- valuesSectionBuilder .WriteString ("|-----|------|---------|-------------|\n " )
287
- valuesSectionBuilder .WriteString (" {{- range .SectionItems }}" )
288
- valuesSectionBuilder .WriteString ("\n | {{ .Key }} | {{ .Type }} | {{ if .Default }}{{ .Default }}{{ else }}{{ .AutoDefault }}{{ end }} | {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }} |" )
289
- valuesSectionBuilder .WriteString (" {{- end }}" )
290
- valuesSectionBuilder .WriteString ("{{ end }}" )
291
- valuesSectionBuilder .WriteString ("{{ end }}" )
292
-
293
- valuesSectionBuilder .WriteString (`{{ define "chart.valuesSectionedSection" }}` )
294
- valuesSectionBuilder .WriteString ("{{ if .Values }}" )
295
- valuesSectionBuilder .WriteString (`{{ template "chart.valuesSectionedHeader" . }}` )
296
- valuesSectionBuilder .WriteString ("\n \n " )
297
- valuesSectionBuilder .WriteString (`{{ template "chart.valuesSectionedTable" . }}` )
298
- valuesSectionBuilder .WriteString ("{{ end }}" )
299
- valuesSectionBuilder .WriteString ("{{ end }}" )
300
-
301
- // For HTML tables
302
- valuesSectionBuilder .WriteString (`
303
- {{ define "chart.valueDefaultColumnRender" }}
304
- {{- $defaultValue := (default .Default .AutoDefault) -}}
305
- {{- $notationType := .NotationType }}
306
- {{- if (and (hasPrefix "` + "`" + `" $defaultValue) (hasSuffix "` + "`" + `" $defaultValue) ) -}}
307
- {{- $defaultValue = (toPrettyJson (fromJson (trimAll "` + "`" + `" (default .Default .AutoDefault) ) ) ) -}}
308
- {{- $notationType = "json" }}
309
- {{- end -}}
310
- <pre lang="{{ $notationType }}">
311
- {{- if (eq $notationType "tpl" ) }}
312
- {{ .Key }}: |
313
- {{- $defaultValue | nindent 2 }}
314
- {{- else }}
315
- {{ $defaultValue }}
316
288
{{- end }}
317
- </pre>
289
+ {{ if .Sections.DefaultSection.SectionItems }}
290
+ <h3>{{- .Sections.DefaultSection.SectionName }}</h3>
291
+ <table>
292
+ <thead>
293
+ <th>Key</th>
294
+ <th>Type</th>
295
+ <th>Default</th>
296
+ <th>Description</th>
297
+ </thead>
298
+ <tbody>
299
+ {{- range .Sections.DefaultSection.SectionItems }}
300
+ <tr>
301
+ <td>{{ .Key }}</td>
302
+ <td>{{ .Type }}</td>
303
+ <td>{{ template "chart.valueDefaultColumnRender" . }}</td>
304
+ <td>{{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }}</td>
305
+ </tr>
306
+ {{- end }}
307
+ </tbody>
308
+ </table>
318
309
{{ end }}
319
-
320
- {{ define "chart.valuesSectionedTableHtml" }}
321
- {{- range .Sections }}
322
- <h3>{{- .SectionName }}</h3>
310
+ {{ else }}
323
311
<table>
324
312
<thead>
325
313
<th>Key</th>
@@ -328,7 +316,7 @@ func getValuesTableSectionedTemplates() string {
328
316
<th>Description</th>
329
317
</thead>
330
318
<tbody>
331
- {{- range .SectionItems }}
319
+ {{- range .Values }}
332
320
<tr>
333
321
<td>{{ .Key }}</td>
334
322
<td>{{ .Type }}</td>
@@ -338,13 +326,13 @@ func getValuesTableSectionedTemplates() string {
338
326
{{- end }}
339
327
</tbody>
340
328
</table>
341
- {{- end }}
329
+ {{ end }}
342
330
{{ end }}
343
331
344
- {{ define "chart.valuesSectionedSectionHtml " }}
332
+ {{ define "chart.valuesSectionHtml " }}
345
333
{{ if .Sections }}
346
- {{ template "chart.valuesSectionedHeader " . }}
347
- {{ template "chart.valuesSectionedTableHtml " . }}
334
+ {{ template "chart.valuesHeader " . }}
335
+ {{ template "chart.valuesTableHtml " . }}
348
336
{{ end }}
349
337
{{ end }}
350
338
` )
@@ -428,7 +416,6 @@ func getDocumentationTemplates(chartDirectory string, chartSearchRoot string, te
428
416
getSourceLinkTemplates (),
429
417
getRequirementsTableTemplates (),
430
418
getValuesTableTemplates (),
431
- getValuesTableSectionedTemplates (),
432
419
getHomepageTemplate (),
433
420
getMaintainersTemplate (),
434
421
getHelmDocsVersionTemplates (),
0 commit comments