yhdev/mdocproc.pl

17 lines
390 B
Perl
Executable file

#!/usr/bin/perl
use v5.36;
my $insyn = 0;
while (<>) {
$insyn = /^# SYNOPSIS$/ if /^#/;
if ($insyn) {
# Improve styling of synopsis
s/\\\[`/<span class="synopt">[`/g;
s/\\]/]<\/span>/g;
} else {
# Turn man page references into links
s{\[([a-zA-Z0-9-]+)\(([1-8])\)\]\{\.Xr\}}{[$1($2)](https://manned.org/man/$1.$2)}g;
}
print;
}