NAME

Parse::Template::Web -

SYNOPSIS

EXPORTS

Nothing exported by default

DEPENDENCIES

This module requires these other modules and libraries:

Data::Format::Nml::Document
WWW::Misc::Image
Parse::Template::Directives::ContentEditable
Error::Logical
Perl::Module
Data::Hub::Util
Parse::Template::BBCode
WWW::Livesite::Args
Carp
Parse::Template::Directives::Color
Parse::Template::Directives::HTML
HTML::Entities
Parse::Template::Directives::JS
Parse::Template::Directives::URI
Parse::Template::Directives::Encode

DESCRIPTION

PUBLIC INTERFACE

defang

Remove characters that would otherwise cause parser evaluation.

Also perform lightweight killing of HTML characters: \\<'"&>

This example will not abort:

use Parse::Template::Web;

This example will not abort:

use Data::Hub;

This example:

my $p = Parse::Template::Web->new(Data::Hub->new());
$p->defang('a[#b]c');

will return:

abc

This example:

my $p = Parse::Template::Web->new(Data::Hub->new());
my $r = $p->defang(['a[#b]c', 'a<b>c</d>e']);
join('', @$r);

will return:

abcabc/de

http:header

Add an HTTP header for output
[#:http:header 'Name' 'Definition']
[#:http:header 'Name' 'Definition' -override]

When -override is given, existing headers with the same name are removed.

is_editing

Is the page being rendered for an authorized editor

PACKAGE INTERNALS

_mk_url

Given a relative path or URI, return an escaped URL for use in HTML

Spaces and ampersands will be encoded corretly:

http://www.example.com/a b & c/c?a=b&c=1 2&d=%20;e="q"

becomes:

http://www.example.com/a%20b%20&amp;%20c/c?a=b&amp;c=1%202&amp;d=%20&amp;e=%22q%22

_elem_attrs

Format arguments as element attributes

_mk_image

Create attributes for an image and possibly a wrapping anchor

where:

$src              image url (src attribute)
%attrs            image attributes which invoke special behavior
  $attrs{src}     image url (src attribute)
  $attrs{resize}  requests the image be resized to WxH/wxh
  $attrs{href}    the image is wrapped in an anchor
  $attrs{target}  that anchor has a target

options:

-resize     => $WxH/wxh
-max_width  => $num
-max_height => $num
-min_width  => $num
-min_height => $num

Resize format is WxH/wxh (read as max-width by max-height over min-width by min-height) in pixels.

100           width <= 100
100x          width <= 100
100x99        width <= 100, height <= 99
100x99/       width <= 100, height <= 99
100x99/10     10 <= width <= 100, height <= 99
100x99/10x    10 <= width <= 100, height <= 99
100x99/10x9   10 <= width <= 100, 9 <= height <= 99
/10           10 <= width
/10x          10 <= width
/10x9         10 <= width, 9 <= height

Template options should take precedence over data options so that one may lock-down the flow of the page.

The Livesite responder for images allows one to specify the resize parameter in the URL:

http://www.example.com/images/laura.jpg?resize=50x50

However the server simply resizes the image to the nearest reasonable size, Which means the image tag must include the exact width and height.

AUTHORS

Ryan Gies <ryangies@cpan.org>

COPYRIGHT

Copyright (C) 2014-2016 by Ryan Gies. All rights reserved.
Copyright (C) 2006-2013 by Livesite Networks, LLC. All rights reserved.
Copyright (C) 2000-2005 by Ryan Gies. All rights reserved.
Redistribution and use in source and binary forms, with or without 
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, 
this list of conditions and the following disclaimer.
* The origin of this software must not be misrepresented; you must not 
claim that you wrote the original software. If you use this software in a 
product, an acknowledgment in the product documentation would be 
appreciated but is not required.
* Altered source versions must be plainly marked as such, and must not be 
misrepresented as being the original software.
* The name of the author may not be used to endorse or promote products 
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
OF SUCH DAMAGE.
To the best of our knowledge, no patented algorithms have been used. However, we
do not have the resources to carry out a patent search, and therefore cannot 
give any guarantee of the above statement.