Mike Schilli's Friendly Neighborhood Perl Shop

CPAN Modules
Articles in English
Articles in German
Mike's Script Archive
English-Japanese Translation Trainer
Adventures with O'Reilly's Safari
10 Easy Steps to Become a California Driver
Unofficial perlmonks.com IRC Channel
My Collection of Outage Pages
Prisma (Computer Club Deutschland)
Mike's Monologues
Mike's Script Archive: af

af - Autoformat ascii text for POD


    af - Autoformat ascii text for POD




    af [file]


af transforms ASCII text to POD. It understands three different types of formatted ASCII text:

  • Regular paragraphs of text. These begin at the beginning of a line without any leading whitespace and continue until an empty line or the end of file is encountered. These paragraphs are trimmed to a line length of 70 using a word-bound linebreak algorithm. If a line can't be broken (e.g. because if consists of just one word), it just overflows. This makes sure long URLs etc. are not chopped.

  • Indented code. These listings aren't formatted at all, they're handed over to POD unmodified.

  • Headlines. These start with a *:
        * GNUs -- how to tame them

  • Sub-Headlines. These start with a **:
        ** Approaching GNUs

  • Bullet lists. Items in the list just start with a -:
        - Grab the GNU by the horns

  • Sub-Bullet lists. If one bullet point contains a sub-bullet list, just use two --s:
        -- Grab the left horn

It's important that every marked sections is within a separate paragraph. af reads its input paragraph by paragraph and determines for each of them what kind of markup it is by looking at the first couple of characters.


Copyright 2002 by Mike Schilli, all rights reserved. This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.


2001, Mike Schilli <m@perlmeister.com>

Latest update: 20-Oct-2013