Skip to content

Commit

Permalink
Document FillInForm and allow it to take options hash
Browse files Browse the repository at this point in the history
  • Loading branch information
jonswar committed Jun 11, 2012
1 parent f73e541 commit 078723b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Revision history for Mason-Plugin-HTMLFilters

0.03 Feb 20, 2011

- Document FillInForm and allow it to take options hash

0.02 Feb 20, 2011

- Require Mason
Expand Down
19 changes: 15 additions & 4 deletions lib/Mason/Plugin/HTMLFilters.pm
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ Formats a block of text into HTML paragraphs. A sequence of two or more
newlines is used as the delimiter for paragraphs which are then wrapped in HTML
""<p>""...""</p>"" tags. Taken from L<Template::Toolkit|Template>. e.g.
<% $.HTMLPara { %>
% $.HTMLPara {{
First paragraph.
Second paragraph.
</%>
% }}
outputs:
Expand All @@ -59,18 +59,29 @@ outputs:
Similar to HTMLPara above, but uses the HTML tag sequence "<br><br>" to join
paragraphs. Taken from L<Template::Toolkit|Template>. e.g.
<% $.HTMLPara { %>
% $.HTMLPara {{
First paragraph.
Second paragraph.
</%>
% }}
outputs:
First paragraph.
<br><br>
Second paragraph.
=item FillInForm ($form_data, %options)
Uses L<HTML::FillInForm|HTML::FillInForm> to fill in the form with the
specified I<$form_data> and I<%options>.
% $.FillInForm($form_data, target => 'form1') {{
...
<form name='form1'>
...
% }}
=back
=head1 SUPPORT
Expand Down
6 changes: 3 additions & 3 deletions lib/Mason/Plugin/HTMLFilters/Filters.pm
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ method HTMLParaBreak () {
};
}

method FillInForm ($fdat) {
method FillInForm ($form_data, %options) {
require HTML::FillInForm;
sub {
my $html = $_[0];
return $html if !defined($fdat);
return HTML::FillInForm->fill( \$html, $fdat );
return $html if !defined($form_data);
return HTML::FillInForm->fill( \$html, $form_data, %options );
};
}

Expand Down

0 comments on commit 078723b

Please sign in to comment.