Reformat links as well
This commit is contained in:
parent
84a3ef96ba
commit
625f4a991d
@ -33,6 +33,8 @@ func main() {
|
|||||||
out.WriteString("// Use 'go generate ./commands' to update\n")
|
out.WriteString("// Use 'go generate ./commands' to update\n")
|
||||||
fileregex := regexp.MustCompile(`git-lfs(?:-([A-Za-z\-]+))?.\d.ronn`)
|
fileregex := regexp.MustCompile(`git-lfs(?:-([A-Za-z\-]+))?.\d.ronn`)
|
||||||
headerregex := regexp.MustCompile(`^###?\s+([A-Za-z0-9 ]+)`)
|
headerregex := regexp.MustCompile(`^###?\s+([A-Za-z0-9 ]+)`)
|
||||||
|
// only pick up caps in links to avoid matching optional args
|
||||||
|
linkregex := regexp.MustCompile(`\[([A-Z\- ]+)\]`)
|
||||||
count := 0
|
count := 0
|
||||||
for _, f := range fs {
|
for _, f := range fs {
|
||||||
if match := fileregex.FindStringSubmatch(f.Name()); match != nil {
|
if match := fileregex.FindStringSubmatch(f.Name()); match != nil {
|
||||||
@ -85,6 +87,11 @@ func main() {
|
|||||||
firstHeaderDone = true
|
firstHeaderDone = true
|
||||||
lastLineWasBullet = false
|
lastLineWasBullet = false
|
||||||
continue
|
continue
|
||||||
|
} else if lmatches := linkregex.FindAllStringSubmatch(line, -1); lmatches != nil {
|
||||||
|
for _, lmatch := range lmatches {
|
||||||
|
linktext := strings.ToLower(lmatch[1])
|
||||||
|
line = strings.Replace(line, lmatch[0], `"`+strings.ToUpper(linktext[:1])+linktext[1:]+`"`, 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Skip content until after first header
|
// Skip content until after first header
|
||||||
if !firstHeaderDone {
|
if !firstHeaderDone {
|
||||||
|
Loading…
Reference in New Issue
Block a user