Module:Contentious topics/aware
![]() | This module is used in MediaWiki:Abusefilter-warning-CT. Changes to it can cause immediate changes to the Bharatpedia user interface. To avoid large-scale disruption, any changes should first be tested in this module's /sandbox or /testcases subpage, or in your own user space. The tested changes can then be added in one single edit to this module. Please discuss any changes on the talk page before implementing them. |
See doc at Template:Contentious topics/aware/doc
local p = {} local getArgs = require('Module:Arguments').getArgs function p.detect(frame) local title local args = getArgs(frame) if args.testTitle then title = mw.title.new(args.testTitle) else title = mw.title.getCurrentTitle() end local content = title:getContent() or '' local codes = string.match(content, "{{%s-[cC]ontentious [tT]opics/[aA]ware%s-|([^}]-)}}") local shortcutCodes = string.match(content, "{{%s-[cC][tT]/[aA]ware%s-|([^}]-)}}") local dsCodes = string.match(content, "{{%s-D[sS]/[aA]ware%s-|([^}]-)}}") if (not codes) and (not dsCodes) and (not shortcutCodes) then return end local text if ( codes ) then text = p._listToText(frame, mw.text.split(codes, "|")) elseif ( dsCodes ) then text = p._listToText(frame, mw.text.split(dsCodes, "|")) else text = p._listToText(frame, mw.text.split(shortcutCodes, "|")) end return frame:preprocess( "<div style = 'font-weight: bold'>It is not necessary to notify this user about the following topics being contentious topics:" ..text.. "\n The user has indicated that they are already aware using the template <nowiki>{{Contentious topics/aware}}</nowiki> on their talk page.</div>" ) end function p.listToText(frame) return p._listToText(frame, getArgs(frame)) end function p._listToText(frame, t) local new = {} local t = require('Module:TableTools').compressSparseArray(t) for i,v in ipairs(t) do table.insert(new, frame:expandTemplate{title = 'Contentious_topics/list', args = {["scope"] = v}}) end return '\n*'..table.concat(new, '\n*') end return p