1
0
mirror of https://github.com/golang/go synced 2024-11-18 11:44:45 -07:00

present: allow line-wrapping of bullet list items

This is not strictly necessary, but being able to wrap these long lines
helps make the diffs for the Markdown conversion of old files easier to read.

The wrapping of the blog is in CL 222839.

For golang/go#33955.

Change-Id: I26c3f8db6b137c194f03b2538f221aa4fc3f2324
Reviewed-on: https://go-review.googlesource.com/c/tools/+/222843
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
Russ Cox 2020-03-09 22:15:04 -04:00
parent c312e98713
commit 19e328c07e
2 changed files with 13 additions and 4 deletions

View File

@ -44,7 +44,8 @@ After that come slides/sections, each after a blank line:
- bullets
- more bullets
- a bullet with
- a bullet continued
on the next line
*** Sub-subsection

View File

@ -376,9 +376,17 @@ func parseSections(ctx *Context, name string, lines *Lines, number []int) ([]Sec
e = Text{Lines: []string{pre}, Pre: true}
case strings.HasPrefix(text, "- "):
var b []string
for ok && strings.HasPrefix(text, "- ") {
b = append(b, text[2:])
text, ok = lines.next()
for {
if strings.HasPrefix(text, "- ") {
b = append(b, text[2:])
} else if len(b) > 0 && strings.HasPrefix(text, " ") {
b[len(b)-1] += "\n" + strings.TrimSpace(text)
} else {
break
}
if text, ok = lines.next(); !ok {
break
}
}
lines.back()
e = List{Bullet: b}