Tim Hansinger <[email protected]> writes: > Here I am searching for the @start<XXX> blocks. > It will also match e.g. (where _ represents spaces or tabs): > @start<XXX>__ > > It will filter out the start-type (the XXX part) and then use this > start-type to get the exactly matching end-type (@end<XXX>) ... so > @end<ZZZ> would e.g. not match.
I see. Why not match the string exactly once, capturing everything before, within, and after startAAA and startBBB, and then check if the captured AAA equals BBB, as mentioned before? > We now use the positions of these start/end items to grab whatever is > BEFORE the @start<XXX> which I called in my code prologue, but it is > not the prologue that comes from header arguments... it could be > e.g. when someone writes a comment before @start<XXX>. It will also > extract the body in between and the epilogue (again this is not the > epilogue that comes from the header arguments... it is just > "stuff/text" that someone might have written after the @end<XXX> > block). > > I can through out/remove the pro and epi parts as we probably don't > need them, I just thought you wanted them in there which seems to have > been a misunderstanding. I see. That is actually not a bad idea! But, we must call it something else, like `pre-body' and `post-body', to avoid confusion. > Then the extracted body in between the @start<XXX> and @end<XXX> lines > (or the whole body if no matching @start/@end are found) is sent / > expanded by org-babel-expand-body:generic as it should. > > In the end we then simply put the single elements back together into > the final complete body... here I am just removing empty list items > before joining them so no unnecessary newlines are created if e.g. the > expanded-body is empty. > > So my code is not doing anything that is and rightfully should be done > by org-babel-expand-body:generic. My bad, I misread the code. On that topic, we need to refactor for readability, that is simplicity, starting by the removal of all `setq' and repeated `when'. > And you are correct, I should also rename wrapped-body to unwrapped-body. That was my mistake, BTW. Perhaps we could write `inner-body'? Rudy -- "Great minds discuss ideas; average minds discuss events; small minds discuss people." --- Anna Eleanor Roosevelt (1884-1962) Rudolf Adamkovič <[email protected]> [he/him] http://adamkovic.org
