Skip to content
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

Generate table of all elements automatically, using existing element definitions #146

Open
mozfreddyb opened this issue Oct 14, 2021 · 3 comments

Comments

@mozfreddyb
Copy link

Currently, the table that lists all elements of HTML is manually generated. It seems useful to have an auto-generated list that is fed by the <dfn element> blocks and the <dl class="element"> block underneath.

Would anyone else be interested in this change?
I would be willing to take a stab at prototyping this, but am unfamiliar with a couple of points:

  • Would it be acceptable if the existing table became more prosaic (e.g., being fed by the definition list rather than the existing, terse table values)? This could be solved iteratively, over time by improving the individual items to be acceptable for both the element definition and the table.
  • It looks like wattsi is already collecting <dfn>-definitions as DFNElement while parsing for the purpose of cross-referencing. But I wasn't really able to find code that looks at the definition lists. Maybe that doesn't exist yet? I suppose one could pick them up along the way (where?) and maintain a growing datastructure.
  • Where would we emit that data structure? Would that happen explicitly by defining some new macro?

As you can see, I thought about this for a while, but there are many open questions and I'd be curious to hear if this is interesting to anyone else.

@domenic
Copy link
Member

domenic commented Oct 14, 2021

This would be lovely, but we'd need to preserve the existing text; making the content worse to support the tooling would not be a good idea. This might involve, e.g., adding something to the source near the element definition which contains the table description, which is removed from the DOM (and moved into the table).

I'm not sure exactly what you mean by your second point, but maybe XrefsByDFNAnchor or CrossReferences.DFNs are what you're looking for?

A new macro makes sense to me.

@annevk
Copy link
Member

annevk commented Oct 14, 2021

Looking at the table it seems that we could annotate the <dl class="element"> block with additional attributes and that should allow generating most if not all of it, preserving the existing style. The main tricky bit might be the short description. I guess that would be something we'd only show in the index and hide in the <dl> (unless we want to display a brief abstract somewhere).

@domenic
Copy link
Member

domenic commented Oct 14, 2021

I don't think an attribute would work since we need hypertext.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants