Some of our manpages have the construct "[something](somethingelse)".
From a POD and HTML perspective, there's nothing special with that.
However, since we wrap the HTML with markdown (perfectly legitimate), we
need to pay attention that nothing in the HTML can reasonably be
reinterpreted as markdown.
Unfortunately, the construct mentioned about has that issue.
This is easily fixed by replacing '](' with '](', which is valid
HTML5.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/web/pull/443)
--- /dev/null
+#! /usr/bin/env perl
+
+# The pod source may contain things that can be reinterpreted as markdown,
+# and thereby rendered incorrectly. This script fixes that, usually by
+# replacing some character with the corresponding HTML character entity.
+
+local $/; # Slurp the whole file
+my $contents = <STDIN>;
+
+$contents =~ s|\]\(|\](|g; # ]( suggests a markdown link
+
+print $contents;
# Get main HTML output
my $out = $class->geninc( $release, $inpod, %data );
+
+ # Fix HTML output where it could be reinterpretted as markdown
+ $out =~ s|\]\(|\](|g; # ]( suggests a markdown link
+
open( my $fh, ">", $outinc )
or $class->die("Can't open $outinc: $!");
print $fh $out or $class->die("Can't print $outinc: $!");
if [ "$F" != "$Dn/$Fn" ]; then
# HTML file, which we treat specially
G=$Dn/$Fn.inc
- $HERE/strip-man-html < $srcdir/$F > $destdir/$G
+ cat $srcdir/$F \
+ | $HERE/strip-man-html \
+ | $HERE/fix-man-html \
+ > $destdir/$G
section=$(basename $Dn | sed -e 's|^man||')
description="$($HERE/all-html-man-names < $destdir/$G | sed -e 's|^.* - ||' -e 's|\&|\\\&|g')"