1
0
mirror of https://github.com/golang/go synced 2024-10-04 14:21:21 -06:00
Commit Graph

91 Commits

Author SHA1 Message Date
Rob Pike
9e857dbdcc template: rearrange the code into separate files.
The single file was getting unwieldy.
Also remove use of vector; a slice works fine - although
it's an unusual one.

R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/4576042
2011-06-06 21:33:02 +00:00
Rob Pike
9995d216eb template: explain that fields must be exported.
Fixes #1792.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4548083
2011-06-03 00:09:42 +10:00
Gustavo Niemeyer
87dbec54bb template: fix and clean interaction between quotes and formatters
Fixes issue #1897.

R=r, gustavo, r
CC=golang-dev
https://golang.org/cl/4561049
2011-05-30 11:53:09 -03:00
Rob Pike
62943df829 template: cosmetic cleanups.
Remove the idea of space being white.  Sometimes space is green.
Simplify a comment and remove the Latin.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4532096
2011-05-29 16:13:41 +10:00
Gustavo Niemeyer
e11d94fcd7 template: fix quote-handling with formatters
Fixes issue #1896.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4539093
2011-05-29 00:23:32 -03:00
Gustavo Niemeyer
29b246c644 template: support string, int and float literals
This enables customizing the behavior of formatters
with logic such as {"template"|import} or even
{Field1 Field2 "%.2f 0x%X"|printf}

Thanks to Roger Peppe for some debate on this.

