NAME

Html::FromMail::Default::Previewers - produce smaller versions of data items

SYNOPSIS

DESCRIPTION

These functions define the default algorithms to produce previews for message bodies. When a message part is inlined, and there is an htmlifier defined for it, that will be prevailed (see HTML::FromMail::Default::HTMLifiers). When inlining is not possible or not requested, there may be a preview constructed. The defaults are defined in this module.

Any function here shall return something reasonable, even if the conversion fails for some reason. Each fuction returns the data for a referenve to a hash of values, which are accessible in the output formatter. Each hash must define either image => {}, html => '' # an image is produced, or image => '', html => {} # html was produced

Each of the functions is called with five arguments: PAGE, MESSAGE, PART, ATTACH, and ARGS argument. The PAGE is the object which produces pages, an extension of HTML::FromMail::Page. The MESSAGE is the main message which is displayed (a Mail::Message object). The PART is either the whole MESSAGE or a part within a multipart or nested message (a Mail::Message::Part object). The PART information is to be processed.

As ATTACH, a reference to a hash with information about the created attachement is passed. This information is needed to produce the preview. That same hash is extended with more information from the previewer, and then accessible via the formatter.

The ARGS is a wild combination of information about the formatter and information defined by it. For instance, the arguments which are passed with the tag in the template file can be found in there. Print the content of the hash to see how much information you get... (sorry for this rough description)

FUNCTIONS

previewHtml(PAGE, MESSAGE, PART, ATTACH, ARGS)

Produce a small preview of the html, where first the title is taken and put in bold. The rest of the header is removed. Then the first characters of the rest of the content are displayed.

-Option        --Default
 text_max_chars  250
text_max_chars => INTEGER

example: of a plain text preview with the Text::MagicTemplate formatter

<!--{preview text_max_chars => 120}-->
   <!--{html}-->
      <blockquote><cite>
      <!--{text}-->&nbsp;...
      </cite></blockquote>
   <!--{/html}-->
<!--{/preview}-->
previewImage(PAGE, MESSAGE, PART, ATTACH, ARGS)

Produce a small preview of the html, where first the title is taken and put in bold. The rest of the header is removed. Then the first characters of the rest of the content are displayed.

-Option        --Default
 img_max_height  250
 img_max_width   250
img_max_height => INTEGER
img_max_width => INTEGER

example: of a plain text preview with the Text::MagicTemplate formatter

<!--{preview img_max_width => 200, img_max_height => 200}-->
   <!--{image}-->
   <!--{/image}-->
<!--{/preview}-->
previewText(PAGE, MESSAGE, PART, ATTACH, ARGS)

Produce a small preview of the text, where all wrappig is removed.

-Option        --Default
 text_max_chars  250
text_max_chars => INTEGER

example: of a plain text preview with the Text::MagicTemplate formatter

<!--{preview text_max_chars => 120}-->
   <!--{html}-->
      <blockquote><cite>
      <!--{text}-->&nbsp;...
      </cite></blockquote>
   <!--{/html}-->
<!--{/preview}-->

SEE ALSO

This module is part of HTML-FromMail distribution version 0.12, built on January 29, 2018. Website: http://perl.overmeer.net/CPAN/

LICENSE

Copyrights 2003-2018 by [Mark Overmeer <markov@cpan.org>]. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/