Skip to content

Create types for avoiding escaping #77

@FCO

Description

@FCO

It would be very helpful if there were 2 types (maybe 2 roles) that when a template tag recipe an instance of that type,
it would automatically avoiding escaping it. Maybe it could be something like HSML and JAVASCRIPT roles and that would
automatically apply &HTML and &HTML-AND_JAVASCRIPT (maybe a &JAVASCRIPT if that exists), so when doing:

<.method-returning-html>

and the object on $_ has something like:

method method-returning-html {
   '<a href="http://pudim.com.br">Pudim</a>' does HTML
}

it would behave as it were:

<&HTML(.method-returning-html)>

and also existing:

class Link {
   has Str $.title;
   has Str $.href;

   method Str {
      qq'<a href="$!href">$!title</a>' does HTML
   }
}

if we have:

<.pudim-link>

and that returns something like:

method pudim-link { Link.new: :title<Pudim>, :href<http://pudim.com.br> }

it would be equivalent to:

<&HTML(.pudim-link.Str)>

and the same for JS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions