After using a leo script_A to convert a list of lines into separate nodes for each line of p.b.
I have a script_B that reads child nodes, and copies all the body text lines back to the parent. It is based on @button promote-child-bodies, from LeoDocs.
result = [p.b]
b = c.undoer.beforeChangeNodeContents(p)
for child in p.children():
result.append(f'{child.b}' ) # copy body only
p.b = ''.join(result)
c.undoer.afterChangeNodeContents(p,'promote-child-bodies',b)Here is a sample of CSV to which I apply the script_A, creating 3 nodes
"Model", "C1", "C2", "C3"
"CSM1", 20, 40, 50
"CSM2", 30, 45, 60
After manually adding a fourth node, containing body text: "CSM3", 40, 55, 70
I run script_B which reads the new node and adds the new body text but it is not on a new line.
"Model", "C1", "C2", "C3"
"CSM1", 20, 40, 50
"CSM2", 30, 45, 60"CSM3", 40, 55, 70
Is it possible that when the nodes are created with script_A, hidden characters are added? I tried using show-invisibles but I only see spaces. Using /n adds new blank lines between all and is not suitable.
Any ideas on how to move it to the next line?
Regards
Lewis