Editing
Module:Penis size cm
Jump to navigation
Jump to search
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 p = {} local function toInches(cm) return cm / 2.54 end local function toCentimeters(inches) return inches * 2.54 end local function formatNumber(value) value = math.floor(value * 10 + 0.5) / 10 return value % 1 == 0 and string.format("%.0f", value) or string.format("%.1f", value) end local function formatLink(category, value, unit) return string.format('[[:Category:Penis size %s %s|%s %s]]', value, unit, value, unit) end local function applyOption(value, option, tag) return (option == "yes" or option == "y") and string.format(tag, value) or value end function p.main(frame) local input = frame.args[1] or "" local categoryOption = frame.args["category"] or "yes" local breakOption = frame.args["break"] or "no" local linkspanOption = frame.args["linkspan"] or "no" input = string.lower(input:gsub("%s+", "")):gsub(",", ".") local cm, inches if string.match(input, "in$") or string.match(input, "inches$") then inches = tonumber(string.match(input, "%d+%.?%d*")) cm = toCentimeters(inches) else cm = tonumber(string.match(input, "%d+%.?%d*")) if cm == nil then return "" end inches = toInches(cm) end local formattedCm = formatNumber(cm) local formattedInches = formatNumber(inches) local linkCm = formatLink("cm", formattedCm, "cm") local linkInches = formatLink("inches", formattedInches, "in") linkCm = applyOption(linkCm, linkspanOption, '<span class="white-link">%s</span>') linkInches = applyOption(linkInches, linkspanOption, '<span class="white-link">%s</span>') local breakTag = applyOption("", breakOption, "<br>") if categoryOption == "no" then return linkCm .. breakTag .. " (" .. linkInches .. ")" elseif mw.title.getCurrentTitle().namespace == 0 then return "[[Category:Penis size " .. formattedCm .. " cm]]" .. linkCm .. breakTag .. " (" .. linkInches .. ")" .. "[[Category:Penis size " .. formattedInches .. " inches]]" else return linkCm .. breakTag .. " (" .. linkInches .. ")" end end return p
Summary:
Please note that all contributions to Porn Base Central 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
Porn Base Central:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Template used on this page:
Module:Penis size cm/doc
(
view source
)
Navigation menu
Personal tools
English
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Module
Discussion
English
Views
Read
Edit source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Upload file
Special pages
Page information