debianrelease-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change
on this file since 1375a6a was
1375a6a,
checked in by Nelson Elhage <nelhage@mit.edu>, 16 years ago
|
Add a word-wrapping style to the repo and default build.
|
-
Property mode set to
100644
|
File size:
873 bytes
|
Line | |
---|
1 | use warnings; |
---|
2 | use strict; |
---|
3 | |
---|
4 | =head1 NAME |
---|
5 | |
---|
6 | BarnOwl::Module::WordWrap |
---|
7 | |
---|
8 | =head1 DESCRIPTION |
---|
9 | |
---|
10 | An extension of the default owl style that wordwraps displayed |
---|
11 | messages using Text:;Autoformat |
---|
12 | |
---|
13 | =cut |
---|
14 | |
---|
15 | package BarnOwl::Module::WordWrap; |
---|
16 | use base qw(BarnOwl::Style::Default); |
---|
17 | |
---|
18 | eval "use Text::Autoformat"; |
---|
19 | |
---|
20 | if($@) { |
---|
21 | BarnOwl::error("Text::Autoformat not found; Not loading wordwrap style"); |
---|
22 | } else { |
---|
23 | BarnOwl::create_style("wordwrap", "BarnOwl::Module::WordWrap"); |
---|
24 | } |
---|
25 | |
---|
26 | sub indent_body { |
---|
27 | my $self = shift; |
---|
28 | my $m = shift; |
---|
29 | my $body = $m->body; |
---|
30 | |
---|
31 | my $left = 5; |
---|
32 | |
---|
33 | $body = autoformat($body, {left => $left, |
---|
34 | right => BarnOwl::getnumcols() - $left - 1, |
---|
35 | all => 1, renumber => 0, list => 0}); |
---|
36 | $body =~ s/\n$//; |
---|
37 | return $body; |
---|
38 | } |
---|
39 | |
---|
40 | sub description { |
---|
41 | "A word-wrapping variant of the default style." |
---|
42 | } |
---|
43 | |
---|
44 | 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.