mirror of https://github.com/docker/cli.git
Fix leading characters being stripped from example sections in YAML
`strings.Trim()` strips any character listed in the `cutset` argument, so any example section having `E`, `x`, `a`, `m`, `p`, `l`, `e`, or `s` in the first word, had these characters missing in the generated YAML. Also trim superfluent whitespace characters to consistently use `|-` ("strip") as block chomping indicator (see http://www.yaml.org/spec/1.2/spec.html#id2794534) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
da82dcb1db
commit
1f605d43ca
|
@ -220,10 +220,10 @@ func parseMDContent(mdString string) (description string, examples string) {
|
|||
parsedContent := strings.Split(mdString, "\n## ")
|
||||
for _, s := range parsedContent {
|
||||
if strings.Index(s, "Description") == 0 {
|
||||
description = strings.Trim(s, "Description\n")
|
||||
description = strings.TrimSpace(strings.TrimPrefix(s, "Description"))
|
||||
}
|
||||
if strings.Index(s, "Examples") == 0 {
|
||||
examples = strings.Trim(s, "Examples\n")
|
||||
examples = strings.TrimSpace(strings.TrimPrefix(s, "Examples"))
|
||||
}
|
||||
}
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue