Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process modifiers before deactivating actions? #7

Open
yanamal opened this issue Nov 8, 2015 · 3 comments
Open

Process modifiers before deactivating actions? #7

yanamal opened this issue Nov 8, 2015 · 3 comments

Comments

@yanamal
Copy link

yanamal commented Nov 8, 2015

I think it would make more sense to process modifier functions while the actions (on that same symbol/keyword) are still active, and so the symbols introduced in the actions are still "in scope", so to speak.

Granted, I am sort of using this system for things it was never intended for. I wrote some custom modifiers that produce side effects in other data structures, and I'm trying to sneak more information to these custom functions via actions.

@dranorter
Copy link

It turns out this is an easy fix. I wanted to make a ".eval" modifier so I needed the "this" keyword inside the modifier to expose the grammar as it stood at time of application. I think this is the same thing you mean. I don't know what version of Tracery you (were/are) using, but using the NPM version 2.7.3, you will find there is a line

this.finishedText = mod(this.finishedText, modParams);

which you should change to

this.finishedText = mod.call(this, this.finishedText, modParams);

If you're still around or even still remember what this was about, @yanamal , I'd be curious to know what you were doing.

@galaxykate Could this be included in the NPM code?

@yanamal
Copy link
Author

yanamal commented Apr 22, 2017

I can't remember what exactly I was trying to do anymore, sorry. I believe this is what I was working on, though:
http://yanamal.pencilcode.net/edit/storygen/grammar2

(note: yes, this is actually real html/javascript. there are little yellow taps you can click on to make the block formatting go away).

So definitely not NPM - but if I take it up again, I'll keep it in mind, thanks!

@dranorter
Copy link

Oh, sorry if that last sentence was misleading, I was trying to ping GalaxyKate and see if she thought the one-line change ought to be in the Tracery NPM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants