On 23.1.2013 2:04, Daniel Mendler wrote:
> In lib/slim/interpolation.rb:
>
>> -        when /\A([#\\]|[^#\\]*)/
>> +        when /\A([#\\]|[^#\\]*(#[^\\#\{][^#\\]*)*)/
>
> What is this about?

I wanted to be able to type HTML entities in smart text directly while 
escaping the rest. So I wanted to exclude even entities like `&#1234;` 
from escaping. The escaping/no escaping has to be done after 
interpolation, otherwise I would have to duplicate the work of the 
interpolate filter. The &foo; entities worked fine right away, but the 
`&#1234;` and `&#x12ff;` entities did not - I have soon realized that it 
is because the interpolate filter splits each `#` and `\` character to a 
separate static text.

Sure, one solution would be to merge the statics back together, either 
in my filter, or prepend the static merger filter instead, but it seemed 
like duplicate work which should better be avoided. So I have rather 
decided to change the interpolate filter regexp so it doesn't split the 
text on `#` characters when it doesn't have to. This can save some 
memory and processing, too, at the cost of the changed regexp (although 
I tried to keept the change at bare minimum - it could be extended to 
cover even more cases).

---

Patrik