From: Gavin Carr Date: Mon, 10 Sep 2007 10:43:03 +0000 (+0000) Subject: Add support for mason newline escaping to mason_blocks plugin. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=f728c3fb2f7140671e4d7a2d70c843c608d6d057;hp=0bcc23084d080e312003562c124d06598909cc1a;p=matthijs%2Fupstream%2Fblosxom-plugins.git Add support for mason newline escaping to mason_blocks plugin. --- diff --git a/gavinc/mason_blocks b/gavinc/mason_blocks index 5a812d9..42dafa6 100644 --- a/gavinc/mason_blocks +++ b/gavinc/mason_blocks @@ -1,6 +1,6 @@ # Blosxom Plugin: mason_blocks # Author(s): Gavin Carr -# Version: 0.001000 +# Version: 0.002000 package mason_blocks; @@ -101,7 +101,11 @@ sub munge_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; @@ -137,6 +141,12 @@ in blosxom flavours/templates comment. + # Mason-style newline escaping, if last character on line is a backslash e.g. +

\ + Foo bar\ +

+ # is rendered as:

Foo bar

+ =head1 DESCRIPTION @@ -186,6 +196,28 @@ For example: 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. + + \ + % if ($feedback::count == 0) { + No Comments \ + % } + » + +would be rendered as: + + No Comments » + +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