Module:Meanings of minor-planet names index element
Appearance
This module depends on the following other modules: |
Due to a server limit of 500 "expensive parser function" calls (e.g. #ifexist:, PAGESIZE:, and PAGESINCATEGORY:), this module will only work properly if the page using it has not already exceeded the limit. When the limit is exceeded, the page using this template or module is categorised in Category:Pages with too many expensive parser function calls. (further information) |
About
[edit]This template and module are used to help semi-automate maintenance on Meanings of minor-planet names#Index. Index elements are automatically stylized based on their redirect status.
An expensive function is used to check redirect status, so this template must not be used on more than 500 elements on the same page.
Usage
[edit]For an index element pointing to Meanings of minor planet names: 699001–700000, use
{{MoMP index element|699001}}
See also
[edit]- {{List of minor planets index element}}
- {{LoMP}}
- {{MoMP}}
local p = {}
function p.page( frame )
local args = frame:getParent().args
local mompnum_from = args[1] or 1001
local mompnum_to = mompnum_from + 999
local mompnum_k = math.floor( (mompnum_from - 1)/1000 )
local momp = 'Meanings of minor planet names: '..mompnum_from..'–'..mompnum_to --en dash
local title = mw.title.new(momp)
local pre = ''
local mid = '[['..momp..'|'
local large = frame:expandTemplate{ title = 'Large', args = { mompnum_k } }
local small = frame:expandTemplate{ title = 'Small', args = { ',001' } }
local post = large..small --i.e. '{{Large|'..mompnum_k..'}}{{Small|,001}}'
if title.isRedirect then
pre = 'style="background-color:#e2e2e2" | '
local color = frame:expandTemplate{ title = 'Color', args = { '#999', post } }
post = color --i.e. '{{Color|#999|'..post..'}}'
end
return pre..mid..post..']]'
end
return p