« Module:EnCours » : différence entre les versions

De Adadov.net wiki
Aucun résumé des modifications
Aucun résumé des modifications
Ligne 74 : Ligne 74 :
     local category = categoryHandler{
     local category = categoryHandler{
         all = '[[Category:Rédaction en cours]]',
         all = '[[Category:Rédaction en cours]]',
         nocat = frame.args.nocat
         nocat = frame:getParent().args.nocat
     }
     }
     category = category or ''
     category = category or ''

Version du 4 février 2015 à 23:32

Documentation icon Documentation Module[voir] [éditer] [historique] [purger]

Ce module implémente {{Modèle:EnCours}}

local documentation = require('Module:Documentation').main
local categoryHandler = require( 'Module:Category handler' ).main
 
local p = {}

local function getType()
	local title = tostring(mw.title.getCurrentTitle())
	if string.match(title, "doc") then
		type = "doc"
	else
		type = "std"
	end
 
	p.type = type
 
	return type
end	

function p.showType()
	local type = p.getType()
	print(type)
	return type
end
 
function p.showTitle()
	print(tostring(mw.title.getCurrentTitle()))
end

function p.html(frame) 
	local img = "[[Image:Vlc.png|70px]]"
	local auteurName, auteur = ""
	if frame.args.auteur ~= nil then
		auteurName = frame.args.auteur
	end
	if auteurName == "" then 
		auteur = "'' Auteur / Editeur : '''Inconnu''' ''"
	else
		if frame.args.nolink ~= nil then
			auteur = "'' Auteur / Editeur : '''"..auteurName.."''' ''"
		else
			auteur = "'' Auteur / Editeur : '''[[Utilisateur:"..auteurName.."|"..auteurName.."]]''' ''"
		end
	end
	local textInfo = [[Le présent article est actuellement en cours de rédaction ou de modification.<br />
	Adressez-vous à la personne en charge pour toute proposition ou modification.]]
	
	local root = mw.html.create()
	root
		:tag('div')
			:addClass('wgTemplateWarning')
			:tag('table')
				:attr('align', 'center')
				:tag('caption')
					:cssText('color:red;font-weight:bold;')
					:wikitext('Article en cours de rédaction ou de modification&nbsp;!')
					:done()
				:tag('tr')
					:tag('td')
						:wikitext(img)
						:done()
					:done()
				:tag('tr')
					:tag('td')
						:wikitext(textInfo)
						:done()
					:done()
				:tag('tr')
					:tag('td')
						:attr('align', 'right')
						:wikitext(auteur)
						:done()
					:done()

    local category = categoryHandler{
        all = '[[Category:Rédaction en cours]]',
        nocat = frame:getParent().args.nocat
    }
    category = category or ''

	return tostring(root)..category
end

return p