[pywikibot] Re: How to avoid leaving extra blank lines when removing templates?

2023-03-22 Thread BinĂ¡ris
Biking is great and sometimes hard to begin when the other option is coding. :-) My approach would be to import template.py as a module which is able to do the work. Now I see, it has everything in __init__, so not very flexible, and needs a page generator.

[pywikibot] Re: How to avoid leaving extra blank lines when removing templates?

2023-03-21 Thread Roy Smith
Today was a beautiful early spring day here in New York (my apologies to those of you in the "winter is approaching" hemisphere) so I decided to move away from the keyboard and went out for a bike ride. Along the way, I pretty much came to the same conclusion, and now that I'm back, it's nice

[pywikibot] Re: How to avoid leaving extra blank lines when removing templates?

2023-03-21 Thread William Avery
One could use a plain filter() to iterate over all the nodes, and test each, to see if it is the template that you want to delete. Having detected the template you want to delete, set a flag, and delete following text nodes, until the next template node is detected. On Tue, 21 Mar 2023, 18:28 Roy