outaTiME / grunt-replace

Replace text patterns with applause.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

If inner key-value pair doesn't exist, replace as blank (empty)

doshprompt opened this issue · comments

currently, it replaces the outer as object and leaves the rest of the string intact (after the dot notation) like so:

FOO - {"title":"FOO"}.description

Hi pal, oups ... you can share a full example ?? 

Thks !!!

On Mon, Aug 18, 2014 at 8:20 PM, Rahul Doshi notifications@github.com
wrote:

currently, it replaces the outer as object and leaves the rest of the string intact (after the dot notation) like so:

FOO - {"title":"FOO"}.description

Reply to this email directly or view it on GitHub:
#55

Here is the complete example

https://gist.github.com/doshprompt/17221fb86570cb142ea4

It might be an underlying issue with applause.

Sorry for delay pal, im overloaded ...

this is valid escenario cos @@inner exist in the replacement table check out the applause docs:

https://github.com/outaTiME/applause#patternsjson

in the snippet says:

replaces "@@inner" with string representation of "inner" object

it will be useful in some kind of situations propably in others not ... mmmm ... my best effort is to define a configuracion key to ignore the root objects, what do you thing ??

Hey np, thanks for getting back to me though.

I looked at the linked section in applause, I think it shouldn't be evaluating in chunks but the thing as a whole first. The snippet makes sense but in this situation I am doing

@@outer.inner

so it should evaluate outer.inner together and not replace outer and then inner separately.

Do you see what I mean? I think the config option is fine but it would be better to have it on by default instead of off, since this seems more natural to me. What do you think?

Hi pal, its impossible to detect the full "token", applause replaces the first occurrence on the matching tree ...

the bigger match should be replaced at first if we found "@@inner.hai" in the matching tree it will be resolved before "@@inner" ... im unable to resolve this kind of replacement =(

if you got some idea how to deal with that, PR will be welcome ...

no updates, closing for now ...