検索を切り替える
検索
メニューを切り替える
39
12
1
569
Sleeping Cocoon-wiki
案内
メインページ
最近の更新
おまかせ表示
MediaWikiについてのヘルプ
特別ページ
ファイルをアップロード
Toggle preferences menu
通知
個人設定を切り替える
ログインしていません
編集を行うと、IPアドレスが公開されます。
user-interface-preferences
個人用ツール
トーク
投稿記録
アカウント作成
ログイン
「
モジュール:Documentation
」を編集中
提供:Sleeping Cocoon-wiki
このページを共有
表示
閲覧
編集
履歴表示
associated-pages
モジュール
議論
その他の操作
警告:
ログインしていません。編集を行うと、あなたの IP アドレスが公開されます。
ログイン
または
アカウントを作成
すれば、あなたの編集はその利用者名とともに表示されるほか、その他の利点もあります。
スパム攻撃防止用のチェックです。 けっして、ここには、値の入力は
しない
でください!
local p = {} local defaultDocPage = 'doc' local getType = function( namespace, page ) local pageType = 'template' if namespace == 828 then pageType = 'module' elseif namespace == 274 then pageType = 'widget' elseif page.fullText:gsub( '/' .. defaultDocPage .. '$', '' ):find( '%.css$' ) then pageType = 'stylesheet' elseif page.fullText:gsub( '/' .. defaultDocPage .. '$', '' ):find( '%.js$' ) then pageType = 'script' elseif namespace == 8 then pageType = 'message' end return pageType end -- Creating a documentation page or transclution through {{subst:doc}} function p.create( f ) local args = require( 'Module:ProcessArgs' ).norm() local page = mw.title.getCurrentTitle() local docPage = args.page or page.nsText .. ':' .. page.baseText .. '/' .. defaultDocPage local out if not args.content and tostring( page ) == docPage then out = f:preprocess( '{{subst:Template:Documentation/preload}}' ) else local templateArgs = {} for _, key in ipairs{ 'type', 'page', 'content' } do local val = args[key] if val then if key == 'content' then val = '\n' .. val .. '\n' end table.insert( templateArgs, key .. '=' .. val ) end end out = '{{documentation|' .. table.concat( templateArgs, '|' ) .. '}}' out = out:gsub( '|}}', '}}' ) if not args.content then out = out .. '\n<!-- カテゴリと言語間リンクはここではなく、解説ページに追加してください -->' end end if not mw.isSubsting() then out = f:preprocess( out ) if not args.nocat then out = out .. '[[Category:テンプレートの置換を必要とするページ]]' end end return out end -- Header on the documentation page function p.docPage( f ) local function getMainPage(page) local text = page.fullText local lastpos = (text:reverse()):find("/") return (text:sub(1, text:len() - (lastpos or 0))) end local args = require( 'Module:ProcessArgs' ).merge( true ) local badDoc = args.baddoc if f:callParserFunction( '#var', '$doc noheader' ) == '1' then if badDoc then f:callParserFunction( '#vardefine', '$doc bad', '1' ) end return end local page = mw.title.getCurrentTitle() local namespace = page.namespace local pageType = mw.ustring.lower( args.type or getType( namespace, page ) ) local mainPage = getMainPage(page) if page.fullText == mainPage then return end local body = mw.html.create( 'div' ):addClass( 'documentation-header' ) body :css{ ['margin-bottom'] = '0.8em', padding = '0.8em 1em 0.7em', ['background-color'] = '#' .. ( badDoc and 'F9F2EA' or 'EAF4F9' ), border = '1px solid #AAA' } :tag( 'div' ) :css( 'float', 'right' ) :wikitext( '[[', page:fullUrl( 'action=purge' ), ' キャッシュ破棄]]' ) :done() :wikitext( 'これはドキュメントページです。 このページは ', ' メインページ:[[', mainPage, ']] へ転記されます。 ', '詳細は [[Template:Documentation]] を参照してください。' ) if badDoc then body:wikitext( "<br>'''この ", pageType, " のドキュメントは改善または追加情報が必要です。'''" ) end if not ( args.nocat or namespace == 'User' ) then body:wikitext( '[[Category:解説ページ]]' ) end return body end -- Wrapper around the documentation on the main page function p.page( f ) -- mw.text.trim uses mw.ustring.gsub, which silently fails on large strings local function trim( s ) return (s:gsub( '^[\t\r\n\f ]+', '' ):gsub( '[\t\r\n\f ]+$', '' )) --return string.gsub( s, '^[\t\r\n\f ]*(.-)[\t\r\n\f ]*$', '%1' ) end local args = require( 'Module:ProcessArgs' ).merge( true ) local page = mw.title.getCurrentTitle() local namespace = page.nsText local docText = trim( args.content or '' ) if docText == '' then docText = nil end local docPage local noDoc if docText then docPage = page else docPage = mw.title.new( args.page or namespace .. ':' .. page.text .. '/' .. defaultDocPage ) noDoc = args.nodoc or not docPage.exists end local badDoc = args.baddoc local pageType = mw.ustring.lower( args.type or getType( namespace, page ) ) if not docText and not noDoc then f:callParserFunction( '#vardefine', '$doc noheader', '1' ) docText = trim( f:expandTemplate{ title = ':' .. docPage.fullText } ) if f:callParserFunction( '#var', '$doc bad' ) == '1' then badDoc = 1 end if docText == '' then docText = nil noDoc = 1 end end if docText then docText = '\n' .. docText .. '\n' end local action = '編集' local preload = '' local colour = 'EAF4F9' local message local category if noDoc then action = '作成' preload = '&preload=Template:Documentation/preload' colour = 'F9EAEA' message = "'''この " .. pageType .. " にはドキュメントページがありません。 " .. "この " .. pageType .. " の使用方法が分かる方はどうか記事の作成をお願いします。''' " .. "[[".. docPage.fullText.. "]]<br>" .. "'''また、Wikipediaの同名のページにドキュメントが存在するかもしれません。''' " .. "[https://en.wikipedia.org/wiki/" .. pageType .. ":" .. mw.ustring.gsub(page.text, " ", "_") .. " w:" .. pageType .. ":" .. page.text .. "]" if not ( args.nocat or namespace == 'User' ) then category = '解説のない' .. pageType if not mw.title.new( 'Category:' .. category ).exists then category = '解説のないページ' end end elseif badDoc then colour = 'F9F2EA' message = "'''この " .. pageType .. " のドキュメントは、改善または追加情報が必要です。'''\n" if not ( args.nocat or namespace == 'User' ) then category = '不適切な解説を含む' .. pageType if not mw.title.new( 'Category:' .. category ).exists then category = '不適切な内容を含むページ' end end end local links = { '[' .. docPage:fullUrl( 'action=edit' .. preload ) .. ' ' .. action .. ']', '[' .. docPage:fullUrl( 'action=history' ) .. ' 履歴]', '[' .. page:fullUrl( 'action=purge' ) .. ' キャッシュ破棄]' } if not noDoc and page ~= docPage then table.insert( links, 1, '[[' .. docPage.fullText .. '|閲覧]]' ) end links = mw.html.create( 'span' ) :css( 'float', 'right' ) :wikitext( mw.text.nowiki( '[' ), table.concat( links, ' | ' ), mw.text.nowiki( ']' ) ) local body = mw.html.create( 'div' ):addClass( 'documentation' ) body:css{ ['background-color'] = '#' .. colour, border = '1px solid #AAA', padding = '0.8em 1em 0.7em', ['margin-top'] = '1em', clear = 'both' } local header = mw.html.create( 'div' ) :css{ margin = '-0.8em -1em 0.8em', padding = '0.8em 1em 0.7em', ['background-color'] = '#EAF4F9', ['border-bottom'] = 'inherit' } header :node( links ) :tag( 'span' ) :css{ ['font-weight'] = 'bold', ['font-size'] = '130%', ['margin-right'] = '1em', ['line-height'] = '1' } :wikitext( 'ドキュメント' ) local codePages = { module = true, stylesheet = true, script = true, } if not noDoc and codePages[pageType] then header :tag( 'span' ) :css( 'white-space', 'nowrap' ) :wikitext( '[[#the-code|Jump to code ↴]]' ) end body :node( header ):done() :wikitext( message ) :wikitext( docText ) if not noDoc and page ~= docPage then body :tag( 'div' ) :css{ margin = '0.7em -1em -0.7em', ['background-color'] = '#EAF4F9', ['border-top'] = 'inherit', padding = '0.8em 1em 0.7em', clear = 'both' } :node( links ) :wikitext( '上記の記事は次のページから転記しています: [[', docPage.fullText, ']].' ) end if category then body:wikitext( f:expandTemplate{ title = 'Translation category', args = { category, project = '0' } } ) end local anchor = '' if not noDoc and pageType ~= 'template' and pageType ~= 'message' then anchor = mw.html.create( 'div' ):attr( 'id', 'the-code' ) end return tostring( body ) .. tostring( anchor ) end return p
編集内容の要約:
『眠ル繭wiki』への投稿はすべて、他の投稿者によって編集、変更、除去される場合があります。 自分が書いたものが他の人に容赦なく編集されるのを望まない場合は、ここに投稿しないでください。
また、投稿するのは、自分で書いたものか、パブリック ドメインまたはそれに類するフリーな資料からの複製であることを約束してください(詳細は
Sleeping Cocoon-wiki:著作権
を参照)。
著作権保護されている作品は、許諾なしに投稿しないでください!
キャンセル
編集の仕方
(新しいウィンドウで開きます)
このページで使用されているテンプレート:
モジュール:Documentation/doc
(
編集
)