I've got some code which is essentially:

>         wikicode = mwp.parse(self.page.get())
>         for node in wikicode.filter_templates(recursive=False, matches=title):
>             wikicode.remove(node)
>         self.page.text = str(wikicode)
>         self.page.save()


which works, but it leaves an extra blank line behind where the template used 
to be.  This is intended to be run on [[:en:Template talk:Did you 
know/Approved]], i.e. one template per line.

What's the best way to get rid of the blank lines?  I'm trying to avoid just 
running a regex replacement on the raw text because that's fragile, but maybe 
theres really no good alternative here?
_______________________________________________
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/SRJVFLJSSFFMAWE6HMNLUH6A2HO23SDX/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org

Reply via email to