reformat-pre.pl - Command line utility to reformat <pre> blocks in HTML files rendered from pods
version 0.20000
reformat-pre.pl [ OPTIONS ] [ FILE(S) ] reformat-pre.pl --man
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).
<pre>...</pre>
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).
backup
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.
-
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.
-i
*
If no extension is supplied, no backup is made and the current file is overwritten.
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).
\s
pre
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.
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).
<li>...</li>
<ol>...</ol>
In this case the original newlines in the pre text are removed, to not add extra empty lines when the HTML document is rendered.
It prints a brief help message and exits.
It shows the full man page.
It prints the program version and exits.
perl -MPod::Simple::HTML -e Pod::Simple::HTML::go MyModule.pm | reformat-pre.pl > MyModule.pm.html
reformat-pre.pl --backup=.orig /path/to/dir/*.html
HTML::PodCodeReformat (perldoc HTML::PodCodeReformat)
perlpodspec
Pod::Simple
Copyright 2011 Emanuele Zeppieri <emazep@cpan.org>.
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
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.
To install HTML::PodCodeReformat, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::PodCodeReformat
CPAN shell
perl -MCPAN -e shell install HTML::PodCodeReformat
For more information on module installation, please visit the detailed CPAN module installation guide.