Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Bad title suggestion
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!
local getArgs = require("Module:Arguments").getArgs local p = {} function p.main(frame) local args = getArgs(frame) -- The invalid character, e.g. ">" or "}" local chr = args[1] -- The escaped bad title, e.g. "Foobar>" or "Foobar|text" local title = args[2] -- A pipe (|) as the invalid character is a special case; it is not -- escaped, so instead the module thinks it got two empty arguments -- and the title as the third argument. if chr == nil and title == nil then chr = "|" title = args[3] end if chr == nil or title == nil then return "" end -- Determine the suggested title by taking a prefix of the bad title -- up to the first invalid character. Only display the suggestion box -- if the page exists. local index = mw.ustring.find(title, mw.text.nowiki(chr), 1, true) if index == nil then return "" end local page = mw.title.new(mw.ustring.sub(title, 1, index - 1)) if page == nil or not page.exists then return "" end return '<div class="mw-parser-output">' .. frame:expandTemplate{ title = "Did you mean box", args = { page.fullText } } .. '</div>' end return p
Summary:
Please note that all contributions to Stockhub 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
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Did you mean box
(
edit
)
Template:Module other
(
edit
)
Template:Module rating
(
edit
)
Template:Ombox
(
edit
)
Template:Sandbox other
(
edit
)
Template:Tl
(
edit
)
Template:Used in system
(
edit
)
Module:Arguments
(
edit
)
Module:Bad title suggestion
(
edit
)
Module:Bad title suggestion/doc
(
edit
)
Module:Effective protection level
(
edit
)
Module:High-use
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:String
(
edit
)
Module:Transclusion count
(
edit
)
Module:Transclusion count/data/B
(
edit
)
Module:Yesno
(
edit
)