mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-02-28 02:07:54 +08:00
Merged lp:~percona-toolkit-dev/percona-toolkit/fatpack-pod2rst
This commit is contained in:
@@ -6,8 +6,6 @@ use English qw(-no_match_vars);
|
||||
|
||||
use IO::File;
|
||||
|
||||
use HTML::Entities;
|
||||
|
||||
use File::Basename qw(basename);
|
||||
use Pod::POM::View::Restructured;
|
||||
|
||||
|
||||
5771
util/pod2rst-fixed.packed
Executable file
5771
util/pod2rst-fixed.packed
Executable file
File diff suppressed because it is too large
Load Diff
@@ -68,18 +68,20 @@ RST_DIR=$DOCS_DIR/user
|
||||
|
||||
fix_html () {
|
||||
local name="$1"
|
||||
perl -MFile::Basename=basename -MFile::Slurp=read_file,write_file -le '
|
||||
perl -MFile::Basename=basename -le '
|
||||
my $f = shift;
|
||||
my $tool = basename($f);
|
||||
$tool =~ s/\.html//;
|
||||
my $out = read_file($f);
|
||||
my $out = do { open my $fh, '<', $f or die $!; local $/; <$fh> };
|
||||
$out =~ s{
|
||||
\Q<dt id="\E(cmdoption-$tool--)\Q">\E\s*
|
||||
\Q<tt class="descname">--</tt><tt class="descclassname">\E([^<]+)
|
||||
\Q</tt><a class="headerlink" href="\E[^"]+"
|
||||
}{<dt id="$1$2">
|
||||
<tt class="descname">--$2</tt><tt class="descclassname"></tt><a class="headerlink" href="#$1$2"}xg;
|
||||
write_file($f, $out);
|
||||
open my $fh, '>', $f or die "Cannot open $f for writing: $!";
|
||||
print { $f } $out;
|
||||
close $fh or die "Cannot close $f: $!";
|
||||
' $RST_DIR/html/$name.html
|
||||
}
|
||||
|
||||
@@ -91,7 +93,7 @@ write_rst() {
|
||||
return
|
||||
fi
|
||||
|
||||
$BRANCH/util/pod2rst-fixed $file > $RST_DIR/$tool.rst
|
||||
$BRANCH/util/pod2rst-fixed.packed $file > $RST_DIR/$tool.rst
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Wrote $RST_DIR/$tool.rst"
|
||||
else
|
||||
@@ -121,7 +123,7 @@ write_sections() {
|
||||
$BRANCH/util/extract-text $DOCS_DIR/percona-toolkit.pod "^=head1 $header" "^=head1|=cut" > /tmp/$filename.pod
|
||||
|
||||
# Convert POD to RST and remove all the Perl highlight blocks.
|
||||
cat /tmp/$filename.pod | pod2rst | sed -e 's/.. highlight:: perl//g' > /tmp/$filename.tmp
|
||||
$BRANCH/util/pod2rst-fixed.packed /tmp/$filename.pod | sed -e 's/.. highlight:: perl//g' > /tmp/$filename.tmp
|
||||
|
||||
# Remove extra blank lines.
|
||||
cat -s /tmp/$filename.tmp > $RST_DIR/$filename.rst
|
||||
|
||||
Reference in New Issue
Block a user