このテンプレートは、以下のLuaモジュールを使用しています。 |
目的地テンプレートの種類を並べます。
関数
[編集]function ml.generateTableTypeList( frame )
{{#invoke:MarkerTypesList|generateTableTypeList}}
目的地テンプレートで使用可能な全ての種類のテーブルのHTMLを返します。この表には、日本語の翻訳、対応するグループ、及びウィキ構文で使用される英語の種類名が書かれます。
関連項目
[編集]この解説は、モジュール:MarkerTypesList/docから呼び出されています。 (編集 | 履歴) 編集者は、このモジュールをサンドボックス (作成 | 複製)とテストケース (作成)で試すことができます。(解説) このモジュールのサブページ一覧。 |
--[[ Generates a list of marker types ]]-- -- Module variable and administration local ml = { moduleInterface = { suite = 'MarkerTypesList', serial = '2024-08-26', item = 118040967 } } -- Language-dependent sorting substitutes local substitutes = {} local function convertForSort( s ) s = mw.ustring.lower( s ) for i, obj in ipairs( substitutes ) do s = mw.ustring.gsub( s, obj.l, obj.as ) end return s end -- generates a table with type documentation function ml.generateTableTypeList( frame ) -- Module import local mt = require( 'Module:Marker utilities/Types' ) local label local rows = {} for key, value in pairs( mt.types ) do label = value.label or value.alias or key if type( label ) == 'table' then label = label[ 1 ] or '' end table.insert( rows, ( '<tr><td>%s</td><td>%s</td><td>%s</td></tr>' ):format ( label:gsub( '_', ' ' ), value.group, key:gsub( '_', ' ' ) ) ) end table.sort( rows, function( a, b ) return convertForSort( a ) < convertForSort( b ) end ) table.insert( rows, 1, '<table class="wikitable sortable multiline" cellspacing="0">\n' .. ( '<tr><th>%s</th><th>%s</th><th>%s</th></tr>' ):format ( 'Beschriftung', 'Gruppe', 'Typ' ) ) table.insert( rows, '</table>' ) return table.concat( rows, '\n' ) end -- generates a table with group documentation function ml.generateTableGroupList( frame ) -- Module import local mg = require( 'Module:Marker utilities/Groups' ) local label local rows = {} for key, value in pairs( mg.groups ) do label = value.label or value.alias or key if type( label ) == 'table' then label = label[ 1 ] or '' end table.insert( rows, ( '<tr><td>%s</td><td>%s</td><td>%s</td><td style="background-color: %s; color: #fff;"> </td><td>%s</td></tr>' ):format ( label:gsub( '_', ' ' ), value.default or '', key:gsub( '_', ' ' ), value.color or '', value.color or '' ) ) end table.sort( rows, function( a, b ) return convertForSort( a ) < convertForSort( b ) end ) table.insert( rows, 1, '<table class="wikitable sortable multiline" cellspacing="0">\n' .. ( '<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>' ):format ( 'グループ名', 'Listing Editorでの既定の種類', '内部グループ名', '色', 'カラーコード' ) ) table.insert( rows, '</table>' ) return table.concat( rows, '\n' ) end return ml