a (Fordítás) |
a (Fordítás) |
||
(2 közbenső módosítás ugyanattól a szerkesztőtől nincs mutatva) | |||
40. sor: | 40. sor: | ||
if not args.content then |
if not args.content then |
||
− | out = out .. '\n<!-- |
+ | out = out .. '\n<!-- A kategóriákat és az interwikit a dokumentációs lapra tedd! -->' |
end |
end |
||
end |
end |
||
148. sor: | 148. sor: | ||
"Ha ismered ezen " .. pageType .. " használatát, akkor kérlek, hozd létre!'''" |
"Ha ismered ezen " .. pageType .. " használatát, akkor kérlek, hozd létre!'''" |
||
if not ( args.nocat or namespace == 'User' ) then |
if not ( args.nocat or namespace == 'User' ) then |
||
− | category = |
+ | category = 'Dokumentáció nélküli ' .. pageType |
if not mw.title.new( 'Category:' .. category ).exists then |
if not mw.title.new( 'Category:' .. category ).exists then |
||
category = 'Dokumentáció nélküli oldalak' |
category = 'Dokumentáció nélküli oldalak' |
||
157. sor: | 157. sor: | ||
message = "'''Ezen " .. pageType .. " oldal dokumentációja fejlesztésre vagy további információk hozzáadására szorul.'''\n" |
message = "'''Ezen " .. pageType .. " oldal dokumentációja fejlesztésre vagy további információk hozzáadására szorul.'''\n" |
||
if not ( args.nocat or namespace == 'User' ) then |
if not ( args.nocat or namespace == 'User' ) then |
||
− | category = |
+ | category = 'Rossz dokumentációval rendelkező ' .. pageType |
if not mw.title.new( 'Category:' .. category ).exists then |
if not mw.title.new( 'Category:' .. category ).exists then |
||
category = 'Rossz dokumentációval rendelkező oldalak' |
category = 'Rossz dokumentációval rendelkező oldalak' |
||
166. sor: | 166. sor: | ||
local links = { |
local links = { |
||
'[' .. docPage:fullUrl( 'action=edit' .. preload ) .. ' ' .. action .. ']', |
'[' .. docPage:fullUrl( 'action=edit' .. preload ) .. ' ' .. action .. ']', |
||
− | '[' .. docPage:fullUrl( 'action=history' ) .. ' |
+ | '[' .. docPage:fullUrl( 'action=history' ) .. ' laptörténet]', |
'[' .. page:fullUrl( 'action=purge' ) .. ' purge]' |
'[' .. page:fullUrl( 'action=purge' ) .. ' purge]' |
||
} |
} |
||
if not noDoc and page ~= docPage then |
if not noDoc and page ~= docPage then |
||
− | table.insert( links, 1, '[[' .. docPage.fullText .. '| |
+ | table.insert( links, 1, '[[' .. docPage.fullText .. '|megtekintés]]' ) |
end |
end |
||
links = mw.html.create( 'span' ) |
links = mw.html.create( 'span' ) |
||
202. sor: | 202. sor: | ||
['line-height'] = '1' |
['line-height'] = '1' |
||
} |
} |
||
− | :wikitext( ' |
+ | :wikitext( 'Dokumentáció' ) |
− | if not noDoc and pageType ~= ' |
+ | if not noDoc and pageType ~= 'sablon' and pageType ~= 'üzenet' then |
header |
header |
||
:tag( 'span' ) |
:tag( 'span' ) |
||
235. sor: | 235. sor: | ||
local anchor = '' |
local anchor = '' |
||
− | if not noDoc and pageType ~= ' |
+ | if not noDoc and pageType ~= 'sablon' and pageType ~= 'üzenet' then |
anchor = mw.html.create( 'div' ):attr( 'id', 'the-code' ) |
anchor = mw.html.create( 'div' ):attr( 'id', 'the-code' ) |
||
end |
end |
A lap jelenlegi, 2018. augusztus 6., 16:19-kori változata
[create | laptörténet | purge]Dokumentáció
Ez a(z) modul nem rendelkezik dokumentációval. Ha ismered ezen modul használatát, akkor kérlek, hozd létre!local p = {}
local defaultDocPage = 'doc'
local getType = function( namespace, page )
local pageType = 'sablon'
if namespace == 'Modul' then
pageType = 'modul'
elseif page.fullText:gsub( '/' .. defaultDocPage .. '$', '' ):find( '%.css$' ) then
pageType = 'stylesheet'
elseif page.fullText:gsub( '/' .. defaultDocPage .. '$', '' ):find( '%.js$' ) then
pageType = 'script'
elseif namespace == 'MediaWiki' then
pageType = 'üzenet'
end
return pageType
end
-- Creating a documentation page or transclution through {{subst:doc}}
function p.create( f )
local args = require( 'Module:ProcessArgs' ).norm()
local page = mw.title.getCurrentTitle()
local docPage = args.page or page.nsText .. ':' .. page.baseText .. '/' .. defaultDocPage
local out
if not args.content and tostring( page ) == docPage then
out = f:preprocess( '{{subst:Template:Documentation/preload}}' )
else
local templateArgs = {}
for _, key in ipairs{ 'type', 'page', 'content' } do
local val = args[key]
if val then
if key == 'content' then val = '\n' .. val .. '\n' end
table.insert( templateArgs, key .. '=' .. val )
end
end
out = '{{documentation|' .. table.concat( templateArgs, '|' ) .. '}}'
out = out:gsub( '|}}', '}}' )
if not args.content then
out = out .. '\n<!-- A kategóriákat és az interwikit a dokumentációs lapra tedd! -->'
end
end
if not mw.isSubsting() then
out = f:preprocess( out )
if not args.nocat then
out = out .. '[[Category:Behelyettesítésre váró sablonokat tartalmazó oldalak]]'
end
end
return out
end
-- Header on the documentation page
function p.docPage( f )
local args = require( 'Module:ProcessArgs' ).merge( true )
local badDoc = args.baddoc
if f:callParserFunction( '#dplvar', '$doc noheader' ) == '1' then
if badDoc then
f:callParserFunction( '#dplvar:set', '$doc bad', '1' )
end
return
end
local page = mw.title.getCurrentTitle()
local namespace = page.nsText
local pageType = mw.ustring.lower( args.type or getType( namespace, page ) )
local body = mw.html.create( 'div' ):addClass( 'documentation-header' )
body
:css{
['margin-bottom'] = '0.8em',
padding = '0.8em 1em 0.7em',
['background-color'] = '#' .. ( badDoc and 'F9F2EA' or 'EAF4F9' ),
border = '1px solid #AAA'
}
:tag( 'div' )
:css( 'float', 'right' )
:wikitext( '[[', page:fullUrl( 'action=purge' ), ' purge]]' )
:done()
:wikitext(
'This is the documentation page, it ',
pageType == 'module' and 'will' or 'should',
' be transcluded into the main ', pageType, ' page. ',
'Lásd: [[Template:Documentation|Sablon:Dokumentáció]] további információért'
)
if badDoc then
body:wikitext( "<br>'''Ezen ", pageType, " dokumentációja fejlesztésre vagy további információkra szorul.'''" )
end
if not ( args.nocat or namespace == 'User' ) then
body:wikitext( '[[Category:Dokumentációs lapok]]' )
end
return body
end
-- Wrapper around the documentation on the main page
function p.page( f )
-- mw.text.trim uses mw.ustring.gsub, which silently fails on large strings
local function trim( s )
return string.gsub( s, '^[\t\r\n\f ]*(.-)[\t\r\n\f ]*$', '%1' )
end
local args = require( 'Module:ProcessArgs' ).merge( true )
local page = mw.title.getCurrentTitle()
local namespace = page.nsText
local docText = trim( args.content or '' )
if docText == '' then docText = nil end
local docPage
local noDoc
if docText then
docPage = page
else
docPage = mw.title.new( args.page or namespace .. ':' .. page.text .. '/' .. defaultDocPage )
noDoc = args.nodoc or not docPage.exists
end
local badDoc = args.baddoc
local pageType = mw.ustring.lower( args.type or getType( namespace, page ) )
if not docText and not noDoc then
f:callParserFunction( '#dplvar:set', '$doc noheader', '1' )
docText = trim( f:expandTemplate{ title = ':' .. docPage.fullText } )
if f:callParserFunction( '#dplvar', '$doc bad' ) == '1' then
badDoc = 1
end
if docText == '' then
docText = nil
noDoc = 1
end
end
if docText then
docText = '\n' .. docText .. '\n'
end
local action = 'edit'
local preload = ''
local colour = 'EAF4F9'
local message
local category
if noDoc then
action = 'create'
preload = '&preload=Template:Documentation/preload'
colour = 'F9EAEA'
message = "'''Ez a(z) " .. pageType .. " nem rendelkezik dokumentációval. " ..
"Ha ismered ezen " .. pageType .. " használatát, akkor kérlek, hozd létre!'''"
if not ( args.nocat or namespace == 'User' ) then
category = 'Dokumentáció nélküli ' .. pageType
if not mw.title.new( 'Category:' .. category ).exists then
category = 'Dokumentáció nélküli oldalak'
end
end
elseif badDoc then
colour = 'F9F2EA'
message = "'''Ezen " .. pageType .. " oldal dokumentációja fejlesztésre vagy további információk hozzáadására szorul.'''\n"
if not ( args.nocat or namespace == 'User' ) then
category = 'Rossz dokumentációval rendelkező ' .. pageType
if not mw.title.new( 'Category:' .. category ).exists then
category = 'Rossz dokumentációval rendelkező oldalak'
end
end
end
local links = {
'[' .. docPage:fullUrl( 'action=edit' .. preload ) .. ' ' .. action .. ']',
'[' .. docPage:fullUrl( 'action=history' ) .. ' laptörténet]',
'[' .. page:fullUrl( 'action=purge' ) .. ' purge]'
}
if not noDoc and page ~= docPage then
table.insert( links, 1, '[[' .. docPage.fullText .. '|megtekintés]]' )
end
links = mw.html.create( 'span' )
:css( 'float', 'right' )
:wikitext( mw.text.nowiki( '[' ), table.concat( links, ' | ' ), mw.text.nowiki( ']' ) )
local body = mw.html.create( 'div' ):addClass( 'documentation' )
body:css{
['background-color'] = '#' .. colour,
border = '1px solid #AAA',
padding = '0.8em 1em 0.7em',
['margin-top'] = '1em',
clear = 'both'
}
local header = mw.html.create( 'div' )
:css{
margin = '-0.8em -1em 0.8em',
padding = '0.8em 1em 0.7em',
['background-color'] = '#EAF4F9',
['border-bottom'] = 'inherit'
}
header
:node( links )
:tag( 'span' )
:css{
['font-weight'] = 'bold',
['font-size'] = '130%',
['margin-right'] = '1em',
['line-height'] = '1'
}
:wikitext( 'Dokumentáció' )
if not noDoc and pageType ~= 'sablon' and pageType ~= 'üzenet' then
header
:tag( 'span' )
:css( 'white-space', 'nowrap' )
:wikitext( '[[#the-code|Ugrás a kódhoz ↴]]' )
end
body
:node( header ):done()
:wikitext( message )
:wikitext( docText )
if not noDoc and page ~= docPage then
body
:tag( 'div' )
:css{
margin = '0.7em -1em -0.7em',
['background-color'] = '#EAF4F9',
['border-top'] = 'inherit',
padding = '0.8em 1em 0.7em',
clear = 'both'
}
:node( links )
:wikitext( 'Ez a dokumentáció a(z) [[', docPage.fullText, ']] oldalról van.' )
end
if category then
body:wikitext( f:expandTemplate{ title = 'Translation category', args = { category, project = '0' } } )
end
local anchor = ''
if not noDoc and pageType ~= 'sablon' and pageType ~= 'üzenet' then
anchor = mw.html.create( 'div' ):attr( 'id', 'the-code' )
end
return tostring( body ) .. tostring( anchor )
end
return p