Text::LineFold - Line Folding for Plain Text |
Text::LineFold - Line Folding for Plain Text
use Text::LineFold; $lf = Text::LineFold->new(); # Fold lines $folded = $lf->fold($string, 'PLAIN'); $indented = $lf->fold(' ' x 8, ' ' x 4, $string);
# Unfold lines $unfolded = $lf->unfold($string, 'FIXED');
Text::LineFold folds or unfolds lines of plain text. As it mainly focuses on plain text e-mail messages, RFC 3676 flowed format is also supported.
"UTF-8"
.
"XX"
.
See also Context in the Unicode::LineBreak manpage option.
"\n"
.
"_UNICODE_"
is specified, result will be Unicode string.
Default is the value of Charset option.
fold()
folds lines of string STRING and returns it.
Surplus SPACEs and horizontal tabs at end of line are removed,
newline sequences are replaced by that specified by Newline option
and newline is appended at end of text if it does not exist.
Horizontal tabs are treated as tab stops according to TabSize option.
By the first style, following options may be specified for METHOD argument.
"FIXED"
">"
won't be folded.
Paragraphs are separated by empty line.
"FLOWED"
"Format=Flowed; DelSp=Yes"
formatting defined by RFC 3676.
"PLAIN"
Second style is similar to wrap() in the Text::Wrap manpage. All lines are folded. INITIAL_TAB is inserted at beginning of paragraphs and SUBSEQUENT_TAB at beginning of other broken lines.
Following options may be specified for METHOD argument.
"FIXED"
">"
won't be conjuncted.
Treat empty line as paragraph separator.
"FLOWED"
"Format=Flowed; DelSp=Yes"
formatting defined by RFC 3676.
"FLOWEDSP"
"Format=Flowed; DelSp=No"
formatting defined by RFC 3676.
Please report bugs or buggy behaviors to developer.
CPAN Request Tracker: http://rt.cpan.org/Public/Dist/Display.html.
Consult $VERSION variable.
the Unicode::LineBreak manpage, the Text::Wrap manpage.
Copyright (C) 2009-2012 Hatuka*nezumi - IKEDA Soji <hatuka(at)nezumi.nu>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Text::LineFold - Line Folding for Plain Text |