<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AUser_scripts_table</id>
	<title>Module:User scripts table - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AUser_scripts_table"/>
	<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:User_scripts_table&amp;action=history"/>
	<updated>2026-06-16T20:59:03Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.3</generator>
	<entry>
		<id>https://mywikibiz.com/index.php?title=Module:User_scripts_table&amp;diff=479945&amp;oldid=prev</id>
		<title>Zoran: Pywikibot 6.4.0</title>
		<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:User_scripts_table&amp;diff=479945&amp;oldid=prev"/>
		<updated>2021-07-16T07:50:00Z</updated>

		<summary type="html">&lt;p&gt;Pywikibot 6.4.0&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
local function allcases(s)&lt;br /&gt;
	return s:gsub('([%^%$%(%)%%%.%[%]%*%+%-])', '%%%1')&lt;br /&gt;
		:gsub('%a', function(letter) return '['..letter:upper()..letter:lower()..']' end)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
    local rowsToGet = tonumber(frame.args[1]) or 200  -- use this to determine number of rows to get (default 200)&lt;br /&gt;
    local rowOffset = tonumber(frame.args[2]) or 0   -- use this offset to allow multiple calls to build larger table   &lt;br /&gt;
    local source = mw.title.new('Wikipedia:User scripts/Most imported scripts'):getContent()&lt;br /&gt;
    local data = {}&lt;br /&gt;
	local rows = mw.html.create()&lt;br /&gt;
    local count = 0&lt;br /&gt;
    for script, total, active in source:gmatch('\n| %[%[([^%]]+)%]%] -\n| (%d+) -\n| (%d+)') do&lt;br /&gt;
		count = count + 1&lt;br /&gt;
		if count &amp;gt; rowOffset then&lt;br /&gt;
			local redirectTarget = mw.title.new(script).redirectTarget&lt;br /&gt;
			if redirectTarget then script = redirectTarget.prefixedText end&lt;br /&gt;
			local jsContent = mw.title.new(script):getContent()&lt;br /&gt;
			-- don't include scripts that have been blanked or redirected as non-functional&lt;br /&gt;
			if not jsContent:find(&amp;quot;mw.log.warn( 'You installed the userscript&amp;quot;, 1, true) then&lt;br /&gt;
				data[script] = { total = total, active = active }&lt;br /&gt;
				local desc = script:match('(.-)%.[CJcj][Ss][Ss]?$')&lt;br /&gt;
				local redirectTarget = mw.title.new(desc).redirectTarget&lt;br /&gt;
				if redirectTarget then desc = redirectTarget.prefixedText end&lt;br /&gt;
				local name = desc:match('([^/:]-)$')&lt;br /&gt;
				local author = script:match('User:([^%/]+)')&lt;br /&gt;
				local excerpt = mw.title.new(desc):getContent() or ''&lt;br /&gt;
				if excerpt ~= '' then&lt;br /&gt;
					excerpt = mw.text.truncate(excerpt&lt;br /&gt;
						--keep descriptions from template params&lt;br /&gt;
						--expand {{u}} at top level&lt;br /&gt;
						--remove other templates&lt;br /&gt;
						:gsub(&amp;quot;%b{}&amp;quot;, function(bracketed)&lt;br /&gt;
							local desc_first, desc_rest = bracketed:match('|%s*[Dd][Ee][Ss][Cc][^=]+=%s*([^|])([^|]+)|')&lt;br /&gt;
							if desc_first then&lt;br /&gt;
								return desc_first:upper() .. desc_rest&lt;br /&gt;
							end&lt;br /&gt;
							local user = bracketed:find &amp;quot;^{{[Uu]|([^}]+)}}&amp;quot;&lt;br /&gt;
							if user then&lt;br /&gt;
								return '[[User:' .. user .. '|' .. user .. ']]'&lt;br /&gt;
							end&lt;br /&gt;
							if bracketed:find('^{{') and bracketed:find('}}$') then&lt;br /&gt;
								return ''&lt;br /&gt;
							end&lt;br /&gt;
						end)&lt;br /&gt;
						--strip out images, files, media, categories&lt;br /&gt;
						:gsub('%b[]',&lt;br /&gt;
							function(bracketed)&lt;br /&gt;
								return bracketed:gsub('^%[%[%s*(%a+):.-%]%]$',&lt;br /&gt;
									function(link_prefix)&lt;br /&gt;
										link_prefix = link_prefix:lower()&lt;br /&gt;
										if link_prefix == &amp;quot;image&amp;quot; or link_prefix == &amp;quot;file&amp;quot;&lt;br /&gt;
										or link_prefix == &amp;quot;media&amp;quot; or link_prefix == &amp;quot;category&amp;quot; then&lt;br /&gt;
											return &amp;quot;&amp;quot;&lt;br /&gt;
										end -- otherwise leave it alone&lt;br /&gt;
									end)&lt;br /&gt;
							end)&lt;br /&gt;
						--remove spans while keeping text inside&lt;br /&gt;
						--strip out remaining tags and the text inside&lt;br /&gt;
						:gsub('&amp;lt;(%a+)[^&amp;gt;]+&amp;gt;(.-)&amp;lt;/%1&amp;gt;', function(tag, contents)&lt;br /&gt;
							if tag:lower() == &amp;quot;span&amp;quot; then&lt;br /&gt;
								return contents&lt;br /&gt;
							else&lt;br /&gt;
								return &amp;quot;&amp;quot;&lt;br /&gt;
							end&lt;br /&gt;
						end)&lt;br /&gt;
						:gsub('%b&amp;lt;&amp;gt;', '') --remove any other tag markup&lt;br /&gt;
						:gsub('__[^_]+__', '') --remove __ markups&lt;br /&gt;
						:gsub('^=+[^=]+=+', ''):gsub('\n=+[^=]+=+', '') --remove section titles&lt;br /&gt;
						:gsub(&amp;quot;''+&amp;quot;, &amp;quot;&amp;quot;) --strip out bold and italic markup&lt;br /&gt;
						:gsub('&amp;amp;nbsp;', ' ') --replace nbsp spaces with regular spaces&lt;br /&gt;
						:gsub('^[:;%s]+', ''):gsub('\n[:;%s]+', '\n') --strip indents, leading&lt;br /&gt;
						:gsub('{|.-\n|}', '') --remove tables&lt;br /&gt;
						:gsub('\n|[^\n]*\n', '') --remove table fragments&lt;br /&gt;
						:gsub('%s+\n', '\n') --and trailing spaces&lt;br /&gt;
						:gsub('(%s)%s+', '%1') --strip redundant spaces&lt;br /&gt;
						:gsub(allcases(name)..'(%s)', &amp;quot;'''&amp;quot;..name..&amp;quot;'''%1&amp;quot;)&lt;br /&gt;
						, 600, ''):gsub('(.+)\n', '%1') -- truncate at end of last paragraph before 600 chars&lt;br /&gt;
						..' '..'[['..desc..'|→]]'&lt;br /&gt;
				end&lt;br /&gt;
				if not excerpt then excerpt = '' end&lt;br /&gt;
				local row = rows:tag('tr'):attr('id', script):attr('style','vertical-align:top')&lt;br /&gt;
				row:tag('td'):wikitext(string.format('\'\'\'[[%s|%s]]\'\'\'&amp;lt;span id=&amp;quot;%s&amp;quot; class=scriptInstallerLink&amp;gt;&amp;lt;/span&amp;gt;', script, name, script))&lt;br /&gt;
				row:tag('td'):wikitext(string.format('[[User:%s|%s]]', author, author))&lt;br /&gt;
				row:tag('td'):wikitext(frame:callParserFunction('#time', 'j M Y', frame:callParserFunction('REVISIONTIMESTAMP', script))):addClass('nowrap'):attr('style','text-align:right')&lt;br /&gt;
				row:tag('td'):wikitext(excerpt .. '&amp;lt;!-- --&amp;gt;') -- add an empty HTML comment so that if the excerpt ends with an unclosed comment &lt;br /&gt;
				-- (such as [[User:Steel359/Protection js]]), it doesn't break things&lt;br /&gt;
				row:tag('td'):wikitext(data[script].active):attr('style','text-align:right')&lt;br /&gt;
				row:tag('td'):wikitext(data[script].total):attr('style','text-align:right')&lt;br /&gt;
				rows:wikitext('\n')&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	    if count &amp;gt;= rowsToGet + rowOffset then break end&lt;br /&gt;
    end&lt;br /&gt;
    return rows&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Zoran</name></author>
	</entry>
</feed>