-
Notifications
You must be signed in to change notification settings - Fork 18k
x/website: syntax rules in spec are not hyperlinked anymore #50915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Ping. Can somebody familiar with the current workings of the website server comment on this? It would be a shame to have lost this ability, especially because the code is actually present, just not used. |
I don't have a chance to look into this issue closely myself, but wanted to comment on this part, in case it helps point you in the right direction:
In general, the Go website (primarily https://go.dev, but also other domains such as https://golang.org, https://tour.golang.org, https://golang.google.cn) is all served by the
The served HTML will always have the "<!DOCTYPE" prefix: it might be added automatically by internal/web, or it might coming from a .html content file that explicitly includes that prefix, which effectively disables the template wrapping.
That's the right place to look. Indeed, the go_spec.html content file doesn't have the "<!DOCTYPE" prefix, and so it's probably not relevant in this issue. |
Change https://go.dev/cl/388859 mentions this issue: |
The filepath for the spec document changed and broke the linkify step. Fixes golang/go#50915 Change-Id: Ieafe9c665f4063fb9f9ddf74610925f123e2c249 Reviewed-on: https://go-review.googlesource.com/c/website/+/388859 Run-TryBot: Jamal Carvalho <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Trust: Jamal Carvalho <[email protected]>
In the (distant?) past, the syntax rules (EBNF grammar) were hyperlinked: clicking on the name of a production lead to the corresponding definition. This was very helpful to explore the grammar. The spec also used some of the link targets in the prose, some of which are now stale (such as
MethodName
). The recent CL 381954 tries to fix these by changing the links to section headers, but that is not the intent of those links - they should point to the grammar productions.The spec source text (
doc/go_spec.html
) doesn't contain the link information, it is automatically hyperlinked by runningLinkify
(website/internal/spec/spec.go
) which appears to be called fromserveHTML
(website/internal/web/site.go
). For some reason it is not run, though. As an aside, the hyperlinking also checks that the EBNF is syntactically correct, another benefit.Looking at the source of the served spec I see that it starts with
<!DOCTYPE
. The code inserveHTML
checks for this and exits early. Maybe it's just a matter of swapping the order of theif
's in that code? (That said, I'm not familiar with the details of how the website is created anymore, and where the<!DOCTYPE
is added (it's not indoc/go_spec.html
).I suspect this should be fairly easy to fix if one knows where to look. It would be good to fix this for 1.18 as we have introduced new grammar. Also, having the EBNF syntax check and being able to jump to grammar productions is generally useful.
Not a release blocker because this appears to have been broken for a while.
The text was updated successfully, but these errors were encountered: