On Mon, 4 May 2015 04:14:47 -0700 (PDT) john lunzer <lun...@gmail.com> 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 leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at http://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.