Subject: | Problem with Syntax-Highlight-Mason and Mason version > 1.35 |
In version 1.36 you changed line 265 in Mason::Compiler.pm from
if $c->{comp_with_content_stack} && @{ $c->{comp_with_content_stack} };
to
if @{ $c->{comp_with_content_stack} };
This ended up breaking my Syntax-Highlight-Mason program, for what
reason I have no idea. The array was undefined because
$c->{comp_with_content_stack} was undefined, and the result wasn't
pretty. After adding the test back in, everything worked fine.
I've attached the test file that comes with my distribution, so you can
see for yourself. I hope this is helpful.
Best wishes,
Henry Laxen
This is perl, v5.8.8 built for x86_64-linux-gnu-thread-multi
Linux exxor 2.6.18-6-amd64 #1 SMP Sun Feb 10 17:50:19 UTC 2008 x86_64
GNU/Linux
HTML-Mason-1.39
Subject: | Syntax-Highlight-Mason.t |
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl Syntax-Highlight-Mason.t'
#########################
# change 'tests => 1' to 'tests => last_test_to_print';
use Test::More tests => 2;
BEGIN { use_ok('Syntax::Highlight::Mason') };
#########################
my $mcode = <<'END';
<%doc>
test for mason highlighter
</%doc>
HTML <b>code</b> here
% my $x = 'a perl variable';
<%init>
# More perl code
$x =~ s/perl/PERL/g;
</%init>
<%args>
$x
$y => ''
</%args>
END
my $expected_result = <<'END';
<html>
<head>
<style type="text/css">
.m-tag { color: #0000ff; font-weight: bold; } /* mason tag */
/* ====================================================================== *
* Sample stylesheet for Syntax::Highlight::HTML *
* *
* Copyright (C)2004 Sebastien Aperghis-Tramoni, All Rights Reserved. *
* *
* This file is free software; you can redistribute it and/or modify *
* it under the same terms as Perl itself. *
* ====================================================================== */
.h-decl { color: #336699; font-style: italic; } /* doctype declaration */
.h-pi { color: #336699; } /* process instruction */
.h-com { color: #338833; font-style: italic; } /* comment */
.h-ab { color: #000000; font-weight: bold; } /* angles as tag delim. */
.h-tag { color: #993399; font-weight: bold; } /* tag name */
.h-attr { color: #000000; font-weight: bold; } /* attribute name */
.h-attv { color: #333399; } /* attribute value */
.h-ent { color: #cc3333; } /* entity */
.h-lno { color: #aaaaaa; background: #f7f7f7;} /* line numbers */
</style>
</head>
<body>
<pre>
<span class="m-tag"><%doc>
</span>
test for mason highlighter
<span class="m-tag"></%doc>
</span>HTML <span class="h-ab"><</span><span class="h-tag">b</span><span class="h-ab">></span>code<span class="h-ab"></</span><span class="h-tag">b</span><span class="h-ab">></span> here
% <span style="color:#000;">my</span> <span style="color:#080;">$x</span> <span style="color:#000;">=</span> <span style="color:#00a;">'</span><span style="color:#00a;">a perl variable</span><span style="color:#00a;">'</span><span style="color:#000;">;</span>
<span class="m-tag"><%init>
</span>
<span style="color:#069;font-style:italic;"># More perl code</span>
<span style="color:#080;">$x</span> <span style="color:#000;">=~</span> <span style="color:#00a;">s/</span><span style="color:#00a;">perl</span><span style="color:#00a;">/</span><span style="color:#00a;">PERL</span><span style="color:#00a;">/</span><span style="color:#00a;">g</span><span style="color:#000;">;</span>
<span class="m-tag"></%init>
</span><span class="m-tag"><%args>
</span>$x
$y => ''
<span class="m-tag"></%args>
</span></pre>
</body>
</html>
END
my $result = Syntax::Highlight::Mason->new->compile($mcode);
is($result, $expected_result, 'basic test');