from pywikibot.textlib import removeDisabledParts print(removeDisabledParts(text))
This makes something similar, but just the noinclude tag is not included. Bot if you follow the source from https://doc.wikimedia.org/pywikibot/master/api_ref/textlib.html#textlib.removeDisabledParts, you can adapt it. Alternatively, you could use re.sub(). Roy Smith <r...@panix.com> ezt írta (időpont: 2023. febr. 4., Szo, 20:34): > [[:en:Template:Did you know/Queue/NextPrep]] contains: > > > 4<noinclude> <!-- There is no Prep 8! --> > > {{documentation|content=This number indicates the next DYK prep set to > move into the queue.}} > > </noinclude> > > What I want to get is just the "4". Is Page.extract() what I'm looking > for? Experimentally, it does what I want, but it's not clear if this is > actually the intended use case. > > _______________________________________________ > pywikibot mailing list -- pywikibot@lists.wikimedia.org > Public archives at > https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/G5Z3TPTY3QFPZALSCVW7ZVTXJ7ZTZ5BC/ > To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org > -- Bináris
_______________________________________________ pywikibot mailing list -- pywikibot@lists.wikimedia.org Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/4QLMCKCZX2LLZ5NHZRTDB3HONSYA56R4/ To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org