Movatterモバイル変換


[0]ホーム

URL:


Jump to content
Wikimedia Meta-Wiki
Search

Module:Separated entries

Permanently protected module
From Meta, a Wikimedia project coordination wiki
Module documentation
You might want tocreate a documentation page for thisScribunto module.
Editors can experiment in this module’s sandbox(create |mirror) and testcases(create) pages.
Please add categories to the/doc subpage.Subpages of this module.
-- This module takes positional parameters as input and concatenates them with-- an optional separator. The final separator (the "conjunction") can be-- specified independently, enabling natural-language lists like-- "foo, bar, baz and qux". The starting parameter can also be specified.localcompressSparseArray=require('Module:TableTools').compressSparseArraylocalp={}functionp._main(args)localseparator=args.separator-- Decode (convert to Unicode) HTML escape sequences, such as "&#32;" for space.andmw.text.decode(args.separator)or''localconjunction=args.conjunctionandmw.text.decode(args.conjunction)orseparator-- Discard values before the starting parameter.localstart=tonumber(args.start)ifstartthenfori=1,start-1doargs[i]=nilendend-- Discard named parameters.localvalues=compressSparseArray(args)returnmw.text.listToText(values,separator,conjunction)endlocalfunctionlocalize(message,lang)iftype(message)=='table'andtype(message.inLanguage)=='function'theniftype(lang)=='string'andlang~=''thenmessage=message:inLanguage(lang)endreturnmessage:plain()elsereturnmessageendendlocalfunctionmakeInvokeFunction(separator,conjunction,first)returnfunction(frame)localargs=require('Module:Arguments').getArgs(frame)args.separator=localize(separatororargs.separator,args.lang)args.conjunction=localize(conjunctionorargs.conjunction,args.lang)args.first=firstorargs.firstreturnp._main(args)endendp.main=makeInvokeFunction()p.br=makeInvokeFunction('<br />')p.comma=makeInvokeFunction(mw.message.new('comma-separator'))returnp
Retrieved from "https://meta.wikimedia.org/w/index.php?title=Module:Separated_entries&oldid=22585497"
Category:

[8]ページ先頭

©2009-2025 Movatter.jp