The valuespace/jinja combination is precisely the behavior I'm trying to achieve. My concern is the level of integration that solutions offers. This seems like a powerful concept and I'm interested if there would be any interest in a core Leo implementation.
For documentation purposes I'd like to put forth a clear description of my idea. What I'm thinking of would behave exactly like an abbreviation with two exceptions: - The replacement would be delayed until the file was written. - The values of the replacements would update in real time (no need to restart/reload like I have to do with abbreviations) Let's call these "delayed abbreviations". My vision for this is to reduce repeated information across nodes of all types as well as reduce cognitive load. Terry, I will experiment with the valuespace/jinja combination in the meantime. On Monday, May 4, 2015 at 12:55:19 PM UTC-4, Terry Brown wrote: > > On Mon, 4 May 2015 04:14:47 -0700 (PDT) > john lunzer <[email protected] <javascript:>> wrote: > > > I've been using Leo to help me organize hundreds of bash scripts. > > Some scripts share common data. One might say my project (and my > > reason for seeking out Leo) was to find a way to organize all these > > scripts. It's been a resounding success. > > > > I'd like to find a way to consolidate common pieces of data in a type > > of "global variables node" where I can change a value once and it is > > applied to all files/nodes which reference it. I've been doing this > > with find/replace all but I find this cumbersome and it does not > > document the shared data. > > Just out of curiosity I looked at valuespace. I think it does > what you want, although also you need to use the jinjarender.py > plugin. http://jinja.pocoo.org/ for jinja syntax. > > With both those plugins installed, you can have a node > > @= otters > Giant aquatic weasels > > and another node > > @jinja ~/myscript.sh > echo "$(date): Beware the {{otters}}" > > Then, once, you need to execute the command "vs-update", to read all > the @= nodes, and then for each @jinja node, select the node and > execute the command "act-on-node". > > The expected substitutions occur. You could a script button to call > vs-update and then run act-on-node on all @jinja nodes. > > @jinja nodes support @language and @others :-) > > For short assigning short values you might want a more succinct > assignment syntax added in valuespace, maybe > > @= varname rest of lines becomes var > > so > > @= distribution internal only > > with no body would assign 'internal only' to `distribution`, without > the harder to scan placement of distribution in the body. > > Note that the @= variable names need to be proper python identifiers, > valuespace has more sophisticated syntax to execute blocks of code with > these variables. > > It seems to me that the valuespace / jinjarender combination is the > templating people new to Leo often think clones might be (not referring > to you here John). > > Cheers -Terry > > > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
