<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>https://wiki.iccup.org/index.php?action=history&amp;feed=atom&amp;title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C%3ACite_RSI</id>
	<title>Модуль:Cite RSI - История изменений</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.iccup.org/index.php?action=history&amp;feed=atom&amp;title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C%3ACite_RSI"/>
	<link rel="alternate" type="text/html" href="https://wiki.iccup.org/index.php?title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C:Cite_RSI&amp;action=history"/>
	<updated>2026-06-01T08:46:52Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://wiki.iccup.org/index.php?title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C:Cite_RSI&amp;diff=108&amp;oldid=prev</id>
		<title>DarkMuse: Новая страница: «local p = {} local args  --- Helper function checking if a substring is in a string -- -- @param needle string - Value to search for -- @param haystack string - String to search in -- -- @return bool - True if found local function stringContains( needle, haystack )     return string.find( mw.ustring.lower( haystack ), needle, 1, true ) end  -- This is from Module:String2 -- FIXME: Figure out how to call in from Lua properly local function titlecase( text )...»</title>
		<link rel="alternate" type="text/html" href="https://wiki.iccup.org/index.php?title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C:Cite_RSI&amp;diff=108&amp;oldid=prev"/>
		<updated>2024-08-31T14:04:43Z</updated>

		<summary type="html">&lt;p&gt;Новая страница: «local p = {} local args  --- Helper function checking if a substring is in a string -- -- @param needle string - Value to search for -- @param haystack string - String to search in -- -- @return bool - True if found local function stringContains( needle, haystack )     return string.find( mw.ustring.lower( haystack ), needle, 1, true ) end  -- This is from Module:String2 -- FIXME: Figure out how to call in from Lua properly local function titlecase( text )...»&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
local args&lt;br /&gt;
&lt;br /&gt;
--- Helper function checking if a substring is in a string&lt;br /&gt;
--&lt;br /&gt;
-- @param needle string - Value to search for&lt;br /&gt;
-- @param haystack string - String to search in&lt;br /&gt;
--&lt;br /&gt;
-- @return bool - True if found&lt;br /&gt;
local function stringContains( needle, haystack )&lt;br /&gt;
    return string.find( mw.ustring.lower( haystack ), needle, 1, true )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- This is from Module:String2&lt;br /&gt;
