Moduł:Dokumentacja: Różnice pomiędzy wersjami
Przejdź do nawigacji
Przejdź do wyszukiwania
| [wersja nieprzejrzana] | [wersja nieprzejrzana] |
dNie podano opisu zmian |
dNie podano opisu zmian |
||
| Linia 81: | Linia 81: | ||
local category = '' | local category = '' | ||
if not args['niekat'] then | if not args['niekat'] then | ||
category = '[[ | category = '[[Kategoria:Szablony dokumentacji]]' | ||
end | end | ||
local out = table.concat( { | local out = table.concat( { | ||
'<div style="margin-bottom: 0.8em; padding: 0.8em 1em 0.7em; background-color: #' .. colour .. '; border: 1px solid #AAA">', | '<div style="margin-bottom: 0.8em; padding: 0.8em 1em 0.7em; background-color: #' .. colour .. '; border: 1px solid #AAA">', | ||
'<div style="float: right">[[' .. page:fullUrl( 'action=purge' ) .. ' | '<div style="float: right">[[' .. page:fullUrl( 'action=purge' ) .. ' odśwież]]</div>', | ||
'<p style="margin: 0">To jest strona dokumentacji, ' .. certainty .. ' в основную страницу ' .. pageType .. '. Для дополнительной информации см. [[Szablon:Dokumentacja]].</p>', | '<p style="margin: 0">To jest strona dokumentacji, ' .. certainty .. ' в основную страницу ' .. pageType .. '. Для дополнительной информации см. [[Szablon:Dokumentacja]].</p>', | ||
message, | message, | ||
| Linia 101: | Linia 101: | ||
local page = mw.title.getCurrentTitle() | local page = mw.title.getCurrentTitle() | ||
local namespace = args['тип'] or page.nsText | local namespace = args['тип'] or page.nsText | ||
local docPage = mw.title.new( args[' | local docPage = mw.title.new( args['strona'] or namespace .. ':' .. page.text .. '/opis' ) | ||
local noDoc = args['нетдок'] or not docPage.exists | local noDoc = args['нетдок'] or not docPage.exists | ||
local badDoc = args['плохдок'] | local badDoc = args['плохдок'] | ||
| Linia 143: | Linia 143: | ||
end | end | ||
local action = ' | local action = 'edytuj' | ||
local preload = '' | local preload = '' | ||
local colour = 'EAF4F9' | local colour = 'EAF4F9' | ||
| Linia 149: | Linia 149: | ||
local category = '' | local category = '' | ||
if noDoc then | if noDoc then | ||
action = ' | action = 'utwórz' | ||
preload = '&preload=Szablon:Dokumentacja/Предзагрузка' | preload = '&preload=Szablon:Dokumentacja/Предзагрузка' | ||
colour = 'F9EAEA' | colour = 'F9EAEA' | ||
| Linia 174: | Linia 174: | ||
local links = { | local links = { | ||
'[' .. docPage:fullUrl( 'action=edit' .. preload ) .. ' ' .. action .. ']', | '[' .. docPage:fullUrl( 'action=edit' .. preload ) .. ' ' .. action .. ']', | ||
'[' .. page:fullUrl( 'action=purge' ) .. ' | '[' .. page:fullUrl( 'action=purge' ) .. ' odśwież]' | ||
} | } | ||
local footer = '' | local footer = '' | ||
if not noDoc then | if not noDoc then | ||
table.insert( links, 1, '[[' .. docPage.fullText .. '| | table.insert( links, 1, '[[' .. docPage.fullText .. '|podgląd]]' ) | ||
footer = table.concat( { | footer = table.concat( { | ||
'<div style="margin: 0.7em -1em -0.7em; background-color: #EAF4F9; border-top: 1px solid #AAA; padding: 0.8em 1em 0.7em; clear: both">\n', | '<div style="margin: 0.7em -1em -0.7em; background-color: #EAF4F9; border-top: 1px solid #AAA; padding: 0.8em 1em 0.7em; clear: both">\n', | ||
Wersja z 17:08, 20 mar 2017
Używana w {{Dokumentacja}} i {{Dokumentacja/Nagłówek}}
Zależności
Powyższy opis jest dołączany ze strony Moduł:Dokumentacja/opis.
local p = {}
-- Creating a documentation page or transclution through {{subst:doc}}
function p.create( f )
local args = require( 'Moduł:ProcessArgs' ).norm()
page = mw.title.getCurrentTitle()
namespace = args['тип'] or page.nsText
docPage = args['strona'] or namespace .. ':' .. page.baseText .. '/opis'
local out
if page.fullText == docPage then
out = f:preprocess( '{{subst:Szablon:Dokumentacja/Предзагрузка}}' )
else
local templateArgs = {}
if args['тип'] then
table.insert( templateArgs, 'тип=' .. args['тип'] )
end
if args['страница'] then
table.insert( templateArgs, 'strona=' .. args['strona'] )
end
out = '{{Dokumentacja|' .. table.concat( templateArgs, '|' ) .. '}}\n<!-- Kategorie i interwiki umieść na stronie dokumentacji. -->'
out = out:gsub( '|}}', '}}' )
end
if not mw.isSubsting() then
out = f:preprocess( out )
if not args['niekat'] then
out = out .. '[[Kategoria:Страницы с требующими подстановки шаблонами]]'
end
end
return out
end
-- Header on the documentation page
function p.docPage(f)
local args = require( 'Moduł:ProcessArgs' ).merge( true )
local badDoc = args['плохдок']
if f:callParserFunction( '#dplvar:noheader' ) == '1' then
if badDoc then
f:callParserFunction( '#dplvar:set', 'baddoc', '1' )
end
return ''
end
local page = mw.title.getCurrentTitle()
local namespace = args['тип'] or page.nsText
local pageType = 'этого шаблона'
local pageType2 = 'этот шаблон'
local pageType3 = 'Шаблоны'
if namespace == 'Moduł' then
pageType = 'этого модуля'
pageType2 = 'этот модуль'
pageType3 = 'Модули'
elseif page.fullText:find( '.css$' ) then
pageType = 'этой таблицы стилей'
pageType2 = 'эту таблицу стилей'
pageType3 = 'Таблицы стилей'
elseif page.fullText:find( '.js$' ) then
pageType = 'этого скрипта'
pageType2 = 'этот скрипт'
pageType3 = 'Скрипты'
elseif namespace == 'MediaWiki' then
pageType = 'этого сообщения'
pageType2 = 'это сообщение'
pageType3 = 'Сообщения'
end
local colour = 'EAF4F9'
local message = ''
if badDoc then
colour = 'F9F2EA'
message = "'''Dokumentacja " .. pageType .. " была отмечена как плохая. Пожалуйста, дополните или улучшите её.'''"
end
local certainty = 'её следует включить'
if pageType2 == 'этот модуль' then
certainty = 'она будет включена'
end
local category = ''
if not args['niekat'] then
category = '[[Kategoria:Szablony dokumentacji]]'
end
local out = table.concat( {
'<div style="margin-bottom: 0.8em; padding: 0.8em 1em 0.7em; background-color: #' .. colour .. '; border: 1px solid #AAA">',
'<div style="float: right">[[' .. page:fullUrl( 'action=purge' ) .. ' odśwież]]</div>',
'<p style="margin: 0">To jest strona dokumentacji, ' .. certainty .. ' в основную страницу ' .. pageType .. '. Для дополнительной информации см. [[Szablon:Dokumentacja]].</p>',
message,
'</div>',
category
}, '\n' )
return mw.text.trim( out )
end
-- Wrapper around the documentation on the main page
function p.page( f )
local args = require( 'Moduł:ProcessArgs' ).merge( true )
local page = mw.title.getCurrentTitle()
local namespace = args['тип'] or page.nsText
local docPage = mw.title.new( args['strona'] or namespace .. ':' .. page.text .. '/opis' )
local noDoc = args['нетдок'] or not docPage.exists
local badDoc = args['плохдок']
local pageType = 'этого шаблона'
local pageType2 = 'этот шаблон'
local pageType3 = 'Шаблоны'
if namespace == 'Moduł' then
pageType = 'этого модуля'
pageType2 = 'этот модуль'
pageType3 = 'Модули'
elseif page.fullText:find( '.css$' ) then
pageType = 'этой таблицы стилей'
pageType2 = 'эту таблицу стилей'
pageType3 = 'Таблицы стилей'
elseif page.fullText:find( '.js$' ) then
pageType = 'этого скрипта'
pageType2 = 'этот скрипт'
pageType3 = 'Скрипты'
elseif namespace == 'MediaWiki' then
pageType = 'этого сообщения'
pageType2 = 'это сообщение'
pageType3 = 'Сообщения'
end
local docText = ''
if not noDoc then
f:callParserFunction( '#dplvar:set', 'noheader', '1' )
docText = mw.text.trim( f:expandTemplate{ title = ':' .. docPage.fullText } )
if f:callParserFunction( '#dplvar:baddoc' ) == '1' then
badDoc = 1
end
if docText == '' then
noDoc = 1
else
docText = '\n' .. docText .. '\n'
end
end
local action = 'edytuj'
local preload = ''
local colour = 'EAF4F9'
local message = ''
local category = ''
if noDoc then
action = 'utwórz'
preload = '&preload=Szablon:Dokumentacja/Предзагрузка'
colour = 'F9EAEA'
message = "'''W " .. pageType .. " nie ma dokumentacji. Jeśli wiesz jak używać " .. pageType2 .. ", dodaj odpowiednie informacje.'''"
if not args['niekat'] then
if mw.title.new( 'Kategoria:' .. pageType3 .. ' без документации' ).exists then
category = '[[Kategoria:' .. pageType3 .. ' без документации]]'
else
category = '[[Kategoria:Страницы без документации]]'
end
end
elseif badDoc then
colour = 'F9F2EA'
message = "'''Документация " .. pageType .. " была отмечена как плохая. Пожалуйста, дополните или улучшите её.'''\n"
if not args['niekat'] then
if mw.title.new( 'Категория:' .. pageType3 .. ' с плохой документацией' ).exists then
category = '[[Категория:' .. pageType3 .. ' с плохой документацией]]'
else
category = '[[Категория:Страницы с плохой документацией]]'
end
end
end
local links = {
'[' .. docPage:fullUrl( 'action=edit' .. preload ) .. ' ' .. action .. ']',
'[' .. page:fullUrl( 'action=purge' ) .. ' odśwież]'
}
local footer = ''
if not noDoc then
table.insert( links, 1, '[[' .. docPage.fullText .. '|podgląd]]' )
footer = table.concat( {
'<div style="margin: 0.7em -1em -0.7em; background-color: #EAF4F9; border-top: 1px solid #AAA; padding: 0.8em 1em 0.7em; clear: both">\n',
'<div style="float: right">' .. mw.text.nowiki( '[' ) .. table.concat( links, ' | ' ) .. ']</div>\n',
'<p style="margin: 0">Powyższy opis jest dołączany ze strony [[' .. docPage.fullText .. ']].</p>\n',
'</div>\n'
} )
end
local out = {
'<div style="background-color: #' .. colour .. '; border: 1px solid #AAA; padding: 0.8em 1em 0.7em; clear: both">\n',
'<div style="margin: -0.8em -1em 0.8em; padding: 0.8em 1em 0.7em; background-color: #EAF4F9; border-bottom: 1px solid #AAA">\n',
'<div style="float: right">' .. mw.text.nowiki( '[' ) .. table.concat( links, ' | ' ) .. ']</div>\n',
'<span style="font-weight: bold; font-size: 130%">Dokumentacja</span>',
'</div>\n',
message,
docText,
footer,
'</div>\n',
category
}
return mw.text.trim( table.concat( out ) )
end
return p