Thank you! :-)
info@gno.de ezt írta (időpont: 2024. jan. 15., H, 9:23):
textlib.replaceCategoryLinks() with add_only=True should do the job.
Best
xqt
Von meinem iPhone gesendet
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:
https://doc.wikimedia.org/pywikibot/master/_modules/scripts/category.html#Ca...
You can also use textlib for manipulating templates.
Best xqt
Von meinem iPhone gesendet
Am 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.repl... .
Thanks, Ethan
On Tue, Jan 2, 2024 at 11:45 PM Bináris wikiposta@gmail.com wrote:
At https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.page.html 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/me... 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/me... 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/me... 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/me... 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/me... 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/me... To unsubscribe send an email to pywikibot-leave@lists.wikimedia.org