From: Andrew Gerrand Date: Mon, 6 Jun 2011 03:33:05 +0000 (+1000) Subject: doc: don't insert paragraphs inside pre blocks X-Git-Tag: weekly.2011-06-09~59 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=79eded509c040d0ee0999352114417062d16934b;p=gostls13.git doc: don't insert paragraphs inside pre blocks doc: update go_tutorial R=golang-dev, r CC=golang-dev https://golang.org/cl/4568056 --- diff --git a/doc/go_tutorial.html b/doc/go_tutorial.html index cfdd0ec6ee..d200036b07 100644 --- a/doc/go_tutorial.html +++ b/doc/go_tutorial.html @@ -29,9 +29,9 @@ Let's start in the usual way:

 
 05    package main
-

+ 07 import fmt "fmt" // Package implementing formatted I/O. -

+ 09 func main() { 10 fmt.Printf("Hello, world; or Καλημέρα κόσμε; or こんにちは 世界\n") 11 } @@ -119,19 +119,19 @@ Next up, here's a version of the Unix utility echo(1):

 
 05    package main
-

+ 07 import ( 08 "os" 09 "flag" // command line option parser 10 ) -

+ 12 var omitNewline = flag.Bool("n", false, "don't print final newline") -

+ 14 const ( 15 Space = " " 16 Newline = "\n" 17 ) -

+ 19 func main() { 20 flag.Parse() // Scans the arg list and sets up flags 21 var s string = "" @@ -479,12 +479,12 @@ open/close/read/write interface. Here's the start of file.go:

 
 05    package file
-

+ 07 import ( 08 "os" 09 "syscall" 10 ) -

+ 12 type File struct { 13 fd int // file descriptor number 14 name string // file name at Open time @@ -601,7 +601,7 @@ the tricky standard arguments to open and, especially, to create a file: 41 O_CREATE = syscall.O_CREAT 42 O_TRUNC = syscall.O_TRUNC 43 ) -

+ 45 func Open(name string) (file *File, err os.Error) { 46 return OpenFile(name, O_RDONLY, 0) 47 } @@ -632,7 +632,7 @@ each of which declares a receiver variable file. 61 } 62 return nil 63 } -

+ 65 func (file *File) Read(b []byte) (ret int, err os.Error) { 66 if file == nil { 67 return -1, os.EINVAL @@ -643,7 +643,7 @@ each of which declares a receiver variable file. 72 } 73 return int(r), err 74 } -

+ 76 func (file *File) Write(b []byte) (ret int, err os.Error) { 77 if file == nil { 78 return -1, os.EINVAL @@ -654,7 +654,7 @@ each of which declares a receiver variable file. 83 } 84 return int(r), err 85 } -

+ 87 func (file *File) String() string { 88 return file.name 89 } @@ -677,13 +677,13 @@ We can now use our new package:

 
 05    package main
-

+ 07 import ( 08 "./file" 09 "fmt" 10 "os" 11 ) -

+ 13 func main() { 14 hello := []byte("hello, world\n") 15 file.Stdout.Write(hello) @@ -720,14 +720,14 @@ Building on the file package, here's a simple version of the Unix u

 
 05    package main
-

+ 07 import ( 08 "./file" 09 "flag" 10 "fmt" 11 "os" 12 ) -

+ 14 func cat(f *file.File) { 15 const NBUF = 512 16 var buf [NBUF]byte @@ -746,7 +746,7 @@ Building on the file package, here's a simple version of the Unix u 29 } 30 } 31 } -

+ 33 func main() { 34 flag.Parse() // Scans the arg list and sets up flags 35 if flag.NArg() == 0 { @@ -811,11 +811,11 @@ we have a second implementation of the reader interface. 31 type rotate13 struct { 32 source reader 33 } -

+ 35 func newRotate13(source reader) *rotate13 { 36 return &rotate13{source} 37 } -

+ 39 func (r13 *rotate13) Read(b []byte) (ret int, err os.Error) { 40 r, e := r13.source.Read(b) 41 for i := 0; i < r; i++ { @@ -823,7 +823,7 @@ we have a second implementation of the reader interface. 43 } 44 return r, e 45 } -

+ 47 func (r13 *rotate13) String() string { 48 return r13.source.String() 49 } @@ -844,7 +844,7 @@ and use it from within a mostly unchanged cat function: 52 func cat(r reader) { 53 const NBUF = 512 54 var buf [NBUF]byte -

+ 56 if *rot13Flag { 57 r = newRotate13(r) 58 } @@ -937,7 +937,7 @@ arrays of integers, strings, etc.; here's the code for arrays of int

 
 33    type IntArray []int
-

+ 35 func (p IntArray) Len() int { return len(p) } 36 func (p IntArray) Less(i, j int) bool { return p[i] < p[j] } 37 func (p IntArray) Swap(i, j int) { p[i], p[j] = p[j], p[i] } @@ -970,11 +970,11 @@ to implement the three methods for that type, like this: 32 shortName string 33 longName string 34 } -

+ 36 type dayArray struct { 37 data []*day 38 } -

+ 40 func (p *dayArray) Len() int { return len(p.data) } 41 func (p *dayArray) Less(i, j int) bool { return p.data[i].num < p.data[j].num } 42 func (p *dayArray) Swap(i, j int) { p.data[i], p.data[j] = p.data[j], p.data[i] } @@ -1065,11 +1065,11 @@ Here's a simple example. 10 a int 11 b string 12 } -

+ 14 func (t *testType) String() string { 15 return fmt.Sprint(t.a) + " " + t.b 16 } -

+ 18 func main() { 19 t := &testType{77, "Sunset Strip"} 20 fmt.Println(t) @@ -1347,7 +1347,7 @@ code that invokes the operation and responds to the request:

 
 14    type binOp func(a, b int) int
-

+ 16 func run(op binOp, req *request) { 17 reply := op(req.a, req.b) 18 req.replyc <- reply diff --git a/doc/htmlgen.go b/doc/htmlgen.go index 4d68767c30..3a8feb8bc2 100644 --- a/doc/htmlgen.go +++ b/doc/htmlgen.go @@ -5,7 +5,7 @@ // Process plain text into HTML. // - h2's are made from lines followed by a line "----\n" // - tab-indented blocks become

 blocks
-//	- blank lines become 

marks +// - blank lines become

marks (except inside

 tags)
 //	- "quoted strings" become quoted strings
 
 package main
@@ -35,9 +35,9 @@ var (
 func main() {
 	read()
 	headings()
-	paragraphs()
 	coalesce(preStart, foldPre)
 	coalesce(tab, foldTabs)
+	paragraphs()
 	quotes()
 	write()
 }