Module:Mapframe: Difference between revisions

Content deleted Content added
+
+
Line 1:
--Parameter for cleaned-up parent.args (whitespace trimmed, blanks removed)
local Args = {}
 
local outputdefaults = ''{}
 
function setCleanArgs(argsTable)
Line 15 ⟶ 17:
end
return cleanArgs
end
 
function makeTag(name, attributes, content)
local tag --todo
return tag
end
 
function makeContent(args)
if args.raw then
return args.raw
end
 
local content = {};
local contentIndex = '';
Line 58 ⟶ 59:
end
 
function makeTagAttribs(args, isTitle)
local attribs = {}
if args.zoom then
attribs.zoom = args.zoom
end
-- todo: makeall tag(s)the others
 
return tagattribs
end
 
function makeTitleOutput(args, tagContent)
local titleTag = mw.text.tag('maplink', makeTagAttribs(args, true), tagContent)
local spanAttribs = {
style = "font-size: small;",
id = "coordinates"
}
return mw.text.tag('span', spanAttribs, titleTag)
end
 
function makeInlineOutput(args, tagContent)
local tagName = 'maplink'
if args.frame then
tagName = 'mapframe'
end
 
return mw.text.tag(tagName, makeTagAttribs(args), tagContent)
end
 
local p = {}
Line 67 ⟶ 95:
local tagContent = makeContent(Args)
 
local display = mw.text.split(Args.display, '%s*,%s*')
-- todo: make tag(s)
local displayInTitle = display[1] == 'title' or display[2] == 'title'
local displayInline = display[1] == 'inline' or display[2] == 'inline'
 
if displayInTitle and displayInline then
return makeTitleOutput(args, tagContent) .. makeInlineOutput(args, tagContent)
elseif displayInTitle then
return makeTitleOutput(args, tagContent)
elseif displayInline then
return makeInlineOutput(args, tagContent)
else
error( 'Invalid display parameter')
end
 
-- todo
local output = ''
return output
end