present: don't drop commands that immediately follow text

Prior to this, the line identified as the start of a command by the test
for a leading dot was dropped. This behaviour is not documented in the
present package documentation.

Change-Id: Ib7354f0f4a661fccc65be5f92d487fe7f627302f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/260899
Run-TryBot: Ian Lance Taylor <iant@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Dan Kortschak 2020-10-10 15:55:39 +10:30 коммит произвёл Ian Lance Taylor
Родитель 695b16757a
Коммит d2e11a2bf3
2 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

@ -525,6 +525,7 @@ func parseSections(ctx *Context, name, prefix string, lines *Lines, number []int
// Command breaks text block.
// Section heading breaks text block in markdown.
if text[0] == '.' || isSpeakerNote(text) {
lines.back()
break
}
if strings.HasPrefix(text, `\.`) { // Backslash escapes initial period.

2
present/testdata/media.p поставляемый
Просмотреть файл

@ -2,6 +2,7 @@ Media
*
The Gopher
.image gopher.jpg _ 100
.caption A gopher.
@ -14,6 +15,7 @@ Media
---
<h1>Media</h1>
<section>
<p>The Gopher</p>
<img src="gopher.jpg" width="100" alt="">
<figcaption>A gopher.</figcaption>
<iframe src="https://golang.org/"></iframe>