Module:URL
Εμφάνιση

![]() | Αυτό το Lua moduleχρησιμοποιείται σε περίπου 180 σελίδες, οπότε αλλαγές σε αυτό θα γίνουν ευρέως αντιληπτές. Παρακαλούμε δοκιμάστε οποιεσδήποτε αλλαγές στις υποσελίδες /πρόχειρο ή /testcases του προτύπου, ή στις προσωπικες σας υποσελίδες χρήστη. Παρακαλούμε φροντίστε να συζητήσετε τις αλλαγές στη σελίδα συζήτησης πριν τις εφαρμόσετε. |
![]() | This module is rated as alpha. It is ready for third party input, and may be used on a few pages to see if problems arise, but should be watched. Suggestions for new features or changes in their input and output mechanisms are welcome. |
The module “URL” contains (specify) available calls that make so and such.
Usage
{{#invoke:URL|function_name|…}}
Parameters
The text below assumes that functions are declared as
function p.function_name( frame )
- Positional parameters – the value of frame.args[1] is passed after function name and vertical bar, the value of frame.args[2] is passed after the value of frame.args[1] and vertical bar, and so on.
- Named parameters (specify them) – the same name=value syntax as in MediaWiki templates, are accessible inside the function as frame.args["name"].
Examples
Lua error at line 1: attempt to index global 'p' (a nil value).
function p.url(frame)
local templateArgs = frame.args
local parentArgs = frame:getParent().args
local url = templateArgs[1] or parentArgs[1] or ''
local text = templateArgs[2] or parentArgs[2]
if not text then
url = url or extractUrl(templateArgs) or extractUrl(parentArgs);
end
text = text or ''
return p._url(url, text)
end