m (meow) Tag: sourceedit |
m (thingy) Tag: sourceedit |
||
Line 4: | Line 4: | ||
local onmain = require('Module:Mainonly').on_main |
local onmain = require('Module:Mainonly').on_main |
||
+ | local tag = require('Module:Reftag') |
||
--create the ref tag to be returned |
--create the ref tag to be returned |
||
Line 17: | Line 18: | ||
end |
end |
||
− | local |
+ | local cat |
+ | p.text, cat = p[reftype](args) |
||
--return frame:extensionTag({name = 'ref', content = reference, args = opts}) |
--return frame:extensionTag({name = 'ref', content = reference, args = opts}) |
||
− | return |
+ | return tag(opts) .. cat |
end |
end |
||
Revision as of 16:32, 28 June 2015
Documentation for this module may be created at Module:References/doc
--<pre>
local p = {}
local onmain = require('Module:Mainonly').on_main
local tag = require('Module:Reftag')
--create the ref tag to be returned
local function reftag(frame, reftype)
local args = frame:getParent(args)
local s = ''
local opts = {}
if args.name then
s = s .. ' name="' .. opts.name .. '"'
end
if args.group then
s = s .. ' group="' .. opts.group .. '"'
end
local cat
p.text, cat = p[reftype](args)
--return frame:extensionTag({name = 'ref', content = reference, args = opts})
return tag(opts) .. cat
end
local function plainref(frame, reftype)
local ref, cat = p[reftype](frame:getParent().args)
return ref .. cat
end
--[====[
test
p.test = function()
--f = frame
return reftag('test0') .. '\n' .. reftag('test1',{}) .. '\n' .. reftag('test2', {name='name2'}) .. '\n' .. reftag('test3', {group='group3'}) .. '\n' .. reftag('test4', {name='name4', group='group4'})
end
--]====]
--[==[
Template:CiteDevBlog and Template:PlainCiteDevBlog
--]==]
p.devblogref = function(frame)
return reftag(frame, 'devblog')
end
p.devblogplain = function(frame)
return p.plainref(frame, 'devblog')
end
p.devblog = function(a)
local ref
local c = ''
ref = a.author or 'Jagex' --author, defaults to Jagex
ref = ref .. '. '
if a.url then --url, if present makes a link
ref = ref .. '[' .. a.url
if a.title then
ref = ref .. ' ' .. a.title --if title not present leave as link
end
ref = ref .. ']'
else
if a.title then
ref = ref .. (a.title or '')
end
end
ref = ref .. ' '
ref = ref .. (a.blogdate or '')
ref = ref .. " Developers' Blogs. "
ref = ref .. (a.notes or '')
if onmain() and not (a.author and a.url and a.title and a.blogdate) then --validation, required params are author, url, title and blogdate (mainonly)
c = '[[Category:Incomplete References]]'
end
return ref, c
end
return p