Module:Navbar: திருத்தங்களுக்கு இடையிலான வேறுபாடு

உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
சி update
சி Sivakosaranஆல் செய்யப்பட்ட கடைசித் தொகுப்புக்கு முன்நிலையாக்கப்பட்டது
வரிசை 2:
 
local getArgs
local HtmlBuilder = require('Module:HtmlBuilder')
 
local function trim(s)
return mw.ustring.match(s, "^%s*(.-)%s*$")
end
 
local function htmlError(s)
local divspan = mw.htmlHtmlBuilder.create():tag('divspan')
 
span
.addClass('error')
.css('float', 'left')
.css('white-space', 'nowrap')
.wikitext('Error: ' .. s)
 
return tostring(span)
end
 
local function getTitle(pageName)
pageName = trim(pageName);
local page_title, talk_page_title;
 
if mw.ustring.sub(pageName, 1, 1) == ':' then
page_title = mw.title.new( mw.ustring.sub(pageName, 2));
else
local title page_title = mw.title.new(mw.text.trim(titleText)pageName, 'Template');
end
 
if page_title then
talk_page_title = page_title.talkPageTitle;
else
talk_page_title = nil;
end
 
return page_title, talk_page_title;
end
 
function p._navbar(args)
local good, title, talk_title;
local titleArg = 1
 
if args.collapsible then
titleArg = 2
வரி 16 ⟶ 53:
args.style = 'float:left; text-align:left; width:6em;'
end
 
localgood, titleTexttitle, talk_title = pcall(getTitle, args[titleArg] or (':' .. mw.getCurrentFrame():getParent():getTitle()));
if not good then
local title = mw.title.new(mw.text.trim(titleText), 'Template');
return htmlError(title);
end
 
if not title then
return htmlError('Page does not exist')
error('Invalid title ' .. titleText)
end
 
local talkpagemainpage = title.talkPageTitle and title.talkPageTitle.fullText or '';
local talkpage = talk_title and talk_title.fullText or ''
local editurl = title:fullUrl('action=edit');
 
local viewLink, talkLink, editLink = 'view', 'talk', 'edit'
local div = mw.html.create():tag('div')
if args.mini then
viewLink, talkLink, editLink = 'பா', 'உ', 'தொ'
end
 
local div = HtmlBuilder.create().tag('div')
div
:.addClass('plainlinks')
:.addClass('hlist')
:.addClass('navbar')
:.cssText(args.style)
 
if args.mini then div:.addClass('mini') end
 
if not (args.mini or args.plain) then
div
:.tag('span')
:.css('word-spacing', 0)
:.cssText(args.fontstyle)
:.wikitext(args.text or 'This box:')
:.wikitext(' ')
end
 
if args.brackets then
div
:.tag('span')
:.css('margin-right', '-0.125em')
:.cssText(args.fontstyle)
:.wikitext('[')
:.newline();
end
 
local ul = div:.tag('ul');
 
ul
:.tag('li')
:.addClass('nv-view')
:.wikitext('[[' .. title.fullTextmainpage .. '|')
:.tag('span')
:.attr('title', 'View this templateபார்')
:.cssText(args.fontstyle or '')
:.wikitext(args.mini and 'v' or 'view'viewLink)
:.done()
:.wikitext(']]')
:.done()
:.tag('li')
:.addClass('nv-talk')
:.wikitext('[[' .. talkpage .. '|')
:.tag('span')
:.attr('title', 'Discuss this templateஉரை')
:.cssText(args.fontstyle or '')
:.wikitext(args.mini and 't' or 'talk'talkLink)
:.done()
:.wikitext(']]');
 
if not args.noedit then
ul
:.tag('li')
:.addClass('nv-edit')
:.wikitext('[' .. title:fullUrl('action=edit')editurl .. ' ')
:.tag('span')
:.attr('title', 'Edit this templateதொகு')
:.cssText(args.fontstyle or '')
:.wikitext(args.mini and 'e' or 'edit'editLink)
:.done()
:.wikitext(']');
end
 
if args.brackets then
div
:.tag('span')
:.css('margin-left', '-0.125em')
:.cssText( args.fontstyle or '')
:.wikitext(']')
:.newline();
end
 
if args.collapsible then
div
:.done()
:.tag('span')
:.css('font-size', '110%')
:.cssText(args.fontstyle or '')
:.wikitext(args[1])
end
 
return tostring(div:done.allDone())
end
 
"https://tamilar.wiki/w/Module:Navbar" இலிருந்து மீள்விக்கப்பட்டது