• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Difference between revisions of "Module:Pagename"

From Kancolle Wiki
Jump to navigation Jump to search
(Created page with "local Core = require('Module:Core') return { implicit = function(frame) local args = Core.getTemplateArgs(frame) return args.implicit.pagename end, ...")
 
m (5 revisions imported)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
local Core = require('Module:Core')
+
local getArgs = require('Module:GetArgs')
  
 
return {
 
return {
     implicit = function(frame)
+
     format = function(frame)
         local args = Core.getTemplateArgs(frame)
+
         local f1 = frame
         return args.implicit.pagename
+
        local f2 = f1 and f1:getParent()
    end,
+
        local f3 = f2 and f2:getParent()
    explicit = function(frame)
+
        local a1 = f1 and getArgs{ frame = f1 }
         local args = Core.getTemplateArgs(frame)
+
        local a2 = f2 and getArgs{ frame = f2 }
         return args.explicit.pagename
+
        local a3 = f3 and getArgs{ frame = f3 }
     end,
+
         local s1 = f1 and (f1:getTitle() .. ',' .. (a1 and a1.pagename or '-')) or '='
 +
        local s2 = f2 and (f2:getTitle() .. ',' .. (a2 and a2.pagename or '-')) or '='
 +
         local s3 = f3 and (f3:getTitle() .. ',' .. (a3 and a3.pagename or '-')) or '='
 +
         return s1 .. ';' .. s2 .. ';' .. s3
 +
     end
 
}
 
}

Latest revision as of 12:48, 12 May 2021

Documentation for this module may be created at Module:Pagename/doc

local getArgs = require('Module:GetArgs')

return {
    format = function(frame)
        local f1 = frame
        local f2 = f1 and f1:getParent()
        local f3 = f2 and f2:getParent()
        local a1 = f1 and getArgs{ frame = f1 }
        local a2 = f2 and getArgs{ frame = f2 }
        local a3 = f3 and getArgs{ frame = f3 }
        local s1 = f1 and (f1:getTitle() .. ',' .. (a1 and a1.pagename or '-')) or '='
        local s2 = f2 and (f2:getTitle() .. ',' .. (a2 and a2.pagename or '-')) or '='
        local s3 = f3 and (f3:getTitle() .. ',' .. (a3 and a3.pagename or '-')) or '='
        return s1 .. ';' .. s2 .. ';' .. s3
    end
}