문서 편집 권한이 없습니다. 다음 이유를 확인해주세요: 요청한 명령은 다음 권한을 가진 사용자에게 제한됩니다: 사용자. 문서의 원본을 보거나 복사할 수 있습니다. -- This is a simple module to strip categories from wikitext. It does -- not support nested links or magic words like __TOC__, etc. Even so, -- it should still handle most categories. -- 태국어(th) 위키백과에서 가져옴 local p = {} -- Detects if a category link is valid or not. If it is valid, -- the function returns the blank string. If not, the input -- is returned with no changes. local function processCategory( all, submatch ) local beforePipe = mw.ustring.match( submatch, '^(.-)[%s_]*|[%s_]*.-$' ) beforePipe = beforePipe or submatch if mw.ustring.match( beforePipe, '[%[%]<>{}%c\n]' ) then return all else return '' end end -- Preprocess the content if we aren't being called from #invoke, -- and pass it to gsub to remove valid category links. local function suppress( content, isPreprocessed ) if not isPreprocessed then content = mw.getCurrentFrame():preprocess( content ) end categoryList = {'[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]', '분류'} for _, category in ipairs(categoryList) do content = mw.ustring.gsub( content, '(%[%[[%s_]*' .. category .. '[%s_]*:[%s_]*(.-)[%s_]*%]%])', processCategory ) end return content end -- Get the content to suppress categories from, and find -- whether the content has already been preprocessed. (If the -- module is called from #invoke, it has been preprocessed already.) function p.main( frame ) local content, isPreprocessed if frame == mw.getCurrentFrame() then content = frame:getParent().args[1] if frame.args[1] then content = frame.args[1] end isPreprocessed = true else content = frame isPreprocessed = false end return suppress( content, isPreprocessed ) end return p 이 문서에서 사용한 틀: 모듈:Suppress categories (원본 보기) 모듈:Suppress categories/설명문서 (원본 보기) 모듈:Suppress categories 문서로 돌아갑니다.