On Wed, Dec 23, 2020 at 10:52:43PM -0600, Tim Chase wrote: > On 2020-12-23 22:34, John Cordes wrote: > > :g/^2 TYPE tngnote//2 NOTE /s/^2 NOTE \zs\(.*\n\(\%(\D\|3 CONC > > \).*\n\)\+\)/\='<div > > class="xxx">'.substitute(substitute(submatch(1), '\n3 CONC ', '', > > 'g'), '\n', '', 'g')."<\/div>\n" > > > > which as far as I can tell at the moment is working perfectly, > > handling all situations the way I wanted. > > The only glaring edge-case is a situation in which a "2 TYPE tngnote" > section is followed by *no* NOTE, followed by a section that *isn't* > a "2 TYPE tngnote" that *does* have a NOTE that shouldn't be touched > such as > > 2 TYPE tngnote > 9 TIM FAKE ANNOTATION this tngnote has no NOTE > 2 TYPE granola > 2 NOTE Don't touch granola-type notes or > 3 CONC rewrap their content or add <div>s! > > In such a case, it will wrap the NOTE even though it's in a different > TYPE that shouldn't be touched because it's the first NOTE after a "2 > TYPE tngnote", even though it's in a different section. > > So that's where I'd focus my checking :-) > > -tim
Thanks Tim. The GEDCOM file, exported from my desktop genealogy program TMG, *shouldn't* have a case like that (a tngnote tag which isn't followed by its own Note), but... Hey, it's produced by a large, complex, software program which is no longer supported and does have a few known bugs. So obviously one can never guarantee what will actually happen in practice. I will certainly keep a lookout for this edge case -- it would indeed lead to very undesirable results. Presumably I should be able to do a search for two successive "2 TYPE tngnote" entries which don't have an intervening "2 NOTE " tag. Not sure how, but I'll give it a try. :-) Thanks for the heads-up on this, John -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20201224145741.GB30109%40dal.ca.