Skip to content

Commit 625f4a9

Browse files
committed
Reformat links as well
1 parent 84a3ef9 commit 625f4a9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/man/mangen.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ func main() {
3333
out.WriteString("// Use 'go generate ./commands' to update\n")
3434
fileregex := regexp.MustCompile(`git-lfs(?:-([A-Za-z\-]+))?.\d.ronn`)
3535
headerregex := regexp.MustCompile(`^###?\s+([A-Za-z0-9 ]+)`)
36+
// only pick up caps in links to avoid matching optional args
37+
linkregex := regexp.MustCompile(`\[([A-Z\- ]+)\]`)
3638
count := 0
3739
for _, f := range fs {
3840
if match := fileregex.FindStringSubmatch(f.Name()); match != nil {
@@ -85,6 +87,11 @@ func main() {
8587
firstHeaderDone = true
8688
lastLineWasBullet = false
8789
continue
90+
} else if lmatches := linkregex.FindAllStringSubmatch(line, -1); lmatches != nil {
91+
for _, lmatch := range lmatches {
92+
linktext := strings.ToLower(lmatch[1])
93+
line = strings.Replace(line, lmatch[0], `"`+strings.ToUpper(linktext[:1])+linktext[1:]+`"`, 1)
94+
}
8895
}
8996
// Skip content until after first header
9097
if !firstHeaderDone {

0 commit comments

Comments
 (0)