NAME
Mason::Plugin::QuoteFilters - Filters for making quoted strings
VERSION
version 0.002
DESCRIPTION
This plugin provides some filter sugar for quoting strings in Mason template output.
Say you have a Perl variable, $bar, that you need to inject into some JavaScript. Currently you would write:
var foo = '<% $bar %>';
which this author thinks is ugly because the quotes get lost in the syntax. It also has a tendency to throw off syntax highlighters.
Instead, using this filter you could write:
var foo = <% $bar |Q %>;
and get the same end result.
FILTERS
- Q
-
Single quote a string. Any embedded single quotes are escaped with backslashes.
-
Double quote a string. Any embedded double quotes are escaped with backslashes.
SEE ALSO
AUTHOR
Stephen Clouse <stephenclouse@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Stephen Clouse.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.