Thank you! :-)

<i...@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 <phoenixoverr...@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 <i...@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#CategoryAddBot
>>
>> You can also use textlib for manipulating templates.
>>
>> Best
>> xqt
>>
>> Von meinem iPhone gesendet
>>
>> Am 03.01.2024 um 21:02 schrieb Bináris <wikipo...@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. <enag2...@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 <wikipo...@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/message/YONEOOAH3N2SCACV2Q7QMQGOS3CNBFJA/
>>>> To unsubscribe send an email to pywikibot-le...@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-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/FDJHJJQQQGZHMXA22EHIM5T7B4A3IFCR/
>> To unsubscribe send an email to pywikibot-le...@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-le...@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-le...@lists.wikimedia.org
>
> _______________________________________________
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/4SO7UIDITXIST7AT4Z2GBTW5CEDYFYBZ/
> 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/IDB7JIMGWLY7ZRGRPVRZOI7BH2NOHOU2/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org

Reply via email to