From 6ec1360fe37d9ed75779aee2bf7cfe0f6a44f96f Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Tue, 21 Jun 2022 09:16:56 -0400 Subject: [PATCH] Get spec page redirects from spec pages --- layouts/index.redirects | 3 --- scripts/adjust-spec-pages.pl | 16 +++++++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/layouts/index.redirects b/layouts/index.redirects index 6e4c6cf321fb..a0c9ca3c4742 100644 --- a/layouts/index.redirects +++ b/layouts/index.redirects @@ -11,6 +11,3 @@ /docs/{{ $lang }} /docs/instrumentation/{{ $lang }} /docs/{{ $lang }}/* /docs/instrumentation/{{ $lang }}/:splat {{ end -}} - -/docs/reference/specification/common/common /docs/reference/specification/common -/docs/reference/specification/context/context /docs/reference/specification/context diff --git a/scripts/adjust-spec-pages.pl b/scripts/adjust-spec-pages.pl index 47b5c7623656..d099b7dee040 100755 --- a/scripts/adjust-spec-pages.pl +++ b/scripts/adjust-spec-pages.pl @@ -7,6 +7,7 @@ use diagnostics; my $file = ''; +my $frontMatterFromFile = ''; my $title = ''; my $linkTitle = ''; my $gD = 0; @@ -24,7 +25,7 @@ github_project_repo: *repo EOS -sub printTitle() { +sub printTitleAndFrontMatter() { print "---\n"; my $titleMaybeQuoted = ($title =~ ':') ? "\"$title\"" : $title; print "title: $titleMaybeQuoted\n"; @@ -39,6 +40,7 @@ () print " from: $path_base_for_github_subdir/$1_index.md\n"; print " to: $1README.md\n"; } + print "$frontMatterFromFile" if $frontMatterFromFile; print "---\n"; } @@ -48,12 +50,20 @@ () # printf STDOUT "$ARGV Got: $_" if $gD; if ($file ne $ARGV) { - $title = ''; $file = $ARGV; + $frontMatterFromFile = ''; + $title = ''; + if (/^/; + $frontMatterFromFile .= $_; + } + next; + } } if(! $title) { ($title) = /^#\s+(.*)/; - printTitle() if $title; + printTitleAndFrontMatter() if $title; next; }