Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCFIX] Fix check-docs errMsg bug #18138

Merged
merged 3 commits into from
Sep 14, 2023
Merged
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
7 changes: 4 additions & 3 deletions dev/scripts/src/alluxio.org/check-docs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,15 @@ func parseMenuUrl(menuPath string) (map[string]struct{}, error) {
}
menuMap := map[string]struct{}{}
var errMsgs []string
checkAndSaveUrl(ret, menuMap, errMsgs)
errMsgs = checkAndSaveUrl(ret, menuMap, errMsgs)
if len(errMsgs) > 0 {
return nil, fmt.Errorf("encountered errors parsing %v:\n%v", menuPath, strings.Join(errMsgs, "\n"))
}
return menuMap, nil
}

// recursion function for more levels of docs
func checkAndSaveUrl(files []File, menuMap map[string]struct{}, errMsgs []string) {
func checkAndSaveUrl(files []File, menuMap map[string]struct{}, errMsgs []string) []string {
for _, file := range files {
// if buttonTitle have whitespace, the button for list-nav-item in html will not expand
if strings.ContainsAny(file.ButtonTitle, " \t\n\r") {
Expand All @@ -316,14 +316,15 @@ func checkAndSaveUrl(files []File, menuMap map[string]struct{}, errMsgs []string
// ignore the folder path
if subfile.URL == "" {
//recall the function until subfile.subFiles is empty
checkAndSaveUrl(subfile.Subfiles, menuMap, errMsgs)
errMsgs = checkAndSaveUrl(subfile.Subfiles, menuMap, errMsgs)
continue
}
// replace the url ending to .md in order to compare with actually list of docs in directory of docs
subfilePath := strings.Replace(subfile.URL, htmlType, mdType, 1)
menuMap[subfilePath] = struct{}{}
}
}
return errMsgs
}

// Check menu.yml URLs should match exactly with list of all markdown doc files
Expand Down
Loading