[%# # IMPORTANT NOTE # This documentation is generated automatically from source # templates. Any changes you make here may be lost. # # The 'docsrc' documentation source bundle is available for download # from http://www.template-toolkit.org/docs.html and contains all # the source templates, XML files, scripts, etc., from which the # documentation for the Template Toolkit is built. -%] [% META book = 'Modules' page = 'Plugin_Wrap' %] [% WRAPPER toc; PROCESS tocitem title ="SYNOPSIS" subs = []; PROCESS tocitem title ="DESCRIPTION" subs = []; PROCESS tocitem title ="AUTHOR" subs = []; PROCESS tocitem title ="VERSION" subs = []; PROCESS tocitem title ="COPYRIGHT" subs = []; PROCESS tocitem title ="SEE ALSO" subs = []; END %] [% WRAPPER section title="SYNOPSIS" -%]
    [% tt_start_tag %] USE wrap [% tt_end_tag %]
    # call wrap subroutine
    [% tt_start_tag %] wrap(mytext, width, initial_tab,  subsequent_tab) [% tt_end_tag %]
    # or use wrap FILTER
    [% tt_start_tag %] mytext FILTER wrap(width, initital_tab, subsequent_tab) [% tt_end_tag %]
[%- END %] [% WRAPPER section title="DESCRIPTION" -%]

This plugin provides an interface to the Text::Wrap module which provides simple paragraph formatting.

It defines a 'wrap' subroutine which can be called, passing the input text and further optional parameters to specify the page width (default: 72), and tab characters for the first and subsequent lines (no defaults).

    [% tt_start_tag %] USE wrap [% tt_end_tag %]
    [% tt_start_tag %] text = BLOCK [% tt_end_tag %]
    First, attach the transmutex multiplier to the cross-wired 
    quantum homogeniser.
    [% tt_start_tag %] END [% tt_end_tag %]
    [% tt_start_tag %] wrap(text, 40, '* ', '  ') [% tt_end_tag %]

Output:

    * First, attach the transmutex
      multiplier to the cross-wired quantum
      homogeniser.

It also registers a 'wrap' filter which accepts the same three optional arguments but takes the input text directly via the filter input.

    [% tt_start_tag %] FILTER bullet = wrap(40, '* ', '  ') -[% tt_end_tag %]
    First, attach the transmutex multiplier to the cross-wired quantum
    homogeniser.
    [% tt_start_tag %]- END [% tt_end_tag %]
    [% tt_start_tag %] FILTER bullet -[% tt_end_tag %]
    Then remodulate the shield to match the harmonic frequency, taking 
    care to correct the phase difference.
    [% tt_start_tag %] END [% tt_end_tag %]

Output:

    * First, attach the transmutex
      multiplier to the cross-wired quantum
      homogeniser.
    * Then remodulate the shield to match
      the harmonic frequency, taking 
      care to correct the phase difference.
[%- END %] [% WRAPPER section title="AUTHOR" -%]

Andy Wardley <abw@kfs.org>

The Text::Wrap module was written by David Muir Sharnoff <muir@idiom.com> with help from Tim Pierce and many others.

[%- END %] [% WRAPPER section title="VERSION" -%]

2.51, distributed as part of the Template Toolkit version 2.08, released on 30 July 2002.

[%- END %] [% WRAPPER section title="COPYRIGHT" -%]
  Copyright (C) 1996-2002 Andy Wardley.  All Rights Reserved.
  Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

[%- END %] [% WRAPPER section title="SEE ALSO" -%]

[% ttlink('Template::Plugin', 'Template::Plugin') -%], [% ttlink('Text::Wrap', 'Text::Wrap') -%]

[%- END %]