Hi Roman, There are two separate issues here: (1) where are filters defined, and (2) how are they applied.
1. In Mason 2 filters are defined by methods, rather than by components. This makes sense for a large variety of filters that don't output content of their own but simply process their incoming content in some way. e.g. an uppercase filter: method Upper () { return sub { uc($_[0]) } } However, it is still possible to define a filter out of a piece of component, e.g. your example of a Javascript filter that wraps its input with a script tag: <%filter Javascript> <script type="javascript"> <% $yield->() %> </script> </%filter> 2. As you know the main syntax for applying filters is with perl lines, e.g. % $.Upper {{ some text that will be uppercased % }} I chose this because it seemed like a similar situation to other brace-delimited control structures: if, for, while, etc. However, there is an another syntax for applying filters that is still supported, though currently not documented: <% $.Upper { %> some text that will be uppercased <% } %> I think this is more like the "inline markup" you are looking for. It is too much tag soup for me, but if people like it for certain situations then we could leave it officially supported and document it. Jon On May 16, 2012, at 7:17 AM, Roman Daniel wrote: > Hi, > > I used Mason1 quite a lot and recently switched to Mason2 for new projects. > > I wonder what was reason for leaving the component with content syntax > in favour of "perl" lines, i.e. > > why > > % $.js {{ > % }} > > instead of > > <&| $.js &> > </&> > ? > > > In my old code I had components (methods) with content which served as > an "active markup" adding some real markup before and after block of > text without any changes to the content. Examples: > > <&| SELF:javascript &> > javascript to be properly wrapped by script tag, CDATA section and > jquery onDomReady wrapper > </&> > > <& SELF:elem, ($important? 'strong': ()) &>text to be empasized or not</&> > > <& SELF:elem, ($active? ('a', href=>$edit_url): ()) &>text to be make > link or not</&> > > > I appreciated that the old syntax was visually similar to HTML markup > and could be placed (indented) accordingly. > > <td><& SELF:elem, ($active? ('a', href=>$edit_url): ()) &>text to > be make link or not</&></td> > > Is there some similar syntax for "active markup", not actually > changing its content, available also in Mason2? > > Thanks for reply, > > Roman Daniel > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Mason-users mailing list > Mason-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mason-users ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users