Difference between revisions of "Module:Navbar"
Jump to navigation
Jump to search
Debug data:
(Removing test) |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | local p = {} | ||
+ | local getArgs | ||
+ | |||
+ | function p._navbar(args) | ||
+ | local titleArg = 1 | ||
+ | |||
+ | if args.collapsible then | ||
+ | titleArg = 2 | ||
+ | if not args.plain then | ||
+ | args.mini = 1 | ||
+ | end | ||
+ | if args.fontcolor then | ||
+ | args.fontstyle = 'color:' .. args.fontcolor .. ';' | ||
+ | end | ||
+ | args.style = 'float:left; text-align:left; width:6em;' | ||
+ | end | ||
+ | |||
+ | local titleText = args[titleArg] or (':' .. mw.getCurrentFrame():getParent():getTitle()) | ||
+ | local title = mw.title.new(mw.text.trim(titleText), 'Template'); | ||
+ | |||
+ | if not title then | ||
+ | error('Invalid title ' .. titleText) | ||
+ | end | ||
+ | |||
+ | local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ''; | ||
+ | |||
+ | local div = mw.html.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.fullText .. '|') | ||
+ | :tag(args.mini and 'abbr' or 'span') | ||
+ | :attr('title', 'View this template') | ||
+ | :cssText(args.fontstyle) | ||
+ | :wikitext(args.mini and 'v' or 'view') | ||
+ | :done() | ||
+ | :wikitext(']]') | ||
+ | :done() | ||
+ | :tag('li') | ||
+ | :addClass('nv-talk') | ||
+ | :wikitext('[[' .. talkpage .. '|') | ||
+ | :tag(args.mini and 'abbr' or 'span') | ||
+ | :attr('title', 'Discuss this template') | ||
+ | :cssText(args.fontstyle) | ||
+ | :wikitext(args.mini and 't' or 'talk') | ||
+ | :done() | ||
+ | :wikitext(']]'); | ||
+ | |||
+ | if not args.noedit then | ||
+ | ul | ||
+ | :tag('li') | ||
+ | :addClass('nv-edit') | ||
+ | :wikitext('[' .. title:fullUrl('action=edit') .. ' ') | ||
+ | :tag(args.mini and 'abbr' or 'span') | ||
+ | :attr('title', 'Edit this template') | ||
+ | :cssText(args.fontstyle) | ||
+ | :wikitext(args.mini and 'e' or 'edit') | ||
+ | :done() | ||
+ | :wikitext(']'); | ||
+ | end | ||
+ | |||
+ | if args.brackets then | ||
+ | div | ||
+ | :tag('span') | ||
+ | :css('margin-left', '-0.125em') | ||
+ | :cssText(args.fontstyle) | ||
+ | :wikitext(']') | ||
+ | :newline(); | ||
+ | end | ||
+ | |||
+ | if args.collapsible then | ||
+ | div | ||
+ | :done() | ||
+ | :tag('span') | ||
+ | :css('font-size', '110%') | ||
+ | :cssText(args.fontstyle) | ||
+ | :wikitext(args[1]) | ||
+ | end | ||
+ | |||
+ | return tostring(div:done()) | ||
+ | end | ||
+ | |||
+ | function p.navbar(frame) | ||
+ | if not getArgs then | ||
+ | getArgs = require('Module:Arguments').getArgs | ||
+ | end | ||
+ | return p._navbar(getArgs(frame)) | ||
+ | end | ||
+ | |||
+ | return p |
Latest revision as of 06:22, 25 June 2016
Documentation for this module may be created at Module:Navbar/doc
local p = {} local getArgs function p._navbar(args) local titleArg = 1 if args.collapsible then titleArg = 2 if not args.plain then args.mini = 1 end if args.fontcolor then args.fontstyle = 'color:' .. args.fontcolor .. ';' end args.style = 'float:left; text-align:left; width:6em;' end local titleText = args[titleArg] or (':' .. mw.getCurrentFrame():getParent():getTitle()) local title = mw.title.new(mw.text.trim(titleText), 'Template'); if not title then error('Invalid title ' .. titleText) end local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ''; local div = mw.html.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.fullText .. '|') :tag(args.mini and 'abbr' or 'span') :attr('title', 'View this template') :cssText(args.fontstyle) :wikitext(args.mini and 'v' or 'view') :done() :wikitext(']]') :done() :tag('li') :addClass('nv-talk') :wikitext('[[' .. talkpage .. '|') :tag(args.mini and 'abbr' or 'span') :attr('title', 'Discuss this template') :cssText(args.fontstyle) :wikitext(args.mini and 't' or 'talk') :done() :wikitext(']]'); if not args.noedit then ul :tag('li') :addClass('nv-edit') :wikitext('[' .. title:fullUrl('action=edit') .. ' ') :tag(args.mini and 'abbr' or 'span') :attr('title', 'Edit this template') :cssText(args.fontstyle) :wikitext(args.mini and 'e' or 'edit') :done() :wikitext(']'); end if args.brackets then div :tag('span') :css('margin-left', '-0.125em') :cssText(args.fontstyle) :wikitext(']') :newline(); end if args.collapsible then div :done() :tag('span') :css('font-size', '110%') :cssText(args.fontstyle) :wikitext(args[1]) end return tostring(div:done()) end function p.navbar(frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return p._navbar(getArgs(frame)) end return p
Debug data:
[SQLBagOStuff] MainObjectStash using store ReplicatedBagOStuff
[objectcache] MainWANObjectCache using store EmptyBagOStuff
IP: 3.144.70.25
Start request GET /mediawiki/index.php?diff=170&oldid=75&title=Module%3ANavbar
HTTP HEADERS:
CONTENT-TYPE:
CONTENT-LENGTH: 0
USER-AGENT: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
HOST: zero-k.info
COOKIE: wikidb229_mw__session=tierhmbofegs0hmhcjsr2rjunkmi16t5
ACCEPT-ENCODING: gzip, br, zstd, deflate
ACCEPT: */*
CONNECTION: close[localisation] LocalisationCache: using store LCStoreDB
[session] SessionManager using store SqlBagOStuff
[session] Session "tierhmbofegs0hmhcjsr2rjunkmi16t5" requested without UserID cookie
[DBReplication] Cannot use ChronologyProtector with EmptyBagOStuff
[DBReplication] Wikimedia\Rdbms\LBFactory::getChronologyProtector: request info {
"IPAddress": "3.144.70.25",
"UserAgent": "Mozilla\/5.0 AppleWebKit\/537.36 (KHTML, like Gecko; compatible; ClaudeBot\/1.0; +claudebot@anthropic.com)",
"ChronologyProtection": false,
"ChronologyPositionIndex": 0,
"ChronologyClientId": false
}[DBConnection] Wikimedia\Rdbms\LoadBalancer::lazyLoadReplicationPositions: executed chronology callback.
[DBConnection] Wikimedia\Rdbms\LoadBalancer::getLocalConnection: connected to database 0 at 'localhost'.
[SQLBagOStuff] Connection mysql object #126 (handle id #120) will be used for SqlBagOStuff
[SQLBagOStuff] Connection mysql object #126 (handle id #120) will be used for SqlBagOStuff
[DBConnection] Wikimedia\Rdbms\LoadBalancer::getLocalConnection: connected to database 0 at 'localhost'.
Title::getRestrictionTypes: applicable restrictions to [[Module:Navbar]] are {edit,move}
[ContentHandler] Created handler for Scribunto: ScribuntoContentHandler
Article::view: showing diff page
DifferenceEngine old '75' new '170' rcid ''
[MessageCache] MessageCache using store SqlBagOStuff
[SQLBagOStuff] Connection mysql object #126 (handle id #120) will be used for SqlBagOStuff
[SQLBagOStuff] Connection mysql object #126 (handle id #120) will be used for SqlBagOStuff
[SQLBagOStuff] Connection mysql object #126 (handle id #120) will be used for SqlBagOStuff
[SQLBagOStuff] Connection mysql object #126 (handle id #120) will be used for SqlBagOStuff
[SQLBagOStuff] SqlBagOStuff::lock failed due to timeout for wikidb229-mw_:messages:en.
[ContentHandler] Created handler for wikitext: WikitextContentHandler
[SQLBagOStuff] Connection mysql object #126 (handle id #120) will be used for SqlBagOStuff
[SQLBagOStuff] Connection mysql object #126 (handle id #120) will be used for SqlBagOStuff
[MessageCache] MessageCache::load: Loading en... local cache is empty, global cache is expired/volatile, loading from database
ParserFactory: using preprocessor: Preprocessor_Hash
Unstubbing $wgLang on call of $wgLang::_unstub from ParserOptions->__construct
DifferenceEngine old '0' new '0' rcid '0'
[GlobalTitleFail] MessageCache::parse called by DifferenceEngine->getMultiNotice/DifferenceEngine::intermediateEditsMsg/Message->parse/Message->toString/Message->parseText/MessageCache->parse with no title set.
WikiPage::getParserOutput: using parser cache: no
[caches] parser: SqlBagOStuff
[SQLBagOStuff] Connection mysql object #126 (handle id #120) will be used for SqlBagOStuff
Unstubbing $wgParser on call of $wgParser::parse from AbstractContent->getParserOutput
[Scribunto] Scribunto_LuaStandaloneInterpreter::__construct: creating interpreter: ""C:\Projekty\zero-k.info\www\mediawiki\extensions\Scribunto\includes\engines\LuaStandalone/binaries/lua5_1_5_Win64_bin/lua5.1.exe" "C:\Projekty\zero-k.info\www\mediawiki\extensions\Scribunto\includes\engines\LuaStandalone/mw_main.lua" "C:\Projekty\zero-k.info\www\mediawiki\extensions\Scribunto\includes" "0" "8""
[gitinfo] Candidate cacheFile=C:\Projekty\zero-k.info\www\mediawiki/gitinfo.json for C:\Projekty\zero-k.info\www\mediawiki
[gitinfo] Cache incomplete for C:\Projekty\zero-k.info\www\mediawiki
SiteStats::loadAndLazyInit: reading site_stats from replica DB
MediaWiki::preOutputCommit: primary transaction round committed
MediaWiki::preOutputCommit: pre-send deferred updates completed
MediaWiki::preOutputCommit: session changes committed
MediaWiki::preOutputCommit: LBFactory shutdown completed
Title::getRestrictionTypes: applicable restrictions to [[Module:Navbar]] are {edit,move}