Module talk:Convert: Difference between revisions

Content deleted Content added
Line 57:
Module doesn't have a fraction slash in pattern that look for floats. I added proposed change to the sanbox of the module. (It only affects in wikis that uses varname. I have already fixed it in ukwiki, but I propose my changes here aswell to make it synchronized with enwiki module.) [[User:Repakr|Repakr]] ([[User talk:Repakr|talk]]) 15:28, 27 August 2025 (UTC)
:I'll have a look a little later. We batch changes to convert so it might take a while. I'm afraid I had forgotten about our discussion at ukwiki, life got in the way. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 02:48, 28 August 2025 (UTC)
::{{ping|Repakr}} I see the change is very straightforward and, as you say, only affects sites like ukwiki which use variable names. However, <code>clean:match('[./⁄]')</code> is not correct. The fraction slash is a Unicode character which is encoded in UTF-8 here. It is three hex bytes: E2 81 84. That regex is fast because it uses Lua's built-in and simplistic procedure, namely it looks only at the bytes, not the characters. It would match anything with a dot or a slash, but also anything with the byte E2, or byte 81, or byte 84. That might be good enough for typical wikitext but I'll think about adding something with Lua's <code>find</code> or <code>mw.ustring.match</code>. Using ustring is much slower because it uses Lua code to emulate Lua's compiled-C regex—an amazing accomplishment. However, that might be simplest and very adequate. Module:Convert defines ustring = mw.ustring so the replacement would be <code>ustring.match(clean, '[./⁄]')</code>. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 06:00, 28 August 2025 (UTC)