Skip to content

Commit

Permalink
add ability to pass html through (in TR)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrockway committed Sep 22, 2008
1 parent 54dfcbd commit 6307f52
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
11 changes: 11 additions & 0 deletions lib/Ernst/Description/Trait/PassthroughHTML.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package Ernst::Description::Trait::PassthroughHTML;
use Moose::Role;

has 'pass_html' => (
is => 'ro',
isa => 'Bool',
default => sub { 1 },
required => 1,
);

1;
14 changes: 13 additions & 1 deletion lib/Ernst/Interpreter/TRForm/Trait/Value.pm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,19 @@ around transform_attribute => sub {

else {
$copy->removeChildNodes;
$copy->addChild( XML::LibXML::Text->new($value) );

if( $attribute->metadescription->
does('Ernst::Description::Trait::PassthroughHTML') &&
$attribute->metadescription->pass_html ){

my $v = Template::Refine::Fragment->new_from_string(
$value,
);
$copy->addChild( $v->fragment );
}
else {
$copy->addChild( XML::LibXML::Text->new($value) );
}
}

return $copy;
Expand Down

0 comments on commit 6307f52

Please sign in to comment.