Skip to content

x/website: syntax rules in spec are not hyperlinked anymore #50915

Closed
@griesemer

Description

@griesemer

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 running Linkify (website/internal/spec/spec.go) which appears to be called from serveHTML (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 in serveHTML checks for this and exits early. Maybe it's just a matter of swapping the order of the if'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 in doc/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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions