1
0
mirror of https://github.com/golang/go synced 2024-11-05 16:56:16 -07:00

go.tools: Expose filename rather than extension only, needed for new tour.

R=adg, r
CC=golang-codereviews
https://golang.org/cl/43470050
This commit is contained in:
Francesc Campoy 2014-01-02 16:03:56 -08:00
parent 8c66e887f7
commit 53273c1d55

View File

@ -31,6 +31,7 @@ func init() {
type Code struct { type Code struct {
Text template.HTML Text template.HTML
Play bool // runnable code Play bool // runnable code
FileName string // file name
Ext string // file extension Ext string // file extension
Raw []byte // content of the file Raw []byte // content of the file
} }
@ -130,6 +131,7 @@ func parseCode(ctx *Context, sourceFile string, sourceLine int, cmd string) (Ele
return Code{ return Code{
Text: template.HTML(buf.String()), Text: template.HTML(buf.String()),
Play: play, Play: play,
FileName: filepath.Base(filename),
Ext: filepath.Ext(filename), Ext: filepath.Ext(filename),
Raw: textBytes, Raw: textBytes,
}, nil }, nil