Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1441)

Side by Side Diff: pkg/present/parse.go

Issue 6907059: code review 6907059: present: Fix typo in a comment. (Closed)
Patch Set: diff -r f5665212f5f5 https://code.google.com/p/go.talks Created 11 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 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 package present 5 package present
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "errors" 9 "errors"
10 "fmt" 10 "fmt"
(...skipping 22 matching lines...) Expand all
33 func (d *Doc) Render(w io.Writer, t *template.Template) error { 33 func (d *Doc) Render(w io.Writer, t *template.Template) error {
34 data := struct { 34 data := struct {
35 *Doc 35 *Doc
36 Template *template.Template 36 Template *template.Template
37 }{d, t} 37 }{d, t}
38 return t.ExecuteTemplate(w, "root", data) 38 return t.ExecuteTemplate(w, "root", data)
39 } 39 }
40 40
41 type ParseFunc func(fileName string, lineNumber int, inputLine string) (Elem, er ror) 41 type ParseFunc func(fileName string, lineNumber int, inputLine string) (Elem, er ror)
42 42
43 // Register binds the named action, which does not being with a period, to the 43 // Register binds the named action, which does not begin with a period, to the
44 // specified parser to be invoked when the name, with a period, appears in the 44 // specified parser to be invoked when the name, with a period, appears in the
45 // present input text. 45 // present input text.
46 func Register(name string, parser ParseFunc) { 46 func Register(name string, parser ParseFunc) {
47 if len(name) == 0 || name[0] == ';' { 47 if len(name) == 0 || name[0] == ';' {
48 panic("bad name in Register: " + name) 48 panic("bad name in Register: " + name)
49 } 49 }
50 parsers["."+name] = parser 50 parsers["."+name] = parser
51 } 51 }
52 52
53 // Doc represents an entire document. 53 // Doc represents an entire document.
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 return t, true 455 return t, true
456 } 456 }
457 t, err = time.Parse("2 Jan 2006", text) 457 t, err = time.Parse("2 Jan 2006", text)
458 if err == nil { 458 if err == nil {
459 // at 11am UTC it is the same date everywhere 459 // at 11am UTC it is the same date everywhere
460 t = t.Add(time.Hour * 11) 460 t = t.Add(time.Hour * 11)
461 return t, true 461 return t, true
462 } 462 }
463 return time.Time{}, false 463 return time.Time{}, false
464 } 464 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b