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:
parent
c312e98713
commit
19e328c07e
@ -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
|
||||
|
||||
|
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user