Now that the importer;; abbreviation is complete, it occurs to me that it 
would be simpler and better to have created a script :-)

Indeed, while debugging the abbreviation I was constantly "filling in the 
blanks" by typing strings followed by two commas. Wouldn't it be easier 
just to fill in a few constants, with copious comments about how the 
constants will be used?

The whole abbreviation edifice is kludgy, especially @data 
abbreviations-subst-env. It took quite a bit of noodling to figure out how 
to make the get_language helper to work.

While rooting around the abbreviation code I found a handy helper: 
abbrev.paste_tree.  I think seeing the *name* of this method was what got 
me thinking about using a script.  Here is the script's outline:

- Define constants used in substitutions.
- Put the *source tree* in a child of the root script node.
- Make the @@file node by copying the source tree, creating the *destination 
tree*.
- Make text substitutions in {{x}} patterns in the destination tree.

It's so much simpler than an abbreviation. Constants define {{x}} patterns. 
The {{x}} *patterns* are simpler than the corresponding {|{x}|} *scripts*, 
both visually and conceptually. And no need to mess with leoSettings.leo, 
myLeoSettings.leo or script-substitution permissions.  

*Summary*

The source tree will be simpler, both visually and conceptually than the 
corresponding tree in the abbreviation.

The new script will be easy to write. Something like abbrev.paste_tree will 
create the destination tree. Something like re.finditer will make all the 
substitutions.

I'm not sure when I will get around to this script, but it *is* worth 
doing.  It's probably only a few hour's work. The result will be better 
reference for future devs than a complex abbreviation hiding in 
leoSettings.leo.

The work on the abbreviation code wasn't wasted.  It is good to allow 
script substitutions in headlines.

Edward

-- 
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 https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to