Skip to content

Commit d77bb0d

Browse files
committed
Fix attribute annotation code for FACEs
This fixes several related issues: * `<span>form-associated custom elements</span>` was not matching the regex that was looking for `<code>` in the attribute index. * Changing the regex to look for span or code causes many other lines to be picked up. Thus, we introduce the new 'tr' state into the state machine to better detect the first line of a <tr>. * Even with that, we were now dying on global attributes, since they don't have a domintro to get substituted in to. So we remove that error state. * Finally, we were now substituting in even in cases that just mention the attribute, like "Global attributes, except the is attribute". So, we need to add an escape hatch for that.
1 parent bb38bce commit d77bb0d

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

.pre-process-annotate-attributes.pl

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,28 @@
3030
if (not exists $instances{$key}) {
3131
$instances{$key} = [];
3232
}
33-
push(@{$instances{$key}}, { line => $line, special => $special });
33+
if ($notes !~ m@<!-- no-annotate -->@os) {
34+
push(@{$instances{$key}}, { line => $line, special => $special });
35+
}
3436
} elsif ($_ =~ m/^ <!--.*-->\n$/os) {
3537
# ignore
3638
} elsif ($_ eq " <dd>Any other attribute that has no namespace (see prose).</dd>\n") {
3739
# ignore
3840
} elsif ($_ =~ m!^ <dt>!o) {
3941
$mode = 'bored';
4042
} else {
41-
die "mode=$mode saw: $_";
43+
# ignore
4244
}
4345
} elsif ($mode eq 'index') {
4446
if ($_ eq " </table>\n") {
45-
$mode = 'end';
46-
} elsif ($_ =~ m!^ <td> <code data-x="([^"]+)">[^<]*</code>;?\n$!os) {
47+
$mode = 'end';
48+
} elsif ($_ eq " <tr>\n") {
49+
$mode = 'tr';
50+
} else {
51+
# ignore...
52+
}
53+
} elsif ($mode eq 'tr') {
54+
if ($_ =~ m!^ <td> <(?:code|span) data-x="([^"]+)">[^<]*</(?:code|span)>;?\n$!os) {
4755
$attributes{$1} = 1;
4856
$mode = 'index-in';
4957
} else {
@@ -57,7 +65,6 @@
5765
my $description = $1;
5866
my $altdescription = $2;
5967
foreach my $key (keys %attributes) {
60-
die "can't find instance of $key\n" unless exists $instances{$key} and scalar @{$instances{$key}};
6168
foreach my $entry (@{$instances{$key}}) {
6269
my $line = $entry->{line};
6370
if ($entry->{special} eq 'global') {

0 commit comments

Comments
 (0)