LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2010 The Go Authors. All rights reserved. | 1 // Copyright 2010 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // The /doc/codewalk/ tree is synthesized from codewalk descriptions, | 5 // The /doc/codewalk/ tree is synthesized from codewalk descriptions, |
6 // files named $GOROOT/doc/codewalk/*.xml. | 6 // files named $GOROOT/doc/codewalk/*.xml. |
7 // For an example and a description of the format, see | 7 // For an example and a description of the format, see |
8 // http://golang.org/doc/codewalk/codewalk or run godoc -http=:6060 | 8 // http://golang.org/doc/codewalk/codewalk or run godoc -http=:6060 |
9 // and see http://localhost:6060/doc/codewalk/codewalk . | 9 // and see http://localhost:6060/doc/codewalk/codewalk . |
10 // That page is itself a codewalk; the source code for it is | 10 // That page is itself a codewalk; the source code for it is |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 return | 67 return |
68 } | 68 } |
69 | 69 |
70 b := applyTemplate(codewalkHTML, "codewalk", cw) | 70 b := applyTemplate(codewalkHTML, "codewalk", cw) |
71 servePage(w, "Codewalk: "+cw.Title, "", "", b) | 71 servePage(w, "Codewalk: "+cw.Title, "", "", b) |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 // A Codewalk represents a single codewalk read from an XML file. | 75 // A Codewalk represents a single codewalk read from an XML file. |
76 type Codewalk struct { | 76 type Codewalk struct { |
77 » Title string "attr" | 77 » Title string `xml:"attr"` |
78 File []string | 78 File []string |
79 Step []*Codestep | 79 Step []*Codestep |
80 } | 80 } |
81 | 81 |
82 | 82 |
83 // A Codestep is a single step in a codewalk. | 83 // A Codestep is a single step in a codewalk. |
84 type Codestep struct { | 84 type Codestep struct { |
85 // Filled in from XML | 85 // Filled in from XML |
86 » Src string "attr" | 86 » Src string `xml:"attr"` |
87 » Title string "attr" | 87 » Title string `xml:"attr"` |
88 » XML string "innerxml" | 88 » XML string `xml:"innerxml"` |
89 | 89 |
90 // Derived from Src; not in XML. | 90 // Derived from Src; not in XML. |
91 Err os.Error | 91 Err os.Error |
92 File string | 92 File string |
93 Lo int | 93 Lo int |
94 LoByte int | 94 LoByte int |
95 Hi int | 95 Hi int |
96 HiByte int | 96 HiByte int |
97 Data []byte | 97 Data []byte |
98 } | 98 } |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 for j, c := range data { | 490 for j, c := range data { |
491 if j == i { | 491 if j == i { |
492 return l | 492 return l |
493 } | 493 } |
494 if c == '\n' { | 494 if c == '\n' { |
495 l++ | 495 l++ |
496 } | 496 } |
497 } | 497 } |
498 return l | 498 return l |
499 } | 499 } |
LEFT | RIGHT |