tour: make space optional after "#appengine:" prefix

This change improves the algorithm that detects the "#appengine:"
blocks to make the space after colon optional rather than mandatory.

That makes it possible to have an empty line with the "#appengine:"
prefix, without requiring a trailing space after the colon. It's
convenient whenever such a block contains multiple paragraphs, e.g.:

	#appengine: * Go offline
	#appengine:
	#appengine: This tour is also available as a stand-alone program
	#appengine: that you can use without access to the internet.
	#appengine:
	#appengine: The stand-alone tour is faster, as it builds and runs
	#appengine: the code samples on your own machine.

People often have editors set to trim trailing whitespace on save,
so it's helpful to improve the algorithm, instead of having significant
trailing whitespace and relying on people to not accidentally remove it.

Now that the trailing whitespace is no longer signifiant, remove it.

Also fix a typo: s/non-blank like/non-blank line/.

Change-Id: I42d41634dd30e307ac98214cb94b1f97a8032f08
Reviewed-on: https://go-review.googlesource.com/c/tour/+/167837
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
diff --git a/appengine.go b/appengine.go
index 5db885b..9398160 100644
--- a/appengine.go
+++ b/appengine.go
@@ -36,10 +36,10 @@
 }
 
 // gaePrepContent returns a Reader that produces the content from the given
-// Reader, but strips the prefix "#appengine: " from each line. It also drops
-// any non-blank like that follows a series of 1 or more lines with the prefix.
+// Reader, but strips the prefix "#appengine:", optionally followed by a space, from each line.
+// It also drops any non-blank line that follows a series of 1 or more lines with the prefix.
 func gaePrepContent(in io.Reader) io.Reader {
-	var prefix = []byte("#appengine: ")
+	var prefix = []byte("#appengine:")
 	out, w := io.Pipe()
 	go func() {
 		r := bufio.NewReader(in)
@@ -52,6 +52,10 @@
 			}
 			if bytes.HasPrefix(b, prefix) {
 				b = b[len(prefix):]
+				if b[0] == ' ' {
+					// Consume a single space after the prefix.
+					b = b[1:]
+				}
 				drop = true
 			} else if drop {
 				if len(b) > 1 {
diff --git a/content/basics.article b/content/basics.article
index e124e1a..082a6ab 100644
--- a/content/basics.article
+++ b/content/basics.article
@@ -17,7 +17,7 @@
 #appengine: *Note:* The environment in which these programs are executed is
 #appengine: deterministic, so each time you run the example program
 #appengine: `rand.Intn` will return the same number.
-#appengine: 
+#appengine:
 #appengine: (To see a different number, seed the number generator; see [[https://golang.org/pkg/math/rand/#Seed][`rand.Seed`]].
 #appengine: Time is constant in the playground, so you will need to use something else as the seed.)
 
diff --git a/content/welcome.article b/content/welcome.article
index 7b318a7..fe512e7 100644
--- a/content/welcome.article
+++ b/content/welcome.article
@@ -70,41 +70,41 @@
 Click the [[javascript:highlightAndClick(".next-page")]["next"]] button or type `PageDown` to continue.
 
 #appengine: * Go offline
-#appengine: 
+#appengine:
 #appengine: This tour is also available as a stand-alone program that you can use
 #appengine: without access to the internet.
-#appengine: 
+#appengine:
 #appengine: The stand-alone tour is faster, as it builds and runs the code samples
 #appengine: on your own machine.
-#appengine: 
+#appengine:
 #appengine: To run the tour locally install and run the tour binary:
-#appengine: 
+#appengine:
 #appengine:   go get golang.org/x/tour
 #appengine:   tour
-#appengine: 
+#appengine:
 #appengine: The tour program will open a web browser displaying
 #appengine: your local version of the tour.
-#appengine: 
+#appengine:
 #appengine: Or, of course, you can continue to take the tour through this web site.
 
 #appengine: * The Go Playground
-#appengine: 
+#appengine:
 #appengine: This tour is built atop the [[https://play.golang.org/][Go Playground]], a
 #appengine: web service that runs on [[https://golang.org/][golang.org]]'s servers.
-#appengine: 
+#appengine:
 #appengine: The service receives a Go program, compiles, links, and runs the program inside
 #appengine: a sandbox, then returns the output.
-#appengine: 
+#appengine:
 #appengine: There are limitations to the programs that can be run in the playground:
-#appengine: 
+#appengine:
 #appengine: - In the playground the time begins at 2009-11-10 23:00:00 UTC (determining the significance of this date is an exercise for the reader). This makes it easier to cache programs by giving them deterministic output.
-#appengine: 
+#appengine:
 #appengine: - There are also limits on execution time and on CPU and memory usage, and the program cannot access external network hosts.
-#appengine: 
+#appengine:
 #appengine: The playground uses the latest stable release of Go.
-#appengine: 
+#appengine:
 #appengine: Read "[[https://blog.golang.org/playground][Inside the Go Playground]]" to learn more.
-#appengine: 
+#appengine:
 #appengine: .play welcome/sandbox.go
 
 * Congratulations