Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Module:Parameter names example

Permanently protected module
From Wikipedia, the free encyclopedia
Module documentation[view] [edit] [history] [purge]
{{{title}}}
{{{above}}}
{{{subheader}}}
{{{image}}}
{{{caption}}}
{{{header1}}}
{{{label2}}}{{{data2}}}
{{{label3}}}{{{data3}}}
{{{below}}}

This module implements{{Parameter names example}} (also known as{{Generic template demo}}). It creates a template demonstration such as that shown opposite. Please seethe template page for full documentation.

The abovedocumentation istranscluded fromModule:Parameter names example/doc.(edit |history)
Editors can experiment in this module'ssandbox(edit |diff) and testcases(create) pages.
Subpages of this module.

-- This module implements {{parameter names example}}.localp={}localfunctionmakeParam(s)locallb='{'localrb='}'returnlb:rep(3)..s..rb:rep(3)endlocalfunctionitalicize(s)return"''"..s.."''"endlocalfunctionplain(s)returnsendfunctionp._main(args,frame)-- Find how we want to format the arguments to the template.localformatFuncifargs._display=='italics'orargs._display=='italic'thenformatFunc=italicizeelseifargs._display=='plain'thenformatFunc=plainelseformatFunc=makeParamend-- Build the table of template arguments.localtargs={}fork,vinpairs(args)doiftype(k)=='number'thentargs[v]=formatFunc(v)elseifnotk:find('^_')thentargs[k]=vendend--targs['nocat'] = 'yes';--targs['categories'] = 'no';--targs['demo'] = 'yes';-- Find the template name.localtemplateifargs._templatethentemplate=args._templateelselocalcurrentTitle=mw.title.getCurrentTitle()ifcurrentTitle.prefixedText:find('/sandbox$')thentemplate=currentTitle.prefixedTextelsetemplate=currentTitle.basePageTitle.prefixedTextendend-- Call the template with the arguments.frame=frameormw.getCurrentFrame()localsuccess,result=pcall(frame.expandTemplate,frame,{title=template,args=targs})ifsuccessthenreturnresultelsereturn''endendfunctionp.main(frame)localargs=require('Module:Arguments').getArgs(frame,{wrappers='Template:Parameter names example'})returnp._main(args,frame)endreturnp
Retrieved from "https://en.wikipedia.org/w/index.php?title=Module:Parameter_names_example&oldid=1287053738"
Hidden category:

[8]ページ先頭

©2009-2025 Movatter.jp