“Module:Portal bar”与“Module:Portal bar/sandbox”:页面之间的差异
外观
(页面间差异)
删除的内容 添加的内容
Xiplus-abot(留言 | 贡献) 小 已更改“Module:Portal bar”的保护等级:高風險模板:8077引用<!-- 機器人3 -->([编辑=仅允许模板编辑员和管理员](无限期)[移动=仅允许模板编辑员和管理员](无限期)) |
小 strict |
||
第1行: | 第1行: | ||
-- This module implements {{portal bar}}. |
-- This module implements {{portal bar}}. |
||
require(' |
require('') |
||
local p = {} |
local p = {} |
||
第7行: | 第7行: | ||
local getImageName = require( 'Module:Portal' ).image |
local getImageName = require( 'Module:Portal' ).image |
||
local yesno = require( 'Module:Yesno' ) |
local yesno = require( 'Module:Yesno' ) |
||
local localEnglish = require( 'Module:Portal/english' ) |
|||
-- Builds the portal bar used by {{portal bar}}. |
-- Builds the portal bar used by {{portal bar}}. |
||
第51行: | 第52行: | ||
end |
end |
||
function p._categories( portals ) |
|||
local existEn = false |
|||
for _, portal in ipairs(portals) do |
|||
local pl = mw.ustring.lower(portal) |
|||
if mw.ustring.find(pl, '^[a-z]+$') and localEnglish[pl] == nil then |
|||
existEn = true |
|||
end |
|||
end |
|||
local categories = '' |
|||
if existEn then |
|||
categories = categories .. '[[Category:Portal模板使用英文參數]]' |
|||
end |
|||
return categories |
|||
end |
|||
-- Processes external arguments and sends them to the other functions. |
-- Processes external arguments and sends them to the other functions. |
||
function p.main( frame ) |
function p.main( frame ) |
||
第88行: | 第106行: | ||
portals[ i ] = mw.text.trim( origArgs[ v ] ) -- Swap keys with values, trimming whitespace. |
portals[ i ] = mw.text.trim( origArgs[ v ] ) -- Swap keys with values, trimming whitespace. |
||
end |
end |
||
return p._main( portals, args ) |
return p._main( portals, args ) |
||
end |
end |
||