Skip to content

Commit b3ff514

Browse files
committed
Move template package from internal to public
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
1 parent 4f698fb commit b3ff514

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+402
-159
lines changed

internal/format/asciidoc_document.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import (
1515
gotemplate "text/template"
1616

1717
"github.com/terraform-docs/terraform-docs/internal/print"
18-
"github.com/terraform-docs/terraform-docs/internal/template"
1918
"github.com/terraform-docs/terraform-docs/internal/terraform"
19+
"github.com/terraform-docs/terraform-docs/template"
2020
)
2121

2222
//go:embed templates/asciidoc_document*.tmpl

internal/format/asciidoc_table.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import (
1515
gotemplate "text/template"
1616

1717
"github.com/terraform-docs/terraform-docs/internal/print"
18-
"github.com/terraform-docs/terraform-docs/internal/template"
1918
"github.com/terraform-docs/terraform-docs/internal/terraform"
19+
"github.com/terraform-docs/terraform-docs/template"
2020
)
2121

2222
//go:embed templates/asciidoc_table*.tmpl

internal/format/markdown_document.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import (
1515
gotemplate "text/template"
1616

1717
"github.com/terraform-docs/terraform-docs/internal/print"
18-
"github.com/terraform-docs/terraform-docs/internal/template"
1918
"github.com/terraform-docs/terraform-docs/internal/terraform"
19+
"github.com/terraform-docs/terraform-docs/template"
2020
)
2121

2222
//go:embed templates/markdown_document*.tmpl

internal/format/markdown_table.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import (
1515
gotemplate "text/template"
1616

1717
"github.com/terraform-docs/terraform-docs/internal/print"
18-
"github.com/terraform-docs/terraform-docs/internal/template"
1918
"github.com/terraform-docs/terraform-docs/internal/terraform"
19+
"github.com/terraform-docs/terraform-docs/template"
2020
)
2121

2222
//go:embed templates/markdown_table*.tmpl

internal/format/pretty.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717
gotemplate "text/template"
1818

1919
"github.com/terraform-docs/terraform-docs/internal/print"
20-
"github.com/terraform-docs/terraform-docs/internal/template"
2120
"github.com/terraform-docs/terraform-docs/internal/terraform"
21+
"github.com/terraform-docs/terraform-docs/template"
2222
)
2323

2424
//go:embed templates/pretty.tmpl

internal/format/tfvars_hcl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ import (
1717
gotemplate "text/template"
1818

1919
"github.com/terraform-docs/terraform-docs/internal/print"
20-
"github.com/terraform-docs/terraform-docs/internal/template"
2120
"github.com/terraform-docs/terraform-docs/internal/terraform"
2221
"github.com/terraform-docs/terraform-docs/internal/types"
22+
"github.com/terraform-docs/terraform-docs/template"
2323
)
2424

2525
//go:embed templates/tfvars_hcl.tmpl

internal/format/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"regexp"
1818
"strings"
1919

20-
"github.com/terraform-docs/terraform-docs/internal/template"
20+
"github.com/terraform-docs/terraform-docs/template"
2121
)
2222

2323
// sanitize cleans a Markdown document to soothe linters.

internal/template/doc.go

Lines changed: 0 additions & 12 deletions
This file was deleted.

internal/template/template.go

Lines changed: 0 additions & 89 deletions
This file was deleted.

internal/template/anchor.go renamed to template/anchor.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,27 @@ import (
1616
"github.com/terraform-docs/terraform-docs/internal/print"
1717
)
1818

19-
// createAnchorMarkdown
20-
func createAnchorMarkdown(t string, s string, settings *print.Settings) string {
21-
sanitizedName := sanitizeName(s, settings)
19+
// CreateAnchorMarkdown creates HTML anchor for Markdown format.
20+
func CreateAnchorMarkdown(t string, s string, settings *print.Settings) string {
21+
sanitizedName := SanitizeName(s, settings)
2222

2323
if settings.ShowAnchor {
2424
anchorName := fmt.Sprintf("%s_%s", t, s)
25-
sanitizedAnchorName := sanitizeName(anchorName, settings)
25+
sanitizedAnchorName := SanitizeName(anchorName, settings)
2626
// the <a> link is purposely not sanitized as this breaks markdown formatting
2727
return fmt.Sprintf("<a name=\"%s\"></a> [%s](#%s)", anchorName, sanitizedName, sanitizedAnchorName)
2828
}
2929

3030
return sanitizedName
3131
}
3232

33-
// createAnchorAsciidoc
34-
func createAnchorAsciidoc(t string, s string, settings *print.Settings) string {
35-
sanitizedName := sanitizeName(s, settings)
33+
// CreateAnchorAsciidoc creates HTML anchor for AsciiDoc format.
34+
func CreateAnchorAsciidoc(t string, s string, settings *print.Settings) string {
35+
sanitizedName := SanitizeName(s, settings)
3636

3737
if settings.ShowAnchor {
3838
anchorName := fmt.Sprintf("%s_%s", t, s)
39-
sanitizedAnchorName := sanitizeName(anchorName, settings)
39+
sanitizedAnchorName := SanitizeName(anchorName, settings)
4040
return fmt.Sprintf("[[%s]] <<%s,%s>>", sanitizedAnchorName, sanitizedAnchorName, sanitizedName)
4141
}
4242

0 commit comments

Comments
 (0)