Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
$spec_names = [];
foreach ( AMP_Allowed_Tags_Generated::get_allowed_tags() as $tag => $tag_rules ) {
foreach ( $tag_rules as $tag_rule ) {
if ( isset( $tag_rule['tag_spec']['spec_name'] ) ) {
$spec_name = strtolower( $tag_rule['tag_spec']['spec_name'] );
} elseif ( isset( $tag_rule['tag_spec']['extension_spec']['name'] ) ) {
$spec_name = sprintf(
'script[%s=%s]',
'amp-mustache' === $tag_rule['tag_spec']['extension_spec']['name'] ? 'custom-template' : 'custom-element',
strtolower( $tag_rule['tag_spec']['extension_spec']['name'] )
);
} else {
$spec_name = $tag;
}
if ( isset( $spec_names[ $spec_name ] ) ) {
echo "Duplicate found: $spec_name";
exit( 1 );
}
$spec_names[ $spec_name ] = true;
}
}
$spec_names = array_keys( $spec_names );
sort( $spec_names );
echo implode( "\n", $spec_names );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment