diff --git a/appengine.go b/appengine.go index 5db885b..9398160 100644 --- a/appengine.go +++ b/appengine.go @@ -36,10 +36,10 @@ func gaeMain() { } // 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 @@ func gaePrepContent(in io.Reader) io.Reader { } 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 @@ By convention, the package name is the same as the last element of the import pa #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 @@ The tour is available in other languages: 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