diff options
| author | Robert Griesemer <gri@golang.org> | 2009-05-14 14:59:51 -0700 |
|---|---|---|
| committer | Robert Griesemer <gri@golang.org> | 2009-05-14 14:59:51 -0700 |
| commit | 033dc3d8c31df556fec6b5936cac7984b0a2c6de (patch) | |
| tree | e9d0ac69e118782a9d11954742436b1fb368cf74 | |
| parent | f721d315a926be68063c2a53b6a6e90798fe8bbb (diff) | |
| download | golang-033dc3d8c31df556fec6b5936cac7984b0a2c6de.tar.gz | |
godoc fix: relative paths were incorrect
R=r
DELTA=13 (1 added, 6 deleted, 6 changed)
OCL=28840
CL=28844
| -rw-r--r-- | usr/gri/pretty/dirlist.html | 4 | ||||
| -rw-r--r-- | usr/gri/pretty/godoc.go | 15 |
2 files changed, 7 insertions, 12 deletions
diff --git a/usr/gri/pretty/dirlist.html b/usr/gri/pretty/dirlist.html index c64f1b4f4..1220adedf 100644 --- a/usr/gri/pretty/dirlist.html +++ b/usr/gri/pretty/dirlist.html @@ -1,3 +1,3 @@ -{.repeated section Dirs} -<a href="{Path|html}/{Name|html}">{Name|html}</a><br /> +{.repeated section @} +<a href="{Name|html}/">{Name|html}</a><br /> {.end} diff --git a/usr/gri/pretty/godoc.go b/usr/gri/pretty/godoc.go index c7bf7cb1d..fab13b61d 100644 --- a/usr/gri/pretty/godoc.go +++ b/usr/gri/pretty/godoc.go @@ -448,12 +448,13 @@ func isPackageFile(dirname, filename, pakname string) bool { } -// Returns the package denoted by importpath and the list of +// Returns the package denoted by path and the list of // sub-directories in the corresponding package directory. // If there is no such package, the first result is nil. If // there are no sub-directories, that list is nil. -func findPackage(importpath string) (*pakDesc, dirList) { +func findPackage(path string) (*pakDesc, dirList) { // get directory contents, if possible + importpath := pathutil.Clean(path); // no trailing '/' dirname := pathutil.Join(*pkgroot, importpath); if !isDir(dirname) { return nil, nil; @@ -472,7 +473,7 @@ func findPackage(importpath string) (*pakDesc, dirList) { } // the package name is is the directory name within its parent - _, pakname := pathutil.Split(importpath); + _, pakname := pathutil.Split(dirname); // collect all files belonging to the package and count the // number of sub-directories @@ -562,15 +563,9 @@ func servePackage(c *http.Conn, desc *pakDesc) { } -type Dirs struct { - Path string; - Dirs dirList; -} - - func serveDirList(c *http.Conn, path string, dirs dirList) { var buf io.ByteBuffer; - err := dirlistHtml.Execute(Dirs{path, dirs}, &buf); + err := dirlistHtml.Execute(dirs, &buf); if err != nil { log.Stderrf("dirlist.Execute: %s", err); } |
