The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

reformat-pre.pl - Command line utility to reformat <pre> blocks in HTML files rendered from pods

VERSION

version 0.20000

SYNOPSIS

    reformat-pre.pl [ OPTIONS ] [ FILE(S) ]
    reformat-pre.pl --man

DESCRIPTION

This program reformats the html file(s) rendered from pods, by removing the extra leading spaces in the lines inside <pre>...</pre> blocks (corresponding to Pod verbatim paragraphs). Other transformations can be applied as well (see below).

The given files are read and modified one by one, and the resulting content is printed to the standard output, unless the backup option is used (see below).

If no file is given, or if one of the file names is a - (dash), the HTML code is read from STDIN, so that this program can be used as a filter or even interactively.

OPTIONS

-b [ extension ] | --backup [ [=] extension ]

If given, the files are modified in-place (and no output is sent to the standard output).

An extension can optionally be provided, which will cause a backup copy of every input file to be created.

The extension works exactly as with the perl -i switch, that is: if the extension does not contain a *, then it is appended to the end of the current filename as a suffix; if the extension does contain one or more * characters, then each * is replaced with the current filename.

If no extension is supplied, no backup is made and the current file is overwritten.

-s | --squash-blank-lines

It causes every line composed solely of spaces (\s) in a pre block, to be squashed to an empty string (the newline is left untouched).

Otherwise by default the blank lines in a pre block will be treated as normal lines, that is, they will be stripped only of the extra leading whitespaces, as any other line.

-l | --line-numbers

It causes every line in a pre text to be wrapped in <li>...</li> tags, and the whole text to be wrapped in <ol>...</ol> tags (so that a line number is prepended to every line in the pre text, when the HTML document is viewed in a browser).

In this case the original newlines in the pre text are removed, to not add extra empty lines when the HTML document is rendered.

-h | -? | --help

It prints a brief help message and exits.

--man

It shows the full man page.

--version

It prints the program version and exits.

COOKBOOK

Convert a pod through Pod::Simple and reformat it in one fell swoop

    perl -MPod::Simple::HTML -e Pod::Simple::HTML::go MyModule.pm | reformat-pre.pl > MyModule.pm.html

Reformat all the HTML files in a directory and make a backup of each of them

    reformat-pre.pl --backup=.orig /path/to/dir/*.html

SEE ALSO

COPYRIGHT

Copyright 2011 Emanuele Zeppieri <emazep@cpan.org>.

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html

NO WARRANTY

This program comes with NO WARRANTIES of any kind. It not only may cause loss of data and hardware damaging, but it may also cause several bad diseases to nearby people, including, but not limited to, diarrhoea, gonorrhoea and dysmenorrhoea (and anything else ending in rhoea). Don't say you haven't been warned.