Skip to content

Commit ffb15e0

Browse files
authored
[CI] Handle missing tocstop tag in spec pages (open-telemetry#6056)
1 parent b98d458 commit ffb15e0

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

scripts/content-modules/adjust-pages.pl

+15-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
my $otlpSpecVers = $versions{'otlp:'};
2828
my $semconvVers = $versions{'semconv:'};
2929
my %patchMsgCount;
30+
my $lineNum;
3031

3132
sub printTitleAndFrontMatter() {
3233
print "---\n";
@@ -114,14 +115,17 @@ ()
114115
getVersFromRepo();
115116

116117
while(<>) {
117-
# printf STDOUT "$ARGV Got: $_" if $gD;
118+
$lineNum++;
119+
# printf STDOUT "$ARGV Got:$lineNum: $_" if $gD;
118120

119121
if ($file ne $ARGV) {
120122
$file = $ARGV;
121123
$frontMatterFromFile = '';
122124
$title = '';
125+
$lineNum = 1;
123126
if (/^<!---? Hugo/) {
124127
while(<>) {
128+
$lineNum++;
125129
last if /^-?-->/;
126130
patchAttrNaming(); # TEMPORARY patch
127131
$frontMatterFromFile .= $_;
@@ -137,11 +141,19 @@ ()
137141
}
138142

139143
if (/<details>/) {
140-
while(<>) { last if /<\/details>/; }
144+
while(<>) { $lineNum++; last if /<\/details>/; }
141145
next;
142146
}
143147
if(/<!-- toc -->/) {
144-
while(<>) { last if/<!-- tocstop -->/; }
148+
my $tocstop = '<!-- tocstop -->';
149+
while(<>) {
150+
$lineNum++;
151+
last if/$tocstop/;
152+
next if /^\s*([-\+\*]\s|$)/;
153+
warn "WARN $ARGV:$lineNum: missing '$tocstop' directive? Aborting toc scan at line:\n $lineNum: $_";
154+
print;
155+
last;
156+
}
145157
next;
146158
}
147159

0 commit comments

Comments
 (0)