On Jun 2, 4:36 am, thyrsus <sschae...@acm.org> wrote: > Huh? > > There's a fair amount of logic in the @root tangle code to allow or > disallow multiple parts to a section definition. > > It makes sense that when encountering a section reference (i.e., a > point at which a section is to be interpolated) that you shouldn't at > that point be in the midst of defining the contents of that section, > lest interpolation of the section include itself ad infinitum. If > that's the point, the error message could be much clearer. > > But I don't believe that's what's happening. My test @root node, > which is failing with this error, is supplied at the end of this > message; please help me understand why it is supposed to be invalid. > Thanks, > > - Stephen > > <?xml version="1.0" encoding="utf-8"?> > <?xml-stylesheet ekr_test?> > <leo_file> > <leo_header file_format="2"/> > <vnodes> > <v t="sps.20100602001344.9941" a="E"><vh>#...@root</vh> > <v t="sps.20100602001344.9942"><vh>secref >>= definition</vh></ > v> > <v t="sps.20100602001344.9943"><vh><< secref >></vh></v> > </v> > </vnodes> > <tnodes> > <t tx="sps.20100602001344.9941">A comment to ignore > > @root-code 'root-test' > > # A simple test of @root-code. > << secref >> > @ > ignored documentation > </t> > <t tx="sps.20100602001344.9942"> > << secref >>= > abc</t> > <t tx="sps.20100602001344.9943">ignored comment > @c > xyz > > </t> > </tnodes> > </leo_file>
Concerning "Multiple parts not allowed": Having contemplated the code carefully, I now think I can summarize in English what is happening, speculate about what was supposed to happen, and propose what, to me, is a less surprising behavior. What the code does: ------------------- If a headline contains << section foo >> any code part in this node body must be the first encountered code part for << section foo >> multiple @c parts and << section foo >>= parts may occur in the same node body in subsequently encountered node bodies, << section foo >>= parts may extend the definition of section foo the "first encountered code part" rule means no two nodes may both have headline << section foo >> If a headline does not contain << section foo >> the node body may contain << section foo >>= to add code parts to section foo In any node, << section foo >>= may add code parts for section foo, regardless of how the first part of section foo was defined. What I believe the code intended: --------------------------------- The body of a section using a headline << section foo >> be the one and only place that code parts for the definition of section foo, and that one and only one of the "<< section foo >> headline + @c body" or "<< section foo >>= body" mechanisms be used to define sections. The behavior I would find less surprising: ------------------------------------------ << section foo >> headline + @c body add parts to the definition of section foo in the same way that body << section foo >>= adds to the body of section foo. ======================= Am I missing something? I've got unit tests that seem to confirm my interpretation of the present code's behavior. Is there historical justification in CWEB or noweb for the current behavior? For what I am guessing is the intended behavior? Is there an argument that the current behavior or what I speculate is the intended behavior is somehow more elegant or flexible? What downside would there be to changing the code to behave in the manner I find "less surprising"? -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To post to this group, send email to leo-edi...@googlegroups.com. To unsubscribe from this group, send email to leo-editor+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en.