-
-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI/verify-titles: verify that page tiles match what SUMMARY says
The web version renders using the SUMMARY title and ignores the file title. The PDF and ePUB versions use the file titles. They ought to be the same.
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/perl | ||
|
||
my $sum = shift @ARGV; | ||
|
||
# Figure out all files in right order | ||
open(F, "<$sum"); | ||
while(<F>) { | ||
if($_ =~ /\[(.*)\]\(([^\)]*)\)/) { | ||
my ($title, $file) = ($1, $2); | ||
push @files, $file; | ||
$title{$file} = $title; | ||
} | ||
} | ||
close(F); | ||
|
||
sub check { | ||
my ($f) = @_; | ||
open(F, "<$f"); | ||
while(<F>) { | ||
if(/^# (.*)/) { | ||
# verify | ||
if($1 ne $title{$f}) { | ||
printf STDERR "$f says '%s', not '%s' like SUMMARY.md\n", | ||
$title{$f}, $1; | ||
$errors++; | ||
} | ||
last; | ||
} | ||
} | ||
close(F); | ||
}; | ||
|
||
for my $f (@files) { | ||
check($f); | ||
} | ||
|
||
exit $errors; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright (C) Daniel Stenberg, <[email protected]>, et al. | ||
|
||
name: verify-titles | ||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- '**.md' | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: build pdf | ||
run: .github/scripts/verify-titles.pl SUMMARY.md | ||
|