R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/4536059
2011-05-19 09:24:27 -03:00
Russ Cox
07abf1c732 fix tree for reflect rename
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4435067
2011-04-25 13:39:36 -04:00
Nigel Tao
6a186d38d1 src/pkg: make package doc comments consistently start with "Package foo".
R=rsc
CC=golang-dev
https://golang.org/cl/4442064
2011-04-20 09:57:05 +10:00
Russ Cox
db5c5d6fa6 update go tree for reflect changes
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4353043
2011-04-08 12:27:58 -04:00
Russ Cox
e72156b316 remove unused labels
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4274052
2011-03-15 14:05:07 -04:00
Russ Cox
3f915f51a8 go code: replace closed(c) with x, ok := <-c
R=golang-dev, rog, bradfitzwork, r
CC=golang-dev
https://golang.org/cl/4243072
2011-03-11 14:47:44 -05:00
Rob Pike
b2efedbf36 template: document the delimiters better
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4248047
2011-02-28 10:27:33 -08:00
Rob Pike
34fc17a820 src/*: fix incorrect prints found by govet
R=gri
CC=golang-dev
https://golang.org/cl/4169044
2011-02-09 17:11:01 -08:00
Rob Pike
fb9e37cd9b template: reverse order of arguments to Execute
In line with other functions such as Fprintf, put the
thing to be written first.

Apologies for the breakages this is sure to cause.

R=rsc, gri, adg, eds, r2, aam
CC=golang-dev
https://golang.org/cl/4169042
2011-02-09 14:23:01 -08:00
Kyle Consalus
42973dddf4 template: Add simple formatter chaining.
Fixes #676.

R=r, rsc, r2
CC=golang-dev
https://golang.org/cl/4127043
2011-02-04 16:37:30 -08:00
Rob Pike
5008c63e6e template: allow a leading '*' to indicate that evaulation should
indirect through a pointer.

Fixes #1478.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/4131045
2011-02-04 15:21:08 -08:00
Roger Peppe
72084068a4 template: treat map keys as zero, not non-existent.
R=adg, r, hoka, rsc
CC=golang-dev
https://golang.org/cl/4036045
2011-01-24 14:12:54 -05:00
Rob Pike
29cbad6c72 template: give "unexported" error when accessing an unexported field.
R=adg, rsc
CC=golang-dev
https://golang.org/cl/3903043
2011-01-12 00:25:17 -08:00
Rob Pike
02e88019f2 template: allow accesses only to exported fields and methods
R=rsc, gri
CC=golang-dev
https://golang.org/cl/3890042
2011-01-11 15:47:45 -08:00
Rob Pike
d3866ddc65 template: fix trivial bug: integers are not "empty"
Fixes #1357.

R=adg, gri
CC=golang-dev
https://golang.org/cl/3809041
2010-12-20 13:36:47 -08:00
Rob Pike
5e4882a325 template: implement multi-word variable instantation for formatters.
Before one could say
	{field}
or
	{field|formatter}
Now one can also say
	{field1 field2 field3}
or
	{field1 field2 field3|formatter}
and the fields are passed as successive arguments to the formatter,
analogous to fmt.Print.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/3385041
2010-12-01 17:10:40 -08:00
Rob Pike
d1524217df template: change the signature of formatters for future development.
Make them more like Printf, with a ... final argument.  This breaks
code with existing formatters but not the templates that use them.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/3378041
2010-12-01 13:33:49 -08:00
Russ Cox
69c4e9380b use append
R=gri, r, r2
CC=golang-dev
https://golang.org/cl/2743042
2010-10-27 19:47:23 -07:00
Russ Cox
d86ab015f7 use copy
R=gri
CC=golang-dev
https://golang.org/cl/2763041
2010-10-26 21:52:54 -07:00
Russ Cox
00ffd59c1a gc: fix reflect table method receiver
Fixes #451.
Fixes #770.

R=ken2
CC=golang-dev
https://golang.org/cl/2207045
2010-09-28 13:43:50 -04:00
Russ Cox
2ee420fa5e ... changes
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/2273042
2010-09-24 11:55:48 -04:00
Scott Lawrence
825e0deece template: fixed documentation formatting
What was meant to be a list appeared as a paragraph with dashes.

R=golang-dev, gri1, gri
CC=golang-dev
https://golang.org/cl/2100041
2010-08-31 19:07:40 -07:00
Rob Pike
b5664ee320 template: finally fix space handling around actions.
Rewrite the code to express the intention more clearly.

Fixes #1042.

R=rsc
CC=golang-dev
https://golang.org/cl/2011046
2010-08-28 07:52:55 +10:00
Russ Cox
da392d9136 build: no required environment variables
R=adg, r, PeterGo
CC=golang-dev
https://golang.org/cl/1942044
2010-08-18 10:08:49 -04:00
Roger Peppe
781c54d06c Fix template package so that data items
preceded by white space parse correctly.

R=r
CC=golang-dev
https://golang.org/cl/2010041
2010-08-17 23:13:07 +10:00
Rob Pike
30ab8cf792 template: retain leading space if the line is not an action.
R=rsc
CC=golang-dev
https://golang.org/cl/1985042
2010-08-17 09:44:16 +10:00
Scott Lawrence
bca3151042 template: added ParseFile method for template.Template
Fixes #971.

Parse/ParseFile methods of Template now match template.Parse and .ParseFile methods.
Also made tests being run on Parse and ParseFile be run on Template.ParseFile as well.

R=r
CC=golang-dev
https://golang.org/cl/1741059
2010-08-11 14:04:03 +10:00
Rob Pike
38f1231f3e strings and bytes.Split: make count of 0 mean 0, not infinite.
Use a count of -1 for infinity.  Ditto for Replace.

R=rsc
CC=golang-dev
https://golang.org/cl/1704044
2010-07-01 14:08:14 -07:00
Daniel Fleischman
040f081842 template: fix typo in doc comment
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/1665047
2010-06-30 19:57:26 -07:00
Rob Pike
b717768b94 template: regularize the handling of interfaces, pointers, and
methods when looking up names.
Fixes #764.

R=rsc
CC=golang-dev
https://golang.org/cl/1170041
2010-05-09 16:40:38 -07:00
Andrew Gerrand
8553b9c68f template: remove reference to json-template
Rather than confuse people by linking to a spec we
don't fully support, let them just use the package docs.

R=r, rsc
CC=golang-dev
https://golang.org/cl/1016041
2010-04-28 10:14:58 +10:00
Russ Cox
13bb28a40a template: fix handling of pointer inside interface
R=r
CC=golang-dev
https://golang.org/cl/982043
2010-04-26 10:01:13 -07:00
Russ Cox
dba9d62bc2 json: Marshal, Unmarshal using new scanner
R=r
CC=golang-dev
https://golang.org/cl/953041
2010-04-21 16:40:53 -07:00
Rob Pike
effddcadc4 template: use panic/recover to simplify internal error handling.
R=rsc
CC=golang-dev
https://golang.org/cl/824049
2010-04-13 13:28:08 -07:00
Russ Cox
00f9f0c056 single argument panic
note that sortmain.go has been run through hg gofmt;
only the formatting of the day initializers changed.
i'm happy to revert that formatting if you'd prefer.

stop on error in doc/progs/run

R=r
CC=golang-dev
https://golang.org/cl/850041
2010-03-30 10:34:57 -07:00
Andrew Gerrand
c10ccd567d template: fixed html formatter bug where it would turn a []byte
into a string of decimal numbers.

R=r, rsc
CC=golang-dev
https://golang.org/cl/624041
2010-03-19 09:46:39 +11:00
Andrew Gerrand
a2772a593b template: add ParseFile, MustParseFile, and associated tests
R=r
CC=golang-dev
https://golang.org/cl/391041
2010-03-10 20:19:20 +11:00
Robert Griesemer
f44fa9b4c7 gofmt: experiment: align values in map composites where possible
- gofmt -w src misc
- looking for feedback

R=rsc, r
CC=golang-dev
https://golang.org/cl/223076
2010-03-02 13:46:51 -08:00
Micah Stetson
8c5404746f Fix a couple of bugs referencing data values in template.
Adds tests and fixes for two cases that fail with the current release.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/217115
2010-02-26 18:39:43 +11:00
Russ Cox
9750adbbad strings: delete Runes, Bytes
gofmt -w -r 'strings.Bytes(a) -> []byte(a)' src/cmd src/pkg test/bench
gofmt -w -r 'strings.Runes(a) -> []int(a)' src/cmd src/pkg test/bench
delete unused imports

R=r
CC=golang-dev
https://golang.org/cl/224062
2010-02-25 16:01:29 -08:00
Robert Griesemer
1be05bbe1e gofmt: don't print ()'s around function-typed results (not needed anymore)
- add extra test cases to go/printer tests
- apply gofmt to src and misc

R=rsc
CC=golang-dev
https://golang.org/cl/223041
2010-02-24 13:24:37 -08:00
Rob Pike
d2fc5d68da Change type of Printf's args to ... interface{}
R=rsc
CC=golang-dev
https://golang.org/cl/197043
2010-02-02 10:53:37 +11:00
Russ Cox
08d3f5e271 template: look inside interface values
R=r
CC=golang-dev
https://golang.org/cl/186169
2010-01-15 13:49:31 -08:00
Rob Pike
f3e7ddc2fb Rewrite tokenizer to clean up and fix a bug with spaces before delimited block.
Fixes #501.

R=rsc
CC=golang-dev
https://golang.org/cl/181183
2010-01-08 17:49:55 +11:00
Rob Pike
96da3e96c3 implement .repeats for maps.
Fixes #309.

R=rsc
CC=golang-dev
https://golang.org/cl/181044
2009-12-24 07:41:56 +11:00