<!-- Extract the feature gate status (i.e. removed or not) from the "Removed" parameter in file -->
{{- $removedStatusForFeature := index $featureGateFile.Params.Removed -}}
<!-- Check if 'stages' parameter is missing in the front matter -->
{{- if not (isSet $featureGateFile.Params "stages") -}}
{{- warnf "Stages parameter is missing in the front matter for %s in %s" $featureGateName (print $featureGateFile.File.Lang "/" $featureGateFile.File.Path) -}}
{{- else -}}
{{- if not $removedFeatureGateRequested -}}
<!-- Check if the feature gate should be included based on the 'include' parameter -->
{{- if $removedStatusForFeature -}}
{{- continue -}}
{{- end -}}
<!-- Check if 'alpha' or 'beta' is specified in 'include' values, set flag accordingly -->
{{- $onlyDisplayAlphaBetaFeature := or (in $includeValues "alpha") (in $includeValues "beta") -}}
{{- $graduatedOrDeprecatedFlag := false -}}
<!-- Iterate through stages for current Feature gate to check for "stable" or "deprecated" stage -->
{{- range $stage := $featureGateFile.Params.stages -}}
{{- if or (eq ($stage).stage "stable") (eq ($stage).stage "deprecated") -}}
{{- $graduatedOrDeprecatedFlag = true -}}
{{- end -}}
{{- end -}}
{{- if eq $onlyDisplayAlphaBetaFeature $graduatedOrDeprecatedFlag -}}
{{- continue -}}
{{- end -}}
{{- else -}}
<!-- Check if 'removed' parameter is not specified, continue to the next iteration -->