<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="pl">
	<id>https://bajkowscy.pl/mw22/index.php?action=history&amp;feed=atom&amp;title=Modu%C5%82%3AISBN</id>
	<title>Moduł:ISBN - Historia wersji</title>
	<link rel="self" type="application/atom+xml" href="https://bajkowscy.pl/mw22/index.php?action=history&amp;feed=atom&amp;title=Modu%C5%82%3AISBN"/>
	<link rel="alternate" type="text/html" href="https://bajkowscy.pl/mw22/index.php?title=Modu%C5%82:ISBN&amp;action=history"/>
	<updated>2026-04-11T23:41:36Z</updated>
	<subtitle>Historia wersji tej strony wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://bajkowscy.pl/mw22/index.php?title=Modu%C5%82:ISBN&amp;diff=2158&amp;oldid=prev</id>
		<title>Admin: 1 wersja</title>
		<link rel="alternate" type="text/html" href="https://bajkowscy.pl/mw22/index.php?title=Modu%C5%82:ISBN&amp;diff=2158&amp;oldid=prev"/>
		<updated>2022-04-08T11:14:42Z</updated>

		<summary type="html">&lt;p&gt;1 wersja&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;pl&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← poprzednia wersja&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Wersja z 11:14, 8 kwi 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;pl&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(Brak różnic)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://bajkowscy.pl/mw22/index.php?title=Modu%C5%82:ISBN&amp;diff=2157&amp;oldid=prev</id>
		<title>pl&gt;Paweł Ziemian: drobne techniczne</title>
		<link rel="alternate" type="text/html" href="https://bajkowscy.pl/mw22/index.php?title=Modu%C5%82:ISBN&amp;diff=2157&amp;oldid=prev"/>
		<updated>2018-02-25T21:28:17Z</updated>

		<summary type="html">&lt;p&gt;drobne techniczne&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nowa strona&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local resources = {&lt;br /&gt;
	classLink = &amp;quot;isbn&amp;quot;,&lt;br /&gt;
	classIncorrect = &amp;quot;isbn-incorrect&amp;quot;,&lt;br /&gt;
	classSeparator = &amp;quot;isbn-do-sprawdzenia&amp;quot;,&lt;br /&gt;
	classJustified = &amp;quot;isbn-usprawiedliwiony&amp;quot;,&lt;br /&gt;
	classPretty = &amp;quot;isbn-ulepszony&amp;quot;,&lt;br /&gt;
	specialBooksPrefix = &amp;quot;Specjalna:Książki/&amp;quot;,&lt;br /&gt;
	findLinkPrefix = &amp;quot;Moduł:ISBN/&amp;quot;,&lt;br /&gt;
	isbnPrefix = &amp;quot;ISBN&amp;amp;#160;&amp;quot;,&lt;br /&gt;
	categoryIncorrectNumber = &amp;quot;[[Kategoria:Artykuły z nieprawidłowymi numerami ISBN]]&amp;quot;,&lt;br /&gt;
	categoryInvalidNumber = &amp;quot;[[Kategoria:Artykuły z błędnymi numerami ISBN]]&amp;quot;,&lt;br /&gt;
	errorSyntax = &amp;quot;nieprawidłowa składnia&amp;quot;,&lt;br /&gt;
	errorFormal = &amp;quot;numer jest poprawny, możliwe, że ten sam numer jest przypisany do kilku różnych tytułów&amp;quot;,&lt;br /&gt;
	errorCheck10 = &amp;quot;nieprawidłowa cyfra kontrolna w numerze ISBN-10&amp;quot;,&lt;br /&gt;
	errorCheck13 = &amp;quot;nieprawidłowa cyfra kontrolna w numerze ISBN-13&amp;quot;,&lt;br /&gt;
	errorPretend13 = &amp;quot;numer ISBN-13 zawiera niewłaściwe cyfry na kluczowych pozycjach&amp;quot;,&lt;br /&gt;
	defaultPrefix13 = &amp;quot;978-&amp;quot;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local function deduceSeparators(number, prefix)&lt;br /&gt;
&lt;br /&gt;
	local function deduce(region, regionLen)&lt;br /&gt;
		for _, v in ipairs(region) do&lt;br /&gt;
			local minimum, maximum = string.match(v, &amp;quot;^(%d-)%-(%d-)$&amp;quot;)&lt;br /&gt;
			if minimum and maximum and #minimum==#maximum and (minimum &amp;lt;= maximum) then&lt;br /&gt;
				local width = #minimum&lt;br /&gt;
				local minimum = tonumber(minimum)&lt;br /&gt;
				local maximum = tonumber(maximum)&lt;br /&gt;
				local publisher = tonumber(string.sub(number, regionLen+1, regionLen+width))&lt;br /&gt;
				if (minimum &amp;lt;= publisher) and (publisher &amp;lt;= maximum) then&lt;br /&gt;
					return string.sub(number, 1, regionLen)..&amp;quot;-&amp;quot;..string.sub(number, regionLen+1, regionLen+width)..&amp;quot;-&amp;quot;..string.sub(number, regionLen+width+1)&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local publishers = mw.loadData( &amp;quot;Moduł:ISBN/wydawcy&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
	local regionLen = 1&lt;br /&gt;
	while regionLen &amp;lt;= 5 do&lt;br /&gt;
		local region = publishers[(prefix or resources.defaultPrefix13)..string.sub(number, 1, regionLen)]&lt;br /&gt;
		if region then&lt;br /&gt;
			local pretty = deduce(region, regionLen)&lt;br /&gt;
			if pretty then&lt;br /&gt;
				return pretty&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		regionLen = regionLen + 1&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if prefix and (prefix ~= defaultPrefix13) then&lt;br /&gt;
		regionLen = 1&lt;br /&gt;
		while regionLen &amp;lt;= 5 do&lt;br /&gt;
			region = publishers[&amp;quot;978-&amp;quot;..string.sub(number, 1, regionLen)]&lt;br /&gt;
			if region then&lt;br /&gt;
				local pretty = deduce(region, regionLen)&lt;br /&gt;
				if pretty then&lt;br /&gt;
					return pretty&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			regionLen = regionLen + 1&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function analyze(isbn)&lt;br /&gt;
	local result = {}&lt;br /&gt;
	&lt;br /&gt;
	result.isbn = isbn&lt;br /&gt;
	if string.match(isbn, &amp;quot;^[0-9][0-9%-]+[0-9]%-?[0-9Xx]$&amp;quot;) and not string.match(isbn, &amp;quot;%-%-&amp;quot;) then&lt;br /&gt;
		-- numer ma odowiednie cyfry z opcjonalnymi separatorami&lt;br /&gt;
		local clean, n = string.gsub(isbn, &amp;quot;%-&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
		result.code, result.n = string.upper(clean), n&lt;br /&gt;
		result.justified = mw.title.new(resources.findLinkPrefix..clean).exists&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if result.code and string.match(result.code, &amp;quot;^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9X]$&amp;quot;) then&lt;br /&gt;
		-- ISBN-10&lt;br /&gt;
		local b10, b9, b8, b7, b6, b5, b4, b3, b2, b1 = string.byte(result.code, 1, 10)&lt;br /&gt;
		result.expectedSum = (11 - ((10*(b10-48)+9*(b9-48)+8*(b8-48)+7*(b7-48)+6*(b6-48)+5*(b5-48)+4*(b4-48)+3*(b3-48)+2*(b2-48)) % 11)) % 11&lt;br /&gt;
		result.receivedSum = b1 == 88 and 10 or (b1 - 48)&lt;br /&gt;
		result.kind = 10&lt;br /&gt;
		result.error = result.expectedSum ~= result.receivedSum and resources.errorCheck10 or nil&lt;br /&gt;
		result.separatorWarn = (result.n~=0) and ((result.n~=3) or not string.match(isbn, &amp;quot;[0-9]%-[0-9Xx]$&amp;quot;))&lt;br /&gt;
		result.prefix = false&lt;br /&gt;
		result.number = string.sub(result.code, 1, 9)&lt;br /&gt;
		result.checksum = &amp;quot;-&amp;quot;..string.sub(result.code, 10, 10)&lt;br /&gt;
	elseif result.code and (string.match(result.code, &amp;quot;^978[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$&amp;quot;) or string.match(result.code, &amp;quot;^979[1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$&amp;quot;)) then&lt;br /&gt;
		-- ISBN-13&lt;br /&gt;
		local b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13 = string.byte(result.code, 1, 13)&lt;br /&gt;
		result.expectedSum = (10 - (((b1-48)+3*(b2-48)+(b3-48)+3*(b4-48)+(b5-48)+3*(b6-48)+(b7-48)+3*(b8-48)+(b9-48)+3*(b10-48)+(b11-48)+3*(b12-48)) % 10)) % 10&lt;br /&gt;
		result.receivedSum = b13 - 48&lt;br /&gt;
		result.kind = 13&lt;br /&gt;
		result.error = result.expectedSum ~= result.receivedSum and resources.errorCheck13 or nil&lt;br /&gt;
		result.separatorWarn = (result.n~=0) and ((result.n~=4) or not string.match(isbn, &amp;quot;^97[89]%-[0-9][0-9%-]-[0-9]%-[0-9]$&amp;quot;))&lt;br /&gt;
		result.prefix = string.sub(result.code, 1, 3)..&amp;quot;-&amp;quot;&lt;br /&gt;
		result.number = string.sub(result.code, 4, 12)&lt;br /&gt;
		result.checksum = &amp;quot;-&amp;quot;..string.sub(result.code, 13, 13)&lt;br /&gt;
	elseif result.code and string.match(result.code, &amp;quot;^9[78][78][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9X]$&amp;quot;) then&lt;br /&gt;
		-- ten numer udaje, że jest ISBN-13&lt;br /&gt;
		result.error = resources.errorPretend13&lt;br /&gt;
	else&lt;br /&gt;
		-- to nie jest numer ISBN, ma nieprawidłową liczbę cyfr lub nieprawidłowe znaki&lt;br /&gt;
		result.error = resources.errorSyntax&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if result.justified and not result.error then&lt;br /&gt;
		result.error = resources.errorFormal&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if not result.error and (result.n == 0) and (result.prefix ~= nil) and result.checksum and result.number then&lt;br /&gt;
		local prettyNumber = deduceSeparators(result.number, result.prefix)&lt;br /&gt;
		if prettyNumber then&lt;br /&gt;
			result.org = result.isbn&lt;br /&gt;
			result.isbn = (result.prefix or &amp;quot;&amp;quot;)..prettyNumber..result.checksum&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return result&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function printISBN(builder, info, prefix)&lt;br /&gt;
&lt;br /&gt;
	local ns = mw.title.getCurrentTitle().namespace&lt;br /&gt;
	&lt;br /&gt;
	if info.error and not info.justified and not mw.site.namespaces[ns].isTalk and (ns &amp;gt;= 0) and (ns &amp;lt;= 102) then&lt;br /&gt;
		mw.addWarning(mw.text.nowiki(&amp;quot;{{ISBN|&amp;quot;..info.isbn..&amp;quot;}} &amp;quot;..info.error))&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if not info.code then&lt;br /&gt;
		builder&lt;br /&gt;
			:wikitext(prefix)&lt;br /&gt;
			:tag(&amp;quot;span&amp;quot;)&lt;br /&gt;
				:addClass(resources.classIncorrect)&lt;br /&gt;
				:attr(&amp;quot;title&amp;quot;, mw.getContentLanguage():ucfirst(info.error))&lt;br /&gt;
				:wikitext(mw.text.nowiki(info.isbn), ns == 0 and resources.categoryIncorrectNumber or &amp;quot;&amp;quot;)&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	builder&lt;br /&gt;
		:wikitext(&amp;quot;[[&amp;quot;, resources.specialBooksPrefix, info.code, &amp;quot;|&amp;quot;, prefix)&lt;br /&gt;
		:tag(&amp;quot;span&amp;quot;)&lt;br /&gt;
			:addClass(resources.classLink)&lt;br /&gt;
			:addClass(info.justified and resources.classJustified or nil)&lt;br /&gt;
			:addClass((not info.justified and info.error) and resources.classIncorrect or nil)&lt;br /&gt;
			:addClass(info.separatorWarn and resources.classSeparator or nil)&lt;br /&gt;
			:addClass(info.org and resources.classPretty or nil)&lt;br /&gt;
			:attr(&amp;quot;title&amp;quot;, info.error and mw.getContentLanguage():ucfirst(info.error) or nil)&lt;br /&gt;
			:wikitext(string.upper(info.isbn))&lt;br /&gt;
			:done()&lt;br /&gt;
		:wikitext(&amp;quot;]]&amp;quot;)&lt;br /&gt;
		:wikitext((not info.justified and info.error and (ns == 0)) and resources.categoryIncorrectNumber or &amp;quot;&amp;quot;)&lt;br /&gt;
		:wikitext((info.justified and (ns == 0)) and resources.categoryInvalidNumber or &amp;quot;&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
&lt;br /&gt;
link = function(builder, isbn)&lt;br /&gt;
	if isbn then&lt;br /&gt;
		local info = analyze(isbn)&lt;br /&gt;
		printISBN(builder, info, resources.isbnPrefix)&lt;br /&gt;
		return tostring(builder)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local isbn = builder[1] or builder.args[1] or builder:getParent().args[1]&lt;br /&gt;
	if isbn then&lt;br /&gt;
		isbn = mw.text.trim(isbn)&lt;br /&gt;
		if #isbn &amp;gt;= 0 then&lt;br /&gt;
			local info = analyze(isbn)&lt;br /&gt;
			local builder = mw.html.create()&lt;br /&gt;
			printISBN(builder, info, resources.isbnPrefix)&lt;br /&gt;
			return tostring(builder)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end,&lt;br /&gt;
&lt;br /&gt;
opis = function(frame)&lt;br /&gt;
	local isbn = type(frame) == &amp;quot;string&amp;quot; and frame or (frame[1] or frame.args[1] or frame:getParent().args[1] or mw.title.getCurrentTitle().subpageText)&lt;br /&gt;
	local info = analyze(isbn)&lt;br /&gt;
	local result = mw.html.create()&lt;br /&gt;
		:tag(&amp;quot;tt&amp;quot;):wikitext(&amp;quot;{{[[Szablon:ISBN|ISBN]]|&amp;quot;, mw.text.nowiki(isbn), &amp;quot;}}&amp;quot;):done()&lt;br /&gt;
		:wikitext(&amp;quot; → &amp;quot;)&lt;br /&gt;
	printISBN(result, info, resources.isbnPrefix)&lt;br /&gt;
	if info.error then&lt;br /&gt;
		result:wikitext(&amp;quot;\n* &amp;quot;, mw.getContentLanguage():ucfirst(info.error), &amp;quot;.&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if info.justified then&lt;br /&gt;
		local status, data = pcall(mw.loadData, &amp;quot;Moduł:ISBN/&amp;quot;..info.code)&lt;br /&gt;
		if status then&lt;br /&gt;
			_ = mw.title.new(&amp;quot;Module:ISBN/nietrywialne moduły generujące dokumentację&amp;quot;).id&lt;br /&gt;
			result:wikitext(&amp;quot;\n----&amp;quot;)&lt;br /&gt;
			for i, v in ipairs(data) do&lt;br /&gt;
				local text = false&lt;br /&gt;
				if (type(v) == &amp;quot;table&amp;quot;) and (type(v.title) == &amp;quot;string&amp;quot;) and (type(v.args) == &amp;quot;table&amp;quot;) then&lt;br /&gt;
					text = mw.getCurrentFrame():expandTemplate(v)&lt;br /&gt;
				elseif type(v) == &amp;quot;string&amp;quot; then&lt;br /&gt;
					text = mw.getCurrentFrame():preprocess(v)&lt;br /&gt;
				end&lt;br /&gt;
				&lt;br /&gt;
				if text and #text &amp;gt; 0 then&lt;br /&gt;
					result:wikitext(&amp;quot;\n# &amp;quot;, text)&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		&lt;br /&gt;
			if data.kategoria and type(data.kategoria) == &amp;quot;string&amp;quot; and (#data.kategoria &amp;gt; 0) then&lt;br /&gt;
				result:wikitext(&amp;quot;\n[[Kategoria:&amp;quot;, data.kategoria, &amp;quot;]]&amp;quot;)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return tostring(result)&lt;br /&gt;
end,&lt;br /&gt;
&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>pl&gt;Paweł Ziemian</name></author>
	</entry>
</feed>