.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Text::LineFold 3pm" .TH Text::LineFold 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Text::LineFold \- Line Folding for Plain Text .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& use Text::LineFold; \& $lf = Text::LineFold\->new(); \& \& # Fold lines \& $folded = $lf\->fold($string, \*(AqPLAIN\*(Aq); \& $indented = $lf\->fold(\*(Aq \*(Aq x 8, \*(Aq \*(Aq x 4, $string); \& \& # Unfold lines \& $unfolded = $lf\->unfold($string, \*(AqFIXED\*(Aq); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" 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. .SS "Public Interface" .IX Subsection "Public Interface" .IP "new ([KEY => VALUE, ...])" 4 .IX Item "new ([KEY => VALUE, ...])" \&\fIConstructor\fR. About KEY => VALUE pairs see config method. .ie n .IP "$self\->config (KEY)" 4 .el .IP "\f(CW$self\fR\->config (KEY)" 4 .IX Item "$self->config (KEY)" .PD 0 .ie n .IP "$self\->config ([KEY => VAL, ...])" 4 .el .IP "\f(CW$self\fR\->config ([KEY => VAL, ...])" 4 .IX Item "$self->config ([KEY => VAL, ...])" .PD \&\fIInstance method\fR. Get or update configuration. Following KEY => VALUE pairs may be specified. .RS 4 .IP "Charset => CHARSET" 4 .IX Item "Charset => CHARSET" Character set that is used to encode string. It may be string or MIME::Charset object. Default is \f(CW"UTF\-8"\fR. .IP "Language => LANGUAGE" 4 .IX Item "Language => LANGUAGE" Along with Charset option, this may be used to define language/region context. Default is \f(CW"XX"\fR. See also "Context" in Unicode::LineBreak option. .IP "Newline => STRING" 4 .IX Item "Newline => STRING" String to be used for newline sequence. Default is \f(CW"\en"\fR. .IP "OutputCharset => CHARSET" 4 .IX Item "OutputCharset => CHARSET" Character set that is used to encode result of \fBfold()\fR/\fBunfold()\fR. It may be string or MIME::Charset object. If a special value \f(CW"_UNICODE_"\fR is specified, result will be Unicode string. Default is the value of Charset option. .IP "TabSize => NUMBER" 4 .IX Item "TabSize => NUMBER" Column width of tab stops. When 0 is specified, tab stops are ignored. Default is 8. .IP BreakIndent 4 .IX Item "BreakIndent" .PD 0 .IP CharMax 4 .IX Item "CharMax" .IP ColMax 4 .IX Item "ColMax" .IP ColMin 4 .IX Item "ColMin" .IP ComplexBreaking 4 .IX Item "ComplexBreaking" .IP EAWidth 4 .IX Item "EAWidth" .IP HangulAsAL 4 .IX Item "HangulAsAL" .IP LBClass 4 .IX Item "LBClass" .IP LegacyCM 4 .IX Item "LegacyCM" .IP Prep 4 .IX Item "Prep" .IP Urgent 4 .IX Item "Urgent" .PD See "Options" in Unicode::LineBreak. .RE .RS 4 .RE .ie n .IP "$self\->fold (STRING, [METHOD])" 4 .el .IP "\f(CW$self\fR\->fold (STRING, [METHOD])" 4 .IX Item "$self->fold (STRING, [METHOD])" .PD 0 .ie n .IP "$self\->fold (INITIAL_TAB, SUBSEQUENT_TAB, STRING, ...)" 4 .el .IP "\f(CW$self\fR\->fold (INITIAL_TAB, SUBSEQUENT_TAB, STRING, ...)" 4 .IX Item "$self->fold (INITIAL_TAB, SUBSEQUENT_TAB, STRING, ...)" .PD \&\fIInstance method\fR. \&\fBfold()\fR 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. .Sp By the first style, following options may be specified for METHOD argument. .RS 4 .ie n .IP """FIXED""" 4 .el .IP "\f(CW""FIXED""\fR" 4 .IX Item """FIXED""" Lines preceded by \f(CW">"\fR won't be folded. Paragraphs are separated by empty line. .ie n .IP """FLOWED""" 4 .el .IP "\f(CW""FLOWED""\fR" 4 .IX Item """FLOWED""" \&\f(CW"Format=Flowed; DelSp=Yes"\fR formatting defined by RFC 3676. .ie n .IP """PLAIN""" 4 .el .IP "\f(CW""PLAIN""\fR" 4 .IX Item """PLAIN""" Default method. All lines are folded. .RE .RS 4 .Sp Second style is similar to "\fBwrap()\fR" in Text::Wrap. All lines are folded. INITIAL_TAB is inserted at beginning of paragraphs and SUBSEQUENT_TAB at beginning of other broken lines. .RE .ie n .IP "$self\->unfold (STRING, METHOD)" 4 .el .IP "\f(CW$self\fR\->unfold (STRING, METHOD)" 4 .IX Item "$self->unfold (STRING, METHOD)" Conjunct folded paragraphs of string STRING and returns it. .Sp Following options may be specified for METHOD argument. .RS 4 .ie n .IP """FIXED""" 4 .el .IP "\f(CW""FIXED""\fR" 4 .IX Item """FIXED""" Default method. Lines preceded by \f(CW">"\fR won't be conjuncted. Treat empty line as paragraph separator. .ie n .IP """FLOWED""" 4 .el .IP "\f(CW""FLOWED""\fR" 4 .IX Item """FLOWED""" Unfold \f(CW"Format=Flowed; DelSp=Yes"\fR formatting defined by RFC 3676. .ie n .IP """FLOWEDSP""" 4 .el .IP "\f(CW""FLOWEDSP""\fR" 4 .IX Item """FLOWEDSP""" Unfold \f(CW"Format=Flowed; DelSp=No"\fR formatting defined by RFC 3676. .RE .RS 4 .RE .SH BUGS .IX Header "BUGS" Please report bugs or buggy behaviors to developer. .PP CPAN Request Tracker: . .SH VERSION .IX Header "VERSION" Consult \f(CW$VERSION\fR variable. .SH "SEE ALSO" .IX Header "SEE ALSO" Unicode::LineBreak, Text::Wrap. .SH AUTHOR .IX Header "AUTHOR" Copyright (C) 2009\-2012 Hatuka*nezumi \- IKEDA Soji . .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.