(fileName string, base string)
| 234 | } |
| 235 | |
| 236 | func commandSegments(fileName string, base string) ([]string, error) { |
| 237 | if base == docpostAghKey { |
| 238 | return nil, nil |
| 239 | } |
| 240 | if !strings.HasPrefix(base, "agh_") { |
| 241 | return nil, fmt.Errorf("docpost: unexpected filename %q (must be 'agh.md' or start with 'agh_')", fileName) |
| 242 | } |
| 243 | segments := strings.Split(base, "_")[1:] |
| 244 | for _, segment := range segments { |
| 245 | if !segmentRe.MatchString(segment) { |
| 246 | return nil, fmt.Errorf("docpost: unexpected filename %q (invalid command segment %q)", fileName, segment) |
| 247 | } |
| 248 | } |
| 249 | return segments, nil |
| 250 | } |
| 251 | |
| 252 | // computeHasChildren marks a baseName as a "parent" when any other input's |
| 253 | // baseName starts with baseName + "_". Parents render as index.mdx in their |
no outgoing calls