From 0795ca007276630096465909f88fe019d986c249 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Thu, 23 Jan 2025 11:44:43 -0500 Subject: [PATCH] [CI] Handle missing tocstop tag in spec pages --- scripts/content-modules/adjust-pages.pl | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/content-modules/adjust-pages.pl b/scripts/content-modules/adjust-pages.pl index ddf5ae687ad2..ee5a1ddde06f 100755 --- a/scripts/content-modules/adjust-pages.pl +++ b/scripts/content-modules/adjust-pages.pl @@ -27,6 +27,7 @@ my $otlpSpecVers = $versions{'otlp:'}; my $semconvVers = $versions{'semconv:'}; my %patchMsgCount; +my $lineNum; sub printTitleAndFrontMatter() { print "---\n"; @@ -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 (/^/; patchAttrNaming(); # TEMPORARY patch $frontMatterFromFile .= $_; @@ -137,11 +141,19 @@ () } if (/
/) { - while(<>) { last if /<\/details>/; } + while(<>) { $lineNum++; last if /<\/details>/; } next; } if(//) { - while(<>) { last if//; } + my $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; }