-- FIXME: Figure out how to call in from Lua properly&lt;br /&gt;
local function titlecase( text )&lt;br /&gt;
	local alwayslower = {[&amp;#039;a&amp;#039;] = 1, [&amp;#039;an&amp;#039;] = 1, [&amp;#039;the&amp;#039;] = 1,&lt;br /&gt;
	[&amp;#039;and&amp;#039;] = 1, [&amp;#039;but&amp;#039;] = 1, [&amp;#039;or&amp;#039;] = 1, [&amp;#039;for&amp;#039;] = 1,&lt;br /&gt;
	[&amp;#039;nor&amp;#039;] = 1, [&amp;#039;on&amp;#039;] = 1, [&amp;#039;in&amp;#039;] = 1, [&amp;#039;at&amp;#039;] = 1, [&amp;#039;to&amp;#039;] = 1,&lt;br /&gt;
	[&amp;#039;from&amp;#039;] = 1, [&amp;#039;by&amp;#039;] = 1, [&amp;#039;of&amp;#039;] = 1, [&amp;#039;up&amp;#039;] = 1 }&lt;br /&gt;
	local res = &amp;#039;&amp;#039;&lt;br /&gt;
	local s =  mw.text.trim( text or &amp;quot;&amp;quot; )&lt;br /&gt;
	local words = mw.text.split( s, &amp;quot; &amp;quot;)&lt;br /&gt;
	for i, s in ipairs(words) do&lt;br /&gt;
		-- {{lc:}} is strip-marker safe, string.lower is not.&lt;br /&gt;
		s = mw.getCurrentFrame():callParserFunction(&amp;#039;lc&amp;#039;, s)&lt;br /&gt;
		if i == 1 or alwayslower[s] ~= 1 then&lt;br /&gt;
			s = mw.getContentLanguage():ucfirst(s)&lt;br /&gt;
		end&lt;br /&gt;
		words[i] = s&lt;br /&gt;
	end&lt;br /&gt;
	return table.concat(words, &amp;quot; &amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Remove hyphen and format string into title case&lt;br /&gt;
--&lt;br /&gt;
-- @param title string&lt;br /&gt;
--&lt;br /&gt;
-- @return string&lt;br /&gt;
local function formatTitle( title )&lt;br /&gt;
	if title == nil or title == &amp;#039;&amp;#039; then return title end&lt;br /&gt;
&lt;br /&gt;
	-- Replace hyphens with space&lt;br /&gt;
	title = string.gsub( title, &amp;#039;-&amp;#039;, &amp;#039; &amp;#039; )&lt;br /&gt;
	-- Format into title case&lt;br /&gt;
	title = titlecase( title )&lt;br /&gt;
&lt;br /&gt;
	return title&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- @param url string&lt;br /&gt;
--&lt;br /&gt;
-- @return string&lt;br /&gt;
local function sanitizeURL( url )&lt;br /&gt;
	local santizedURL&lt;br /&gt;
&lt;br /&gt;
	if stringContains(&amp;#039;robertsspaceindustries.com&amp;#039;, url) then&lt;br /&gt;
		-- Remove &amp;#039;www.&amp;#039; from the link&lt;br /&gt;
		santizedURL = mw.ustring.gsub( url, &amp;#039;www%.&amp;#039;, &amp;#039;&amp;#039; )&lt;br /&gt;
	else&lt;br /&gt;
		-- Add &amp;quot;https://robertsspaceindustries.com/&amp;quot; to url if it is not present&lt;br /&gt;
		santizedURL = &amp;#039;https://robertsspaceindustries.com/&amp;#039; .. url&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return santizedURL&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Determine which type of RSI website it is&lt;br /&gt;
--&lt;br /&gt;
-- @param url string - RSI website URL&lt;br /&gt;
--&lt;br /&gt;
-- @return string - Site type or nil if unknown&lt;br /&gt;
local function getType( url )&lt;br /&gt;
	local type&lt;br /&gt;
&lt;br /&gt;
	if stringContains( &amp;#039;/comm-link/&amp;#039;, url ) then&lt;br /&gt;
		type = &amp;#039;Comm-Link&amp;#039;&lt;br /&gt;
    elseif stringContains( &amp;#039;/galactapedia/&amp;#039;, url ) then&lt;br /&gt;
		type = &amp;#039;Galactapedia&amp;#039;&lt;br /&gt;
    elseif stringContains( &amp;#039;/spectrum/&amp;#039;, url ) then&lt;br /&gt;
		type = &amp;#039;Spectrum&amp;#039;&lt;br /&gt;
    elseif stringContains( &amp;#039;/pledge/&amp;#039;, url ) then&lt;br /&gt;
		type = &amp;#039;Pledge Store&amp;#039;&lt;br /&gt;
    elseif stringContains( &amp;#039;/starmap&amp;#039;, url ) then&lt;br /&gt;
		type = &amp;#039;Starmap&amp;#039;&lt;br /&gt;
    elseif stringContains( &amp;#039;/issue-council&amp;#039;, url ) then&lt;br /&gt;
		type = &amp;#039;Issue Council&amp;#039;&lt;br /&gt;
	elseif stringContains( &amp;#039;support.robertsspaceindustries&amp;#039;, url ) then&lt;br /&gt;
		type = &amp;#039;Knowledge Base&amp;#039;&lt;br /&gt;
    else&lt;br /&gt;
        type = nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return type&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getSubtype( url, type )&lt;br /&gt;
	local subtype = nil&lt;br /&gt;
	if type == &amp;#039;Comm-Link&amp;#039; then&lt;br /&gt;
		subtype = string.match( url, &amp;#039;/comm%-link/([%w-]+)/%d+-[%w-]+&amp;#039; )&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return formatTitle( subtype )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getTitle( url, type )&lt;br /&gt;
	local titleText&lt;br /&gt;
	local throwError = function()&lt;br /&gt;
		return error( &amp;#039;Title can not be generated, please fill in the text parameter.&amp;#039; )&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Auto title generation, might not be accurate since special characters&lt;br /&gt;
	-- are escaped in the URL&lt;br /&gt;
	--&lt;br /&gt;
	-- e.g. /comm-link/transmission/14710-Starfarer-Q-A-Part-1&lt;br /&gt;
	if type == &amp;#039;Comm-Link&amp;#039; then&lt;br /&gt;
		titleText = string.match( url, &amp;#039;/comm%-link/[%w-]+/%d+-([%w-]+)&amp;#039; )&lt;br /&gt;
	-- e.g. /article/0j46Lzl8xm-torral-aggregate&lt;br /&gt;
	elseif type == &amp;#039;Galactapedia&amp;#039; then&lt;br /&gt;
		titleText = &amp;#039;Galactapedia: &amp;#039; .. string.match( url, &amp;#039;/article/%w+-([%w-]+)&amp;#039; )&lt;br /&gt;
	-- NOTE: Only support threads at the moment&lt;br /&gt;
	-- e.g. /thread/star-citizen-alpha-3-13-0-live-7319707-patch-notes&lt;br /&gt;
	elseif type == &amp;#039;Spectrum&amp;#039; then&lt;br /&gt;
		titleText = string.match( url, &amp;#039;/thread/%w+-([%w-]+)&amp;#039; )&lt;br /&gt;
	-- e.g. /hc/en-us/categories/360000295274-Updates-and-Info&lt;br /&gt;
	elseif type == &amp;#039;Knowledge Base&amp;#039; then&lt;br /&gt;
		titleText = string.match( url, &amp;#039;/hc/.+/.+/%d+-([%w-]+)&amp;#039; )&lt;br /&gt;
	-- Will still try its best to extact a title&lt;br /&gt;
	else&lt;br /&gt;
		local urlParts = mw.text.split(url, &amp;#039;[/]&amp;#039;)&lt;br /&gt;
		titleText = urlParts[ #urlParts ]&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return formatTitle( titleText )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- NOTE: Don&amp;#039;t have internal link support yet&lt;br /&gt;
function p.main( frame )&lt;br /&gt;
	if args == nil then&lt;br /&gt;
        args = require( &amp;#039;Module:Arguments&amp;#039; ).getArgs( frame )&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local url = sanitizeURL( args.url or args[1] )&lt;br /&gt;
	local type = getType( url )&lt;br /&gt;
	local date = args.accessdate&lt;br /&gt;
	local title&lt;br /&gt;
	local output&lt;br /&gt;
	&lt;br /&gt;
	if args.text then&lt;br /&gt;
		title = args.text&lt;br /&gt;
	else&lt;br /&gt;
		title = getTitle( url, type )&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Maybe there is a smarter way?&lt;br /&gt;
	-- This needs to be redone with mw.html&lt;br /&gt;
	output = &amp;#039;&amp;lt;cite class=&amp;quot;citation rsi_site&amp;quot;&amp;gt;&amp;#039; ..&lt;br /&gt;
		&amp;#039;&amp;lt;span class=&amp;quot;metadata citation-icon&amp;quot; title=&amp;quot;RSI site&amp;quot;&amp;gt;[[File:RSIsite.svg|x11px|link=]]&amp;lt;/span&amp;gt;&amp;#039; ..&lt;br /&gt;
		&amp;#039;[&amp;#039; .. url .. &amp;#039; &amp;#039; .. title .. &amp;#039;]&amp;#039;&lt;br /&gt;
	&lt;br /&gt;
	if type then&lt;br /&gt;
		local subtype = getSubtype( url, type )&lt;br /&gt;
		&lt;br /&gt;
		output = output .. &amp;#039;. &amp;#039;&lt;br /&gt;
		if subtype then&lt;br /&gt;
			output = output .. &amp;#039;&amp;lt;i&amp;gt;&amp;#039; .. subtype .. &amp;#039;&amp;lt;/i&amp;gt; - &amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		output = output .. &amp;#039;&amp;lt;i&amp;gt;&amp;#039; .. type .. &amp;#039;&amp;lt;/i&amp;gt;&amp;#039; &lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if date then&lt;br /&gt;
		output = output .. &amp;#039;. Retrieved &amp;#039; .. date&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	output = output .. &amp;#039;&amp;lt;/cite&amp;gt;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
	return mw.getCurrentFrame():extensionTag{&lt;br /&gt;
		name = &amp;#039;templatestyles&amp;#039;, args = { src = &amp;#039;Module:Cite/styles.css&amp;#039; }&lt;br /&gt;
	} .. output&lt;br /&gt;
end&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>DarkMuse</name></author>
	</entry>
</feed>