Skip to content

Commit

Permalink
CI/verify-titles: verify that page tiles match what SUMMARY says
Browse files Browse the repository at this point in the history
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
bagder committed Dec 14, 2023
1 parent 3bc5c09 commit 76be3e7
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/scripts/verify-titles.pl
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",
$1, $title{$f};
$errors++;
}
last;
}
}
close(F);
};

for my $f (@files) {
check($f);
}

exit $errors;
24 changes: 24 additions & 0 deletions .github/workflows/verify-titles.yml
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

0 comments on commit 76be3e7

Please sign in to comment.