Skip to content

Commit

Permalink
Update pkg/code-generator/docgen/generator.go
Browse files Browse the repository at this point in the history
Co-authored-by: Ariana W. <[email protected]>
  • Loading branch information
sam-heilbron and arianaw66 authored Nov 19, 2024
1 parent e957195 commit ba7cbce
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/code-generator/docgen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,12 @@ func (d *DocsGen) hugoFileHeader(filename string) string {
name := filepath.Base(filename)

var title string
if strings.HasSuffix(name, d.protoSuffix()) {
// Remove the "sk.md" extensions
name = name[:len(name)-len(d.protoSuffix())]
protoExtension := ".proto"+d.protoSuffix()
if strings.HasSuffix(name, protoExtension) {
// Remove the "proto.sk.md" extension
name = name[:len(name)-len(protoExtension)]

// Remove the ".proto" extension
extension := filepath.Ext(name)
title = strcase.ToCamel(name[0 : len(name)-len(extension)])
title = strcase.ToCamel(name)
} else {
// Not a file for a proto file, leave the title to match the name of the file
title = name
Expand Down

0 comments on commit ba7cbce

Please sign in to comment.