Module:TOC001
| This module depends on the following other modules: |
| Related pages |
|---|
| Module:TOC001 |
About
This TOC is meant for numbered lists of minor planets with 1000 entries, namely the List of minor planets and Meanings of minor planet names series.
To be functional for long lists, the list page must have anchors named "001", "101", "201", ..., "901". In a table, this can be done by adding id="001" to a cell's parameters. Outside of a table, this can be done by adding {{Anchor|001}}.
If a list contains only several entries (i.e. for pages containing minor planets numbered above 100,000), this TOC may still be used to navigate ± 5,000 entries in either direction, which is larger than {{MinorPlanetNameMeaningsFooter}}'s succession-box navigation of ± 1,000.
Usage
{{TOC001}}
See also
External link templates for minor planets
- {{AstDys}}
- {{DoMP}}
- {{ESA-SSA}}
- {{JA-BIN}}
- {{JPL}}
- {{JPL small body}}
- {{JPL+CAD}} (two links: JPL main page & "close approach data" section)
- {{LCDB}}
- {{Minor Planet Center}}
- {{NeoDys}}
- {{M+J}} (combines MPC & JPL templates)
- {{WGSBNB}} (bulletin of IAU's WGSBN)
Local link templates for minor planets and on related topics
- {{Minor planet list link}}
- {{Minor planet meaning link}}
- {{Obscode}} (observatory code)
- {{LoMP+M+J}} (combines LoMP, MPC, and JPL templates)
- {{Minor planets navigator}} (footer navbox in articles)
Link templates on Solar System features
Partial list templates (minor planets/meanings/named-MPs)
- Header
- {{List of minor planets/intro}} (/core) (LoMP lead)
- {{MinorPlanetNameMeaningsDisclaimer}} (MoMP lead)
- {{TOC001}} (LoMP & MoMP page navigation)
- {{TOC LONMP}} (LoNMP alphabetical navigation)
- {{TOC LONMP2}} (LoNMP numerical navigation)
- {{List of named minor planets by number header}} (LoNMP lead)
- {{List of named minor planets by letter header}} (LoNMP lead)
- Body
- {{List of minor planets/header2}} (LoMP wikitable)
- {{MinorPlanetNameMeaningsTableHeader}} (MoMP wikitable)
- {{List of unnumbered minor planets header}} (LoUMP wikitable)
- {{List of minor planets interloper}} (LoMP wikitable)
- {{Meanings of minor planet names description available}} (MoMP aid)
- Footer
- {{List of minor planets/See also}} (LoMP)
- {{MinorPlanetNameMeanings/See also}} (MoMP)
- {{List of minor planets/footer}} (LoMP prev–next)
- {{MinorPlanetNameMeaningsFooter}} (/core) (MoMP prev–next)
- {{List of minor planets}} (LoMP collapsed navbox)
- {{Meanings of minor-planet names}} (MoMP collapsed navbox)
local p = {}
function p.TOC001( frame )
local title = mw.title.getCurrentTitle()
local pn = title.text
local pagebase = mw.ustring.match(pn, '^(List of minor planets: )%d') or
mw.ustring.match(pn, '^(Meanings of minor.planet names: )%d') or
'testcase'
local parent_from = mw.ustring.match(pn, '(%d+)–') or 0 --en dash; 1, 1001, 2001, ...
local prefix = (parent_from - 1)/1000 --0, 1, 2, ...
local left = parent_from - 5000 --left-most navigational 'from'; floor = 1
local hlist, anchor
local m, nav_upper, nav_lower = '', '', ''
--testcase prep
if pagebase == 'testcase' then --obsolete parameters allowed only on non-LoMP|MoMP pages
local args = frame:getParent().args
if mw.ustring.match(pn, '(TOC001)') or
mw.ustring.match(pn, '(MinorPlanetListFooter)')
then
args.prefix = 1
end
if args.prefix then
prefix = args.prefix
if prefix == 0 then parent_from = 1
else parent_from = prefix..'001' end
left = parent_from - 5000
if args.meanings then
pagebase = 'Meanings of minor-planet names: '
else
pagebase = 'List of minor planets: '
end
else
return '{{[[Template:TOC001|TOC001]]}} requires a <code>|prefix=</code> outside of [[LoMP]]/[[MoMP]]-space.'
end
end
--hlist
if pagebase == 'List of minor planets: ' then
hlist = frame:expandTemplate{
title = 'Hlist',
args = {
'[[LoMP#Main index|Index]]',
'[[LoMP#100k|100k]]',
'[[LoMP#200k|200k]]',
'[[LoMP#300k|300k]]',
'[[LoMP#400k|400k]]',
'[[LoMP#500k|500k]]',
'[[LoMP#600k|600k]]',
'[[LoMP#700k|700k]]',
'[[LoMP#800k|800k]]',
'[[List of minor planets#Orbital groups|color code]]',
}
}
else --MoMP
m = 'm'
hlist = frame:expandTemplate{
title = 'Hlist',
args = {
'[[MoMP#Index|Index]]',
'[[MoMP#100k|100k]]',
'[[MoMP#200k|200k]]',
'[[MoMP#300k|300k]]',
'[[MoMP#400k|400k]]',
'[[MoMP#500k|500k]]',
'[[MoMP#600k|600k]]',
'[[MoMP#700k|700k]]',
'[[MoMP#800k|800k]]',
}
}
end
--TOC top
local TOC_top = frame:expandTemplate{
title = 'TOC top',
args = {
align = 'center',
title = '<div style="background-color: var(--background-color-interactive, #eaecf0); color: inherit; margin-bottom: 8px; padding: 2px;">'..
hlist..
'</div>'
}
}
--nav_upper
if left < 1 then left = 1 end
local i = 0
while i <= 10 do
local from = left + 1000*i
local to = left-1 + 1000*(i+1)
local sep = '-'
pagebase = string.gsub(pagebase, '(minor).(planet names)', '%1'..sep..'%2')
nav_upper = nav_upper..'\n* [['..pagebase..from..'–'..to..'|'..
mw.getContentLanguage():formatNum(from - 1)..'s]]'
i = i + 1
end
--nav_lower
i = 0
while i <= 9 do
anchor = i..'01' --001, 002, ...
nav_lower = nav_lower..'\n* [[#'..m..anchor..'|'..
mw.getContentLanguage():formatNum(tonumber(prefix..anchor))..'…]]'
i = i + 1
end
--cleanup nav_ for lowest numbered pages (do this once after the whiles, instead of conditionals inside)
nav_upper = string.gsub(nav_upper, '|0s]]', '|1–1000]]')
nav_lower = string.gsub(nav_lower, '|001…]]', '|1–100]]')
--TOC bottom
local TOC_bottom = frame:expandTemplate{ title = 'TOC bottom', args = {} }
--concat all
return TOC_top..nav_upper..'\n<hr />\n<div style="text-align: center">'..nav_lower..'\n</div>'..TOC_bottom
end
return p
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.