Created
December 3, 2012 16:03
-
-
Save mfontani/4195954 to your computer and use it in GitHub Desktop.
Weird mark_raw problem with Xslate + wonky workaround
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Text::Xslate qw<mark_raw>; | |
use 5.010_000; | |
my $x = Text::Xslate->new( | |
function => { | |
p => sub { | |
return mark_raw( "L(@_)" ); | |
} | |
}, | |
); | |
# Works: | |
say $x->render_string('<: p("<a>") :>'); | |
say $x->render_string('<: p("<a>" ~ "foo" ~ "</a>") :>'); | |
# NO WORKY! | |
say $x->render_string('<: p("<a>" ~ p("foo") ~ "</a>") :>'); | |
# KINDA FIX: | |
say $x->render_string('<: p( mark_raw("<a>") ~ p("foo") ~ mark_raw("</a>") ) :>'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment