# Blosxom Plugin: mason_blocks
# Author(s): Gavin Carr <gavin@openfusion.com.au>
-# Version: 0.001000
+# Version: 0.002000
package mason_blocks;
}
}
+ # Join flavour lines and update $$flavour_ref
$$flavour_ref = join "\n", @flavour;
+
+ # Support mason-style end-of-line newline escapes
+ $$flavour_ref =~ s/\\\r?\n//g;
}
1;
comment.
</%doc>
+ # Mason-style newline escaping, if last character on line is a backslash e.g.
+ <p>\
+ Foo bar\
+ </p>
+ # is rendered as: <p>Foo bar</p>
+
=head1 DESCRIPTION
Block comments cannot be nested.
+=head2 NEWLINE ESCAPING
+
+mason_blocks also supports mason-style newline escaping i.e. if the last
+character on a line is a backslash, mason_blocks escapes the line break,
+deleting both the backslash and the following newline character(s). This
+is useful in conjunction with conditionals where you'd prefer the
+conditional content to appear inline within the enclosing content e.g.
+
+ <a href="$permalink::story#comments">\
+ % if ($feedback::count == 0) {
+ No Comments \
+ % }
+ »</a>
+
+would be rendered as:
+
+ <a href="$permalink::story#comments">No Comments »</a>
+
+This is not just a prettiness issue - some browsers treat embedded
+whitespace (including newlines) as significant, even when they
+shouldn't.
+
=head2 VS. INTERPOLATE_FANCY
mason_blocks was initially born out of my frustration with older versions