Closed mikeraynham closed 7 years ago
This is expected behaviour.
: macro div { raw('<div>' ~ br() ~ '</div>') }
You should write as below.
: macro div { raw(raw('<div>') ~ br() ~ raw('</div>')) }
~
operator is applied before applying outside raw
operator. And <div>
is not marked as string while br()
is marked as raw string so that ~
operator escapes unraw string(<div>
). (And its result is marked as raw string while 2nd </div>
is not marked as raw string, so right hand side is escaped).
join
builtin arrayref function is just a Perl's buildin join
function. It does not escape against array content.
Thank you for the explanation.
See pull request #174 for a failing test.
When macro A concatenates strings with the output of macro B, and both macros mark their output as raw, the strings from macro A are unexpectedly HTML escaped. This only happens with the concatenation operator when used inside a macro. HTML escaping is not applied if the join method is used instead of the concatenation operator, or if the concatenation operator is used outside of a macro.
This:
Produces:
Whereas this:
Or this:
Produces: