Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions cmd/tools/docs_gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ import (
_ "github.com/redpanda-data/connect/v4/public/components/all"
)

//go:embed templates/bloblang_about.adoc.tmpl
var templateBloblAboutRaw string

//go:embed templates/bloblang_functions.adoc.tmpl
var templateBloblFunctionsRaw string

Expand Down Expand Up @@ -61,6 +64,7 @@ var templateTestsRaw string
var templateTemplatesRaw string

var (
templateBloblAbout *template.Template
templateBloblFunctions *template.Template
templateBloblMethods *template.Template
templatePlugin *template.Template
Expand All @@ -72,6 +76,7 @@ var (
)

func init() {
templateBloblAbout = template.Must(template.New("bloblang about").Parse(templateBloblAboutRaw))
templateBloblFunctions = template.Must(template.New("bloblang functions").Parse(templateBloblFunctionsRaw))
templateBloblMethods = template.Must(template.New("bloblang methods").Parse(templateBloblMethodsRaw))
templatePlugin = template.Must(template.New("plugin").Parse(templatePluginFieldsRaw + templatePluginRaw))
Expand Down Expand Up @@ -114,6 +119,7 @@ func main() {
getSchema().Environment().WalkScanners(viewForDir(path.Join(docsDir, "./scanners")))

// Bloblang stuff
doBloblangAbout(docsDir)
doBloblangMethods(docsDir)
doBloblangFunctions(docsDir)

Expand Down Expand Up @@ -161,6 +167,15 @@ func viewForDir(docsDir string) func(string, *service.ConfigView) {
}
}

func doBloblangAbout(dir string) {
var buf bytes.Buffer
if err := templateBloblAbout.Execute(&buf, nil); err != nil {
panic(fmt.Sprintf("Failed to generate docs for bloblang about: %v", err))
}

create("bloblang about", filepath.Join(dir, "../..", "guides", "pages", "bloblang", "about.adoc"), buf.Bytes())
}

type functionCategory struct {
Name string
Specs []bloblang.TemplateFunctionData
Expand Down
Loading
Loading