[voir] [modifier] [historique] [purger]
Voir aussi
[modifier le wikicode]Catégories générées
[modifier le wikicode]La documentation de ce module est générée par le modèle {{Documentation}}.
Elle est incluse depuis la page Module:Symbole/doc. Veuillez placer les catégories sur cette page-là.
Les éditeurs peuvent travailler dans le bac à sable (créer).
Voir les statistiques d'appel depuis le wikicode sur l'outil wstat et les appels depuis d'autres modules.
--[[ Source script: https://fr.wikivoyage.org/wiki/Module:Symbole Maintainer: Andyrom75 ]] local i18n = require( 'Module:Symbole/i18n' ) local function _templateStyle( frame, src ) return frame:extensionTag( 'templatestyles', '', { src = src } ) end local function _isDefined(s) return s ~= '' and s end local function _errMsg(errCode, additionalText) local errMsg = mw.html.create( 'span' ) :addClass('debuginfo') :wikitext( i18n.errorMsg[errCode] .. (additionalText or '')) return '[[Category:' .. i18n.categories[errCode] .. ']]' .. tostring(errMsg) end local function _ucfirst(str) return (str:gsub("^%l", string.upper)) end local function _trim(str) return (str:gsub("^%s*(.-)%s*$", "%1")) end local function _Symbole(frame) local args = frame.args local output = '' local maxPositionalArg = 0 -- conterrà il numero max di parametri posizionali anche se ci sono nil nel mezzo for nextPosArg in pairs(args) do if type(nextPosArg) == "number" and nextPosArg > maxPositionalArg then maxPositionalArg = nextPosArg end end for pos = 1, maxPositionalArg do local key = args and args[pos] and _trim(string.lower(args[pos])) or '' if key == '' then output = output .. _errMsg('noInput') else local values = i18n.symboleValues[key] if not _isDefined(values) then output = output .. _errMsg('wrongPar', ': <b>' .. key .. '</b>') else local image = values[1] or i18n.icons.wrongPar local class = values[2] or '' -- i parametri taille, lien e description, li uso solo se ho un solo simbolo da mostrare, altrimenti li applicherei erroneamente a tutti local px = (maxPositionalArg == 1) and args.taille or _isDefined(values[3]) or '20px' local link = (maxPositionalArg == 1) and args.lien or _isDefined(values[4]) or '' local description = (maxPositionalArg == 1) and args.description and _ucfirst(args.description) or _isDefined(values[5]) or _ucfirst(args[1]) output = output .. ((pos>1) and ' ' or '') .. '[[File:' .. image .. (_isDefined(class) and ("|class=" .. class) or '') .. '|' .. px .. (_isDefined(link) and ("|link=" .. link) or '') .. '|' .. description .. ']]' end end end return _templateStyle( frame, 'Symbole/styles.css' ) .. output end local p = {} function p.SymboleTemplate(frame) return _Symbole(frame:getParent()) end function p.SymboleInvoke(frame) return _Symbole(frame) end function p.SymboleModule(frame) local Cframe = mw.getCurrentFrame() Cframe.args = frame.args return _Symbole(Cframe) end return p 
French
Deutsch