1Template::Plugin::Wrap(U3s)er Contributed Perl DocumentatTieomnplate::Plugin::Wrap(3)
2
3
4
6 Template::Plugin::Wrap - Plugin interface to Text::Wrap
7
9 [% USE wrap %]
10
11 # call wrap subroutine
12 [% wrap(mytext, width, initial_tab, subsequent_tab) %]
13
14 # or use wrap FILTER
15 [% mytext FILTER wrap(width, initital_tab, subsequent_tab) %]
16
18 This plugin provides an interface to the Text::Wrap module which
19 provides simple paragraph formatting.
20
21 It defines a "wrap" subroutine which can be called, passing the input
22 text and further optional parameters to specify the page width
23 (default: 72), and tab characters for the first and subsequent lines
24 (no defaults).
25
26 [% USE wrap %]
27
28 [% text = BLOCK %]
29 First, attach the transmutex multiplier to the cross-wired
30 quantum homogeniser.
31 [% END %]
32
33 [% wrap(text, 40, '* ', ' ') %]
34
35 Output:
36
37 * First, attach the transmutex
38 multiplier to the cross-wired quantum
39 homogeniser.
40
41 It also registers a "wrap" filter which accepts the same three optional
42 arguments but takes the input text directly via the filter input.
43
44 Example 1:
45
46 [% FILTER bullet = wrap(40, '* ', ' ') -%]
47 First, attach the transmutex multiplier to the cross-wired quantum
48 homogeniser.
49 [%- END %]
50
51 Output:
52
53 * First, attach the transmutex
54 multiplier to the cross-wired quantum
55 homogeniser.
56
57 Example 2:
58
59 [% FILTER bullet -%]
60 Then remodulate the shield to match the harmonic frequency, taking
61 care to correct the phase difference.
62 [% END %]
63
64 Output:
65
66 * Then remodulate the shield to match
67 the harmonic frequency, taking
68 care to correct the phase difference.
69
71 Andy Wardley <abw@wardley.org> <http://wardley.org/>
72
73 The Text::Wrap module was written by David Muir Sharnoff with help from
74 Tim Pierce and many others.
75
77 Copyright (C) 1996-2022 Andy Wardley. All Rights Reserved.
78
79 This module is free software; you can redistribute it and/or modify it
80 under the same terms as Perl itself.
81
83 Template::Plugin, Text::Wrap
84
85
86
87perl v5.36.0 2023-01-20 Template::Plugin::Wrap(3)