Sửa đổi Mô đun:Autotaxobox
Chú ý: Bạn chưa đăng nhập và địa chỉ IP của bạn sẽ hiển thị công khai khi lưu các sửa đổi.
Bạn có thể tham gia như người biên soạn chuyên nghiệp và lâu dài ở Bách khoa Toàn thư Việt Nam, bằng cách đăng ký và đăng nhập - IP của bạn sẽ không bị công khai và có thêm nhiều lợi ích khác.
Các sửa đổi có thể được lùi lại. Xin hãy kiểm tra phần so sánh bên dưới để xác nhận lại những gì bạn muốn làm, sau đó lưu thay đổi ở dưới để hoàn tất việc lùi lại sửa đổi.
Bản hiện tại | Nội dung bạn nhập | ||
Dòng 88: | Dòng 88: | ||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =]] | = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =]] | ||
function l.topLevelTaxon(taxon) | function l.topLevelTaxon(taxon) | ||
− | return taxon == ' | + | return taxon == 'Life' or taxon == 'Veterovata' or taxon == 'Ichnos' |
end | end | ||
Dòng 156: | Dòng 156: | ||
elseif mw.title.new('Taxonomy/'..taxon, 'Template').exists then | elseif mw.title.new('Taxonomy/'..taxon, 'Template').exists then | ||
-- taxonomy template for this taxon has no parent specified | -- taxonomy template for this taxon has no parent specified | ||
− | return frame:expandTemplate{ title = 'Template:Create taxonomy', args = {taxon, msg=' | + | return frame:expandTemplate{ title = 'Template:Create taxonomy', args = {taxon, msg='Taxonomy template does not specify a parent'} } .. '\n' .. TableRow |
else | else | ||
-- no taxonomy template for this taxon | -- no taxonomy template for this taxon | ||
− | return frame:expandTemplate{ title = 'Template:Create taxonomy', args = {taxon, msg=' | + | return frame:expandTemplate{ title = 'Template:Create taxonomy', args = {taxon, msg='Missing taxonomy template'} } .. '\n' .. TableRow |
end | end | ||
else | else | ||
Dòng 193: | Dòng 193: | ||
local currTaxon = frame.args[1] or '' | local currTaxon = frame.args[1] or '' | ||
if currTaxon == '' then | if currTaxon == '' then | ||
− | return '{|class="infobox biota"\n' .. TableRow .. l.tableCell('') .. l.tableCell(' | + | return '{|class="infobox biota"\n' .. TableRow .. l.tableCell('') .. l.tableCell('ERROR: no taxon supplied') .. TableEnd |
end | end | ||
local taxonTable, taxonRankTable = l.makeTable(frame, currTaxon) | local taxonTable, taxonRankTable = l.makeTable(frame, currTaxon) | ||
Dòng 213: | Dòng 213: | ||
end | end | ||
-- add information message | -- add information message | ||
− | local res = '<p style="float:right"> | + | local res = '<p style="float:right">Bold ranks show taxa that will be shown in taxoboxes<br>because rank is principal or <code>always_display=yes</code>.</p>\n' |
-- start table | -- start table | ||
res = res .. '{| class="infobox biota" style="text-align: left; font-size:100%"\n' .. TableRow .. '! colspan=4 style="text-align: center; background-color: ' | res = res .. '{| class="infobox biota" style="text-align: left; font-size:100%"\n' .. TableRow .. '! colspan=4 style="text-align: center; background-color: ' | ||
− | .. taxoColour .. '"| | + | .. taxoColour .. '"|Ancestral taxa\n' |
-- deal first with the top level taxon; if there are no errors, it should be Life/Veterovata/Ichnos, which are | -- deal first with the top level taxon; if there are no errors, it should be Life/Veterovata/Ichnos, which are | ||
-- not displayed | -- not displayed | ||
local taxon = taxonTable[taxonTable.n] | local taxon = taxonTable[taxonTable.n] | ||
if not l.topLevelTaxon(taxon) then | if not l.topLevelTaxon(taxon) then | ||
− | local msg = ' | + | local msg = 'Taxonomy template missing' |
if mw.title.new('Taxonomy/'..taxon, 'Template').exists then | if mw.title.new('Taxonomy/'..taxon, 'Template').exists then | ||
− | msg = ' | + | msg = 'Parent taxon needed' |
end | end | ||
res = res .. TableRow .. l.tableCell('colspan=2', frame:expandTemplate{title = 'Template:Create taxonomy', args = {taxon, msg = msg}}) | res = res .. TableRow .. l.tableCell('colspan=2', frame:expandTemplate{title = 'Template:Create taxonomy', args = {taxon, msg = msg}}) |