You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Take a look at the HTML source of https://golang.org/pkg/fmt/
There are quite some whitespace and strange indentation there, that probably is quite easy to trim.
The text was updated successfully, but these errors were encountered:
johanfo
changed the title
Plenty of HTML whitepace in godoc
Plenty of HTML whitepace in cmd/godoc
Jan 13, 2016
johanfo
changed the title
Plenty of HTML whitepace in cmd/godoc
cmd/godoc: Strange HTML whitespace and indentations in source generated
Jan 13, 2016
ianlancetaylor
changed the title
cmd/godoc: Strange HTML whitespace and indentations in source generated
cmd/godoc: strange HTML whitespace and indentations in source generated
Jan 13, 2016
minux
changed the title
cmd/godoc: strange HTML whitespace and indentations in source generated
x/tools/cmd/godoc: strange HTML whitespace and indentations in source generated
Jan 14, 2016
I took a look into this. This has to do with the "text/template" package. Whitespaces in the source code translate to actual whitespace in the html file. Even assignment statements like {{$name := printf "%s_%s" $tname .Name}} create a whitespace in the generated html. It can be somewhat mitigated by using "-" as mentioned here https://golang.org/pkg/text/template/#hdr-Text_and_spaces. But it does not go away completely. And moreover, littering the codebase with "-" does not look good.
I am not fully sure, but I think using the "html/template" package should help in mitigating this naturally.
As @agnivade said, the underlying issue here is with the template/* packages, which translates source code whitespace to actual whitespace.
I believe the right path forward would be to propose a change to the template package semantics if you’d like this to change (golang.org/s/proposal) since as of now, this is not a bug, but working as intended.
Take a look at the HTML source of https://golang.org/pkg/fmt/
There are quite some whitespace and strange indentation there, that probably is quite easy to trim.
The text was updated successfully, but these errors were encountered: