Le dimanche 13 octobre 2013 19:55:49 UTC-7, Terry a écrit : There's no where to store them in the files generated by @auto, which are basically plain files. @shadow stores them in a separate database.
Well, even in plain text files they can be stored as comments. The headings are part of my documentation and I lose them in the @auto. But you actually want them to appear in the output file? Yup. I don't see any reason to lose my precious outline :) As you point out, it is pretty easy to generate the outline. I had not thought of simply moving the headline into the body as a comment (avoiding any directives and marking it so it can be updated). That seems simpler than my initial idea. The only tricky part is making sure the commenting string of my headline comment does not collide with @file comment string, since I might switch between @file and @nosent or @shadow. Thanks for the snippets; I will see if I can digest them and make a button as you suggest. Best, Bill Le dimanche 13 octobre 2013 19:55:49 UTC-7, Terry a écrit : > > On Sun, 13 Oct 2013 12:10:41 -0700 (PDT) > wgw <wgwi...@gmail.com <javascript:>> wrote: > > > Yes, that does seem like the solution, but is it possible to write that > > solution and then "attach" it to a new, user-defined directive, such as > > @autohead, which could then be used in place of @auto? > > > > In short, can the user create a new file output directives (to go along > > with @file, @auto, @nosent, etc) ? > > > > I just find it odd that we lose the headings in the @auto output. > > There's no where to store them in the files generated by @auto, which > are basically plain files. @shadow stores them in a separate database. > > But you actually want them to appear in the output file? > > I was curious how short a script could be to write a file (with > headings): > > open("/tmp/t.txt", 'w').write('\n'.join("%s\n%s"%(i.h, i.b) for i in > p.self_and_subtree())) > > open("/tmp/t.txt", 'w').write('\n'.join("%s%s\n%s"%(" > "*(i.level()-p.level()), i.h, i.b) for i in p.self_and_subtree())) > > without and with indentation, respectively. > > What I've done when I want the headlines to appear in the output, for > example in the R statistical language, is write it with @shadow, and > make a button to add / update the heading into the first row of each > body, so headline and body content are: > > find_mean > ### find_mean ##################################################### > > <code for finding mean> > > Here's that button code, but I'm not sure if it's working exactly > right, be careful. > > # insert / update headlines as comments in @nosent R code > for nd in p.self_and_subtree_iter(): > > if nd.h and nd.h[0] == '@' or nd.b and nd.b[0] == '@': > continue > > lines = nd.b.split('\n') > if lines[0].startswith('### '): > del lines[0] > if lines[0].strip(): > lines[0:0] = [""] > lines[0:0] = [ > "### %s %s" % (nd.h, "#"*(80-len(nd.h)-5)), > ] > > 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/groups/opt_out.