Module talk:Delink: Difference between revisions

Content deleted Content added
Zebulon84 (talk | contribs)
No edit summary
Line 16:
::I'd be glad to know the regressions. I've tried to deep the same result, except when I notice Mediawiki did not give the same result the delink function. My goal was to have the same text as seen on screen (even if there is brackets).
::[[User:Zebulon84|Zebulon84]] ([[User talk:Zebulon84|talk]]) 19:56, 17 April 2014 (UTC)
 
:::You can see the regressions in the test cases ([[Module talk:Delink/testcases]]). Not all of those tests pass with the main module, though, so beware. As for when to use the string library instead of the mw.ustring library, I got [https://en.wikipedia.org/w/index.php?title=Wikipedia_talk:Lua&diff=594064888&oldid=593972746 this very helpful reply] by Anomie in February which made things much clearer for me. Basically, if we are only looking for ASCII text, then we should be fine to use the Lua string library functions. Also, another thing which can make things faster is to anchor your patterns where possible. For example, inside the delinkWikilink function you were doing a gsub of the pattern '%[%[.-%]%]'. In this case we know that the end two brackets are at the end of the string, but Lua doesn't know this, so it checks every possible ___location of both the starting brackets and the ending brackets to see if there is a match. If we anchor the string like '%[%[.-%]%]$', then Lua only has to check every possible ___location of the starting brackets, which is a lot quicker. I'm also wondering if we could make things more efficient by splitting the wikilink up into a table of different parts before processing each part, but that plan is only in the early stages yet. I'll report back here when I have some results. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 12:11, 18 April 2014 (UTC)