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

De Adadov.net wiki
Aucun résumé des modifications
Aucun résumé des modifications
 
(43 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
local documentation = require('Module:Documentation').main
local documentation = require('Module:Documentation').main
 
local categoryHandler = require('Module:Category handler').main
local p = {}
local p = {}


Ligne 26 : Ligne 27 :
end
end


function p.html( frame )  
function p.html(frame)  
local img = "[[Image:Vlc.png|70px]]"
local img = "[[Image:WorkInProgress.png|70px]]"
local auteurName = frame.args.auteur
local auteurName, auteur = ""
local auteur = "'' Auteur / Editeur : ".."[[Utilisateur:{{{auteurName}}}|{{{auteurName}}}]]"
local lastedit = "'' Dernière édition : '''"..frame.args.lastedit.."''' ''"
if frame.args.auteur then
auteurName = frame.args.auteur
end
 
if auteurName == "" then
auteur = "'' Auteur / Editeur : '''Inconnu''' ''"
else
if frame:getParent().args.nolink 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 />
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.]]
Adressez-vous à la personne en charge pour toute proposition ou modification.]]
local text = [[<div class="wgTemplateWarning">
{| align="center"
|+ style="color:red;font-weight:bold;"| Article en cours de rédaction ou de modification !
| ]]..img..[[
|-
|style="font-size:0.85em;"|]]..textInfo..[[
|-
|align="right"|]] .. auteur .. [[
|}
</div>]]


return text
local root = mw.html.create()
root
:tag('div')
:addClass('wgTemplateWarning')
:addClass('redacEnCours')
: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')
:addClass('enCoursInfos')
:tag('td')
:attr('align', 'right')
:wikitext(auteur)
:done()
:done()
:tag('tr')
:addClass('enCoursInfos')
:tag('td')
:attr('align', 'right')
:wikitext(lastedit)
:done()
:done()
 
    local category = categoryHandler{
        all = '[[Category:Rédaction en cours]]',
        nocat = frame:getParent().args.nocat
    }
    category = category or ''
 
return tostring(root)..category
end
end


return p
return p

Dernière version du 21 mai 2018 à 15:19

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:WorkInProgress.png|70px]]"
	local auteurName, auteur = ""
	local lastedit = "'' Dernière édition : '''"..frame.args.lastedit.."''' ''"
	
	if frame.args.auteur then
		auteurName = frame.args.auteur
	end

	if auteurName == "" then 
		auteur = "'' Auteur / Editeur : '''Inconnu''' ''"
	else
		if frame:getParent().args.nolink 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')
			:addClass('redacEnCours')
			: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')
				:addClass('enCoursInfos')
					:tag('td')
						:attr('align', 'right')
						:wikitext(auteur)
						:done()
					:done()
				:tag('tr')
				:addClass('enCoursInfos')
					:tag('td')
						:attr('align', 'right')
						:wikitext(lastedit)
						: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