-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
In the AMP WordPress plugin we want to add more linkages between the internal validation tool and amp.dev. If someone is using a component in a way that violates its validator spec, then we'd want to link the user to the docs page for that component. However, the required spec_url is not supplied for all tag specs.
For example, let's say I put an <amp-accordion> on my page and inside of it I put a <section> which contains one single <h2>. This would violate the spec. But which spec? Specifically it would be the spec with the name amp-accordion > section, and and we'd want to link the user to https://amp.dev/documentation/components/amp-accordion/
However, there is no spec_url defined for this tag spec:
amphtml/extensions/amp-accordion/validator-amp-accordion.protoascii
Lines 67 to 74 in 2dd8c32
| tags: { # <amp-accordion> > <section> | |
| html_format: AMP | |
| html_format: AMP4ADS | |
| html_format: AMP4EMAIL | |
| html_format: ACTIONS | |
| tag_name: "SECTION" | |
| spec_name: "amp-accordion > section" | |
| mandatory_parent: "AMP-ACCORDION" |
And so the Validator is not able to provide a “Learn More” link:
The spec name for amp-accordion does have a spec_url defined, however:
amphtml/extensions/amp-accordion/validator-amp-accordion.protoascii
Lines 43 to 62 in 2dd8c32
| tags: { # <amp-accordion> | |
| html_format: AMP | |
| html_format: AMP4ADS | |
| html_format: AMP4EMAIL | |
| html_format: ACTIONS | |
| tag_name: "AMP-ACCORDION" | |
| requires_extension: "amp-accordion" | |
| attrs: { name: "animate" value: "" } | |
| attrs: { | |
| # session-states are always disabled in AMP4EMAIL | |
| disabled_by: "amp4email" | |
| name: "disable-session-states" | |
| value: "" | |
| } | |
| attrs: { name: "expand-single-section" value: "" } | |
| attr_lists: "extended-amp-global" | |
| child_tags: { | |
| child_tag_name_oneof: "SECTION" | |
| } | |
| spec_url: "https://amp.dev/documentation/components/amp-accordion" |
When that tag spec is violated, a “Learn More” link is provided:
So why is https://amp.dev/documentation/components/amp-accordion not supplied as the spec_url for the amp-accordion > section tag spec as it is done for the amp-accordion tag spec? If the spec_url were supplied for every tag spec this would facilitate providing developers with important context for why it is invalid and where they can find proper usage information.
Can all of the tag specs be updated to supply the relevant spec_url for each?

