Anonymous
Not logged in
Talk
Contributions
Create account
Log in
Posmotrishka
Search
Editing
Module talk
:
InfoboxImage
(section)
From Posmotrishka
Namespaces
Module
Discussion
More
More
Page actions
Read
Edit source
New topic
History
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== 1. Core Module Optimization ([[Module:InfoboxImage/sandbox]]) === * '''File Namespace Caching (Performance):''' The current production code queries and rebuilds the file namespace aliases table via `mw.site.namespaces[6]` twice on ''every single invocation'' (once inside `IsPlaceholder` and again in the main function body). On long pages or transclusions, this creates unnecessary overhead. The proposed version builds this namespace cache list exactly once at the top-level scope during the initial module load. * '''Redundant Code & Asserts Cleanup:''' Removed several `assert(image ~= nil)` checks right after `mw.ustring.gsub`. In the Scribunto environment, these standard string operations never return `nil` when provided with valid string inputs, meaning these assertions were purely redundant and polluting the code logic. * '''Namespace Stripping Helper:''' Unified the file prefix stripping logic into a streamlined internal helper function `stripNamespace`, reducing code duplication between functions.
Summary:
Please note that all contributions to Posmotrishka may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
BetaPolCraft Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Save changes
Show preview
Show changes
Cancel
Editing help
(opens in new window)
Navigation
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Wiki tools
Wiki tools
Page tools
Page tools
User page tools
More
What links here
Related changes
Page information
Page logs