Am 04.01.2024 um 13:49 schrieb John <phoenixoverride@gmail.com>:
I use a combination of getCategoryLinks() and then replaceCategoryLinks() it updates them in place, or adds them where needed._______________________________________________On Thu, Jan 4, 2024 at 2:58 AM <info@gno.de> wrote:Hi,_______________________________________________to add a category to several pages, category script can be used. For implementing a function or method, its treat method can be used as templet:You can also use textlib for manipulating templates.BestxqtVon meinem iPhone gesendetAm 03.01.2024 um 21:02 schrieb Bináris <wikiposta@gmail.com>:Thank you! At the end,I wrote to the end. We must care if there is already a \n ath end or not.Ethan N. <enag2000@gmail.com> ezt írta (időpont: 2024. jan. 3., Sze, 18:47):Bináris,
A nice function for this does not currently exist for Page class. See https://phabricator.wikimedia.org/T325420.I am working on this one so it is in progress. Hopefully this weekend I will finish the initial version of the changes and start the review process. There are several workarounds, one of which is adding to end of text, which you mentioned already. One other workaround is to use textlib.replaceCategoryLinks(). See https://doc.wikimedia.org/pywikibot/master/api_ref/textlib.html#textlib.replaceCategoryLinks.Thanks,Ethan_______________________________________________On Tue, Jan 2, 2024 at 11:45 PM Bináris <wikiposta@gmail.com> wrote:_______________________________________________I only find change_category which requires the old cat to be removed present.But how do I just add a new one w/o changing?OK, I can add it to the end of text, but that is not nice.
--Bináris
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/YONEOOAH3N2SCACV2Q7QMQGOS3CNBFJA/
To unsubscribe send an email to pywikibot-leave@lists.wikimedia.org
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/OQZ64BNMCU6W5NC2LMXTC74ZAFNS5YLB/
To unsubscribe send an email to pywikibot-leave@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/FDJHJJQQQGZHMXA22EHIM5T7B4A3IFCR/
To unsubscribe send an email to pywikibot-leave@lists.wikimedia.org
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/CLHYEALKJVITDYSUTPVSBGKN7PXTZLXY/
To unsubscribe send an email to pywikibot-leave@lists.wikimedia.org
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/MVEZD62WRZRTBKGRANEH52LIJIBXAHBJ/
To unsubscribe send an email to pywikibot-leave@lists.wikimedia.org