Skip to content

Commit

Permalink
fix(template functions): Use function Title instead of ToTitle to get…
Browse files Browse the repository at this point in the history
… Capitalize strings instead of upper strings

using cases.Title because the strings.Title function is deprecated and refs to cases.Title
  • Loading branch information
anmoel committed Jun 30, 2022
1 parent fac6290 commit da9bcc7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -12,6 +12,7 @@ require (
github.com/mitchellh/cli v1.1.4
github.com/russross/blackfriday v1.6.0
github.com/zclconf/go-cty v1.10.0
golang.org/x/text v0.3.7
)

require (
Expand All @@ -37,5 +38,4 @@ require (
github.com/spf13/cast v1.5.0 // indirect
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b // indirect
golang.org/x/text v0.3.7 // indirect
)
4 changes: 3 additions & 1 deletion internal/provider/template.go
Expand Up @@ -7,6 +7,8 @@ import (
"strings"
"text/template"

"golang.org/x/text/cases"

tfjson "github.com/hashicorp/terraform-json"

"github.com/hashicorp/terraform-plugin-docs/internal/mdplain"
Expand Down Expand Up @@ -39,7 +41,7 @@ func newTemplate(name, text string) (*template.Template, error) {
"prefixlines": tmplfuncs.PrefixLines,
"split": strings.Split,
"tffile": terraformCodeFile,
"title": strings.ToTitle,
"title": cases.Title,
"trimspace": strings.TrimSpace,
"upper": strings.ToUpper,
})
Expand Down

0 comments on commit da9bcc7

Please sign in to comment.