Using Mason for generate some output from templates (not web).
Need generate an output from the Mason component where the output lines should start with the %
character.
Because the %<space>
at the beginning of the lines in the Mason component are executed as perl commands, currently I'm using:
<% $perc %> the remaining content of the line.
and the $perc is defined in the %init
section as my $perc = '%';
The above works, but for many lines it is an terrible solution.
The question: Is it possible somewhat generate Mason output where some lines contains the '%' character at the beginning of the line?
Based on the conversation is the Mason mailing list, the only working solution is write an custom filter. (unfortunately the "natural" double
%%
or escaped\%
didn't works and probably will be never added into basic Mason syntax.)The following Mason filter works,
e.g. from the
will produce output the wanted output.