Skip to content

Commit

Permalink
[CI] Handle missing tocstop tag in spec pages (#6056)
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin authored Jan 23, 2025
1 parent b98d458 commit ffb15e0
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions scripts/content-modules/adjust-pages.pl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
my $otlpSpecVers = $versions{'otlp:'};
my $semconvVers = $versions{'semconv:'};
my %patchMsgCount;
my $lineNum;

sub printTitleAndFrontMatter() {
print "---\n";
Expand Down Expand Up @@ -114,14 +115,17 @@ ()
getVersFromRepo();

while(<>) {
# printf STDOUT "$ARGV Got: $_" if $gD;
$lineNum++;
# printf STDOUT "$ARGV Got:$lineNum: $_" if $gD;

if ($file ne $ARGV) {
$file = $ARGV;
$frontMatterFromFile = '';
$title = '';
$lineNum = 1;
if (/^<!---? Hugo/) {
while(<>) {
$lineNum++;
last if /^-?-->/;
patchAttrNaming(); # TEMPORARY patch
$frontMatterFromFile .= $_;
Expand All @@ -137,11 +141,19 @@ ()
}

if (/<details>/) {
while(<>) { last if /<\/details>/; }
while(<>) { $lineNum++; last if /<\/details>/; }
next;
}
if(/<!-- toc -->/) {
while(<>) { last if/<!-- tocstop -->/; }
my $tocstop = '<!-- tocstop -->';
while(<>) {
$lineNum++;
last if/$tocstop/;
next if /^\s*([-\+\*]\s|$)/;
warn "WARN $ARGV:$lineNum: missing '$tocstop' directive? Aborting toc scan at line:\n $lineNum: $_";
print;
last;
}
next;
}

Expand Down

0 comments on commit ffb15e0

Please sign in to comment.