On Thursday, November 20, 2025 at 4:56:27 AM UTC-6 Edward K. Ream wrote:
This gemini3 conversation <https://gemini.google.com/share/1b94fa0d0276>
asks for help in improving #4478
<https://github.com/leo-editor/leo-editor/issues/4478>, the documentation
for rst3 filters and half clones. Note that I started with new writing not
contained in #4478.
Wow: Here is the latest result. It's way better than the first, second, and
third drafts:
All clones of the same node share the same VNode, and thus they all have
exactly the same headline, body text, and children. Therefore, changing p.b
or p.h, or adding a child to one clone modifies the underlying VNode,
reflected instantly in all other clones.
However, Leo's users often request a vague enhancement informally known as
"half clones." We can make this ill-defined notion precise by saying that
we often want to treat clones differently depending on *context*, the *Position
*of that clone within the entire outline.
It's easy to use positions to tailor the handling of each node. Something
like this:
for p in c.all_positions():
parent = p.parent()
if not parent:
continue
sib1 = p.next()
sib2 = sib1 and sib1.next()
case1 = sib1 and parent.h == 'context1' and sib1.h == 'y'
case2 = sib2 and parent.h == 'context2' and
sib2.b.startswith('@foo')
if case1:
<< handle case 1 >>
elif case2:
<< handle case 2 >>
*Summary*
I got a bit annoyed at the pickiness of some of the suggestions, but in
retrospect they were spot on.
Illustrating how to use the context of potentially cloned nodes is worth
any amount of work. The example above is a template for tailoring (cutting,
pasting, modifying) snippets of documentation that appear in different
*documentation* contexts. This is a challenge posed by Kent Tenney many
years ago.
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 view this discussion visit
https://groups.google.com/d/msgid/leo-editor/6a82af65-853b-4939-90a2-720beaffff4cn%40googlegroups.com.