Thank you for this :-)
I realize that @nosent is nontraditional. I'd be happy to use @adoc or
@md but I currently don't know of a way to identify nodes that aren't
section headlines.Once the outline is too deep then the doc fails  :-/
 Nosent doesn't write the headlines so it makes this possible but I
agree that it's not very elegant. 



On Fri, 2020-09-04 at 02:52 -0700, vitalije wrote:
> > My tentative conclusion is that there may be a bug in
> > fc.retrieveVnodesFromDb. However, there are no special cases in
> > this code, so what the bug could possibly be is a big mystery.
> > Iirc, Vitalije wrote this code. Any insights would be appreciated.
> > 
> 
> I am almost 100% sure that the fc.retrieveVnodesFromDb works
> correctly. It just restores outline from the rows retrieved from db.
> Saving and loading from db work in tandem. If the outline being saved
> has broken links, then the outline loaded afterwards will have broken
> links too.
> 
> Most likely outline got broken links during some modification and
> later was saved as such.
> 
> Here is a script that can fix broken links:
> from collections import defaultdict
> def relink_outline(c):
>     '''Normalizes outline fixing broken links'''
>     parDict = defaultdict(list)
>     for p in c.all_positions():
>         parDict[p.gnx].append(p._parentVnode())
>     gnx2v = c.fileCommands.gnxDict
>     for gnx, parents in parDict.items():
>         v = gnx2v[gnx]
>         v.parents = parents
>     c.checkOutline()
> relink_outline(c)
> 
> When saving to xml information about parent links is omitted. When
> loading from xml file, correct parent links are infered again.
> Perhaps I can change writing to db to omitt parent links and just
> infer them when loading from db.
> 
> It is still a mistery how k-hen got his outline to this invalid
> state. My guess is that it was caused during the updating clones in
> both @file files and @nosent files. That would explain why we haven't
> noticed this bug before. It is not very common to have shared clones
> in both @nosent and @file files.
> 
> Vitalije
> 
> 
> 
> 
> -- 
> 
> You received this message because you are subscribed to a topic in
> the Google Groups "leo-editor" group.
> 
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/leo-editor/sANduRjZDVI/unsubscribe.
> 
> To unsubscribe from this group and all its topics, send an email to 
> [email protected].
> 
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/leo-editor/56aa7952-a09d-4da5-b176-206916448e26o%40googlegroups.com
> .
> 

-- 
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 on the web visit 
https://groups.google.com/d/msgid/leo-editor/493fbb4b8cbce30123b45166e2a2a63a8103b3dd.camel%40gmail.com.

Reply via email to