[pywikibot] f strings and regexes

2023-02-02 Thread BinĂ¡ris
https://www.mediawiki.org/wiki/Manual:Pywikibot/Development/Guidelines#Miscellaneous says: " Prefer f-strings over string.format(). Modulo operator % for string formatting should be avoided." I tried to rewrite a modulo-formatted regex to f-string, but than realized, that in f-strings all curly

[pywikibot] Text between two comments?

2023-02-02 Thread Roy Smith
I'm trying to parse DYK prep area templates, for example Template:Did you know/Preparation area 3 . Unfortunately, these are more like flat text files than any kind of nicely structured data. The stuff of interest is

[pywikibot] Re: Text between two comments?

2023-02-02 Thread JJMC89
For similar cases, I have used a regex to find the part marked by comments and then parse the part between. START_END = re.compile(r"^(.*?)(.*?)(.*)$", flags=re.I | re.S) m = START_END.search(page.text) wikicode = mwparserfromhell.parse(m.group(2)) # do stuff with wikicode You may be able to

[pywikibot] Re: Text between two comments?

2023-02-02 Thread Roy Smith
Thanks. Sadly, I think treating this as flat text will end up being the most straight-forward way to do it. > On Feb 2, 2023, at 7:03 PM, JJMC89 wrote: > > For similar cases, I have used a regex to find the part marked by comments > and then parse the part between. > > START_END = >

[pywikibot] Re: Text between two comments?

2023-02-02 Thread John
When I was parsing similar text, I did a .split on the header part and parsed the sections On Thu, Feb 2, 2023 at 7:26 PM Roy Smith wrote: > Thanks. > > Sadly, I think treating this as flat text will end up being the most > straight-forward way to do it. > > > > On Feb 2, 2023, at 7:03 PM,

[Pywikibot-commits] [Gerrit] ...i18n[master]: Localisation updates from https://translatewiki.net.

2023-02-02 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/886018 ) Change subject: Localisation updates from https://translatewiki.net. .. Localisation updates from https://translatewiki.net.