diff --git a/lib/godoc/dirlist.html b/lib/godoc/dirlist.html index a94f249d91f..3c1e3aae01b 100644 --- a/lib/godoc/dirlist.html +++ b/lib/godoc/dirlist.html @@ -18,9 +18,9 @@ {.repeated section @} - {Name|html}{@|dir/} + {Name|html-esc}{@|dir/} - {Size|html} + {Size|html-esc} {Mtime_ns|time} diff --git a/lib/godoc/godoc.html b/lib/godoc/godoc.html index f41b46a2737..99cd55eae68 100644 --- a/lib/godoc/godoc.html +++ b/lib/godoc/godoc.html @@ -4,7 +4,7 @@ - {Title|html} + {Title|html-esc} @@ -121,7 +121,7 @@
  •  
  • {Timestamp|time}
  • -
  • Build version {Version|html}
  • +
  • Build version {Version|html-esc}
  • @@ -133,7 +133,7 @@ {.end} -

    {Title|html}

    +

    {Title|html-esc}

    diff --git a/lib/godoc/package.html b/lib/godoc/package.html index d0a5970b38d..0eff78e45ce 100644 --- a/lib/godoc/package.html +++ b/lib/godoc/package.html @@ -12,7 +12,7 @@ {.section PDoc} {.section IsPkg} -

    import "{ImportPath|html}"

    +

    import "{ImportPath|html-esc}"

    {.end} {Doc|html-comment} {.section IsPkg} @@ -21,7 +21,7 @@

    Package files

    {.repeated section @} - {@|localname} + {@|localname} {.end}

    @@ -43,14 +43,14 @@ {.end} {.section Funcs} {.repeated section @} -

    func {Name|html}

    +

    func {Name|html-esc}

    {Decl|html}

    {Doc|html-comment} {.end} {.end} {.section Types} {.repeated section @} -

    type {Type.Name|html}

    +

    type {Type.Name|html-esc}

    {Doc|html-comment}

    {Decl|html}

    {.repeated section Consts} @@ -62,12 +62,12 @@
    {Decl|html}
    {.end} {.repeated section Factories} -

    func {Name|html}

    +

    func {Name|html-esc}

    {Decl|html}

    {Doc|html-comment} {.end} {.repeated section Methods} -

    func ({Recv|html}) {Name|html}

    +

    func ({Recv|html}) {Name|html-esc}

    {Decl|html}

    {Doc|html-comment} {.end} @@ -103,9 +103,9 @@ {.repeated section List} {Depth|padding} - {Name|html} + {Name|html-esc} - {Synopsis|html} + {Synopsis|html-esc} {.end} diff --git a/lib/godoc/search.html b/lib/godoc/search.html index 3d417aa2715..febd7e5693d 100644 --- a/lib/godoc/search.html +++ b/lib/godoc/search.html @@ -14,7 +14,7 @@

    Did you mean: {.repeated section Alts} - {@|html} + {@|html-esc} {.end}

    {.end} @@ -22,11 +22,11 @@ {.section Decls}

    Package-level declarations

    {.repeated section @} -

    package {Pak.Name|html}

    +

    package {Pak.Name|html-esc}

    {.repeated section Files} {.repeated section Groups} {.repeated section Infos} - {File.Path|url-src}:{@|infoLine} + {File.Path|url-src}:{@|infoLine}
    {@|infoSnippet}
    {.end} {.end} @@ -36,9 +36,9 @@ {.section Others}

    Local declarations and uses

    {.repeated section @} -

    package {Pak.Name|html}

    +

    package {Pak.Name|html-esc}

    {.repeated section Files} - {File.Path|url-src} + {File.Path|url-src} {.repeated section Groups} @@ -47,7 +47,7 @@ diff --git a/src/cmd/godoc/godoc.go b/src/cmd/godoc/godoc.go index 60a5c386410..bde1b4868b4 100644 --- a/src/cmd/godoc/godoc.go +++ b/src/cmd/godoc/godoc.go @@ -692,7 +692,8 @@ func urlFmt(w io.Writer, x interface{}, format string) { // map path relpath := relativePath(path) - // convert to URL + // convert to relative URLs so that they can also + // be used as relative file names in .txt templates switch format { default: // we should never reach here, but be resilient @@ -705,13 +706,13 @@ func urlFmt(w io.Writer, x interface{}, format string) { if strings.HasPrefix(relpath, "src/pkg/") { relpath = relpath[len("src/pkg/"):] } - template.HTMLEscape(w, []byte(pkgHandler.pattern+relpath)) + template.HTMLEscape(w, []byte(pkgHandler.pattern[1:]+relpath)) // remove trailing '/' for relative URL case "url-src": - template.HTMLEscape(w, []byte("/"+relpath)) + template.HTMLEscape(w, []byte(relpath)) case "url-pos": // line id's in html-printed source are of the // form "L%d" where %d stands for the line number - template.HTMLEscape(w, []byte("/"+relpath)) + template.HTMLEscape(w, []byte(relpath)) fmt.Fprintf(w, "#L%d", line) } }
    {.repeated section Infos} - {@|infoLine} + {@|infoLine} {.end}