From d2e11a2bf35309c8a1bc0c8376946a710f5209d0 Mon Sep 17 00:00:00 2001 From: Dan Kortschak Date: Sat, 10 Oct 2020 15:55:39 +1030 Subject: [PATCH] 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 gopls-CI: kokoro TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor Trust: Cherry Zhang --- present/parse.go | 1 + present/testdata/media.p | 2 ++ 2 files changed, 3 insertions(+) diff --git a/present/parse.go b/present/parse.go index 83405599d2..4294ea5f9c 100644 --- a/present/parse.go +++ b/present/parse.go @@ -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. diff --git a/present/testdata/media.p b/present/testdata/media.p index f11970b793..ffddf9f35f 100644 --- a/present/testdata/media.p +++ b/present/testdata/media.p @@ -2,6 +2,7 @@ Media * +The Gopher .image gopher.jpg _ 100 .caption A gopher. @@ -14,6 +15,7 @@ Media ---

Media

+

The Gopher

A gopher.