Module:Location map: திருத்தங்களுக்கு இடையிலான வேறுபாடு
உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
No edit summary அடையாளங்கள்: Manual revert Reverted |
No edit summary அடையாளம்: Manual revert |
||
வரிசை 2:
local p = {}
local dataset = 'Location map.tab'
local getArgs = require('Module:Arguments').getArgs
local function round(n, decimals)
வரி 103 ⟶ 104:
-- Finds a parameter in a transclusion of {{Coord}}.
local function coord2text(para,coord) -- this should be changed for languages which do not use Arabic numerals or the degree sign
local result = mw.text.split(mw.ustring.match(coord,'%-?[%.%d]+°[NS] %-?[%.%d]+°[EW]') or '', '[ °]')
if para == 'longitude' then result = {result[3], result[4]} end
if not tonumber(result[1]) or not result[2] then return error('Malformed coordinates value', 2) end
return tonumber(result[1]) * hemisphereMultipliers[para][result[2]]
end
வரி 135 ⟶ 127:
if args.AlternativeMap then
return args.AlternativeMap
elseif args.relief and map('image1') ~= '' then
else
end
▲ return map('image')
end
வரி 173 ⟶ 163:
end
end
local retval =
if args.caption and args.caption ~= '' and args.border ~= 'infobox' then
retval = retval .. '<div class="
if args.float == '"left"' or args.float == 'left' then
retval = retval .. 'tleft'
வரி 194 ⟶ 181:
retval = retval .. '"><div style="position:relative;width:' .. width .. 'px' .. (args.border ~= 'none' and ';border:1px solid lightgray">' or '">')
else
retval = retval .. '<div
if args.float == '"left"' or args.float == 'left' then
retval = retval .. 'float:left;clear:left'
வரி 209 ⟶ 196:
local currentTitle = mw.title.getCurrentTitle()
retval = string.format(
'%s[[File:%s|%spx|%s%s
retval,
image,
வரி 222 ⟶ 209:
end
if args.overlay_image then
return retval .. '<div style="position:absolute;top:0;left:0">[[File:' .. args.overlay_image .. '|' .. width .. 'px
else
return retval
வரி 239 ⟶ 226:
if not args.caption or args.border == 'infobox' then
if args.border then
retval = retval .. '<div
else
retval = retval .. '<div style="font-size:
end
retval = retval
வரி 248 ⟶ 235:
elseif args.caption ~= '' then
-- This is not the pipe trick. We're creating a link with no text on purpose, so that CSS can give us a nice image
retval = retval .. '<div class="thumbcaption"><div class="magnify">[[:File:' .. getContainerImage(args, map) .. '
end
வரி 254 ⟶ 241:
retval = retval .. '<span class="switcher-label" style="display:none">' .. args.switcherLabel .. '</span>'
elseif args.autoSwitcherLabel then
retval = retval .. '<span class="switcher-label" style="display:none">
end
வரி 291 ⟶ 278:
end
local function markOuterDiv(x, y, imageDiv, labelDiv
return mw.html.create('div')
:cssText('position:absolute;top:' .. round(y, 3) .. '%;left:' .. round(x, 3)
▲ :cssText('top:' .. round(y, 3) .. '%;left:' .. round(x, 3) .. '%;font-size:' .. label_size .. '%')
:node(imageDiv)
:node(labelDiv)
வரி 302 ⟶ 287:
local function markImageDiv(mark, marksize, label, link, alt, title)
local builder = mw.html.create('div')
:cssText('position:absolute;left:-' .. round(marksize / 2) .. 'px;top:-' .. round(marksize / 2) .. 'px;line-height:0')▼
▲ :cssText('left:-' .. round(marksize / 2) .. 'px;top:-' .. round(marksize / 2) .. 'px')
:attr('title', title)
if marksize ~= 0 then
builder:wikitext(string.format(
'[[File:%s|%dx%dpx|%s|link=%s%s
mark,
marksize,
வரி 321 ⟶ 305:
local function markLabelDiv(label, label_size, label_width, position, background, x, marksize)
if tonumber(label_size) == 0 then
return mw.html.create('div'):
end
local builder = mw.html.create('div')
:cssText('font-size:' .. label_size .. '%;line-height:110%;position:absolute;width:' .. label_width .. 'em')
local distance = round(marksize / 2 + 1)
local spanCss
if position == 'top' then -- specified top
builder
elseif position == 'bottom' then -- specified bottom
builder
elseif position == 'left' or (tonumber(x) > 70 and position ~= 'right') then -- specified left or autodetected to left
builder
spanCss = 'float:right'
else -- specified right or autodetected to right
builder
spanCss = 'float:left'
end
builder = builder:tag('div')
:css('display', 'inline')
:cssText('padding:1px')
:cssText(spanCss)
:wikitext(label)
if background then
வரி 439 ⟶ 429:
builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Decimal]]')
end
end
if args.skew or args.lon_shift or args.markhigh then
வரி 484 ⟶ 462:
mw.logObject(args, 'args')
if currentTitle.namespace == 0 then
local key =
builder:wikitext('[[Category:Location maps with marks outside map and outside parameter not set|' .. key .. ' ]]')
end
வரி 494 ⟶ 472:
local marksize = tonumber(args.marksize) or tonumber(map('marksize')) or 8
local imageDiv = markImageDiv(mark, marksize, args.label or mw.title.getCurrentTitle().text, args.link or '', args.alt, args[2])
local labelDiv
if args.label and args.position ~= 'none' then
labelDiv = markLabelDiv(args.label, args.label_size or 90, args.label_width or 6, args.position, args.background, x, marksize)
end
return builder:node(markOuterDiv(x, y, imageDiv, labelDiv
end
| |||