Refactor generated spec data to facilitate looking up by spec name#3817
Closed
westonruter wants to merge 5 commits intodevelopfrom
Closed
Refactor generated spec data to facilitate looking up by spec name#3817westonruter wants to merge 5 commits intodevelopfrom
westonruter wants to merge 5 commits intodevelopfrom
Conversation
3 tasks
Member
Author
This is the best possible right now: /**
* Get tag by spec name.
*
* @since 1.5
*
* @param string $spec_name Spec name.
* @return array|null Allowed tag spec, or null if the tag does not exist.
*/
public static function find_tag_spec( $spec_name ) {
foreach ( self::$allowed_tags as $tag_name => $allowed_tag ) {
foreach ( $allowed_tag as $rule_spec ) {
if (
( ! isset( $rule_spec['tag_spec']['spec_name'] ) && $tag_name === $spec_name )
||
( isset( $rule_spec['tag_spec']['spec_name'] ) && $rule_spec['tag_spec']['spec_name'] === $spec_name )
) {
return array_merge( compact( 'tag_name' ), $rule_spec );
}
}
}
return null;
}We can eliminate looping over Only way I can think of to prevent this is having a separate index of |
d03b803 to
5e56cce
Compare
2ac3dd4 to
df10dfe
Compare
Member
Author
|
Linking to the relevant docs page on amp.dev for each violated tag spec depends on each tag spec having a |
df10dfe to
e56b2c3
Compare
e56b2c3 to
5933df3
Compare
5 tasks
4 tasks
3 tasks
Member
Author
|
Closing in favor of the work that @schlessera is doing in #4566. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4597.
Todo
Checklist