<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.defautluser0.xyz/index.php?action=history&amp;feed=atom&amp;title=Module%3AIdentificadores</id>
	<title>Module:Identificadores - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.defautluser0.xyz/index.php?action=history&amp;feed=atom&amp;title=Module%3AIdentificadores"/>
	<link rel="alternate" type="text/html" href="https://wiki.defautluser0.xyz/index.php?title=Module:Identificadores&amp;action=history"/>
	<updated>2026-04-19T13:51:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://wiki.defautluser0.xyz/index.php?title=Module:Identificadores&amp;diff=150&amp;oldid=prev</id>
		<title>Defautluser0: Created page with &quot;local p = {}  -- ISBN-10 and ISSN validator code calculates checksum across all isbn/issn digits including the check digit. ISBN-13 is checked in checkisbn(). If the number is valid the result will be 0. Before calling this function, issbn/issn must be checked for length and stripped of dashes, spaces and other non-isxn characters.  -- Función traída de en:Module:Citation/CS1  function p.esValidoISXN (isxn_str, len) 	local temp = 0; 	isxn_str = { isxn_str:byte(1, l...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.defautluser0.xyz/index.php?title=Module:Identificadores&amp;diff=150&amp;oldid=prev"/>
		<updated>2025-11-26T19:39:32Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local p = {}  --[[ ISBN-10 and ISSN validator code calculates checksum across all isbn/issn digits including the check digit. ISBN-13 is checked in checkisbn(). If the number is valid the result will be 0. Before calling this function, issbn/issn must be checked for length and stripped of dashes, spaces and other non-isxn characters. ]] -- Función traída de en:Module:Citation/CS1  function p.esValidoISXN (isxn_str, len) 	local temp = 0; 	isxn_str = { isxn_str:byte(1, l...&amp;quot;&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;
--[[&lt;br /&gt;
ISBN-10 and ISSN validator code calculates checksum across all isbn/issn digits including the check digit. ISBN-13 is checked in checkisbn().&lt;br /&gt;
If the number is valid the result will be 0. Before calling this function, issbn/issn must be checked for length and stripped of dashes,&lt;br /&gt;
spaces and other non-isxn characters.&lt;br /&gt;
]]&lt;br /&gt;
-- Función traída de en:Module:Citation/CS1&lt;br /&gt;
&lt;br /&gt;
function p.esValidoISXN (isxn_str, len)&lt;br /&gt;
	local temp = 0;&lt;br /&gt;
	isxn_str = { isxn_str:byte(1, len) };	-- make a table of bytes&lt;br /&gt;
	len = len+1;							-- adjust to be a loop counter&lt;br /&gt;
	for i, v in ipairs( isxn_str ) do		-- loop through all of the bytes and calculate the checksum&lt;br /&gt;
		if v == string.byte( &amp;quot;X&amp;quot; ) then		-- if checkdigit is X&lt;br /&gt;
			temp = temp + 10*( len - i );	-- it represents 10 decimal&lt;br /&gt;
		else&lt;br /&gt;
			temp = temp + tonumber( string.char(v) )*(len-i);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return temp % 11 == 0;					-- returns true if calculation result is zero&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Adaptación de la función checkisbn de en:Module:Citation/CS1&lt;br /&gt;
function p.esValidoISBN(isbn)&lt;br /&gt;
	-- El isbn solo contiene números, guiones, espacios en blanco y el dígito de &lt;br /&gt;
	-- control X.&lt;br /&gt;
	&lt;br /&gt;
	if not isbn or isbn:match(&amp;quot;[^%s-0-9X]&amp;quot;)  then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Eliminar los guiones y espacios en blanco&lt;br /&gt;
	&lt;br /&gt;
	isbn = isbn:gsub( &amp;quot;-&amp;quot;, &amp;quot;&amp;quot; ):gsub( &amp;quot; &amp;quot;, &amp;quot;&amp;quot; )&lt;br /&gt;
	local longitud = isbn:len()&lt;br /&gt;
 &lt;br /&gt;
	if longitud == 10 then&lt;br /&gt;
		-- La X solo puede ir al final.&lt;br /&gt;
		if not isbn:match( &amp;quot;^%d*X?$&amp;quot; ) then&lt;br /&gt;
			return false&lt;br /&gt;
		end&lt;br /&gt;
		return p.esValidoISXN(isbn, 10);&lt;br /&gt;
	elseif longitud == 13 then -- isbn13&lt;br /&gt;
		local temp = 0;&lt;br /&gt;
		-- Debe comenzar por 978 o 979&lt;br /&gt;
		if not isbn:match( &amp;quot;^97[89]%d*$&amp;quot; ) then &lt;br /&gt;
			return false&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		-- Comprobar el dígito de control&lt;br /&gt;
		isbn = { isbn:byte(1, longitud) };&lt;br /&gt;
		for i, v in ipairs( isbn ) do&lt;br /&gt;
			temp = temp + (3 - 2*(i % 2)) * tonumber( string.char(v) );&lt;br /&gt;
		end&lt;br /&gt;
		return temp % 10 == 0;&lt;br /&gt;
	else&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Función que devuelve un enlace al ISBN si es correcto y si no (por ejemplo si&lt;br /&gt;
-- ya está enlazado) lo devuelve sin más.&lt;br /&gt;
-- Por defecto no se incluye el literal ISBN delante.&lt;br /&gt;
&lt;br /&gt;
function p.enlazarISBN(isbn, opciones)&lt;br /&gt;
    if p.esValidoISBN(isbn) then&lt;br /&gt;
        return &amp;#039;[[Especial:FuentesDeLibros/&amp;#039; .. isbn .. &amp;#039;|&amp;#039; .. isbn .. &amp;#039;]]&amp;#039;&lt;br /&gt;
    else&lt;br /&gt;
    	return isbn&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.enlazarOCLC(oclc, opciones)&lt;br /&gt;
    if tonumber(oclc) then&lt;br /&gt;
        return &amp;#039;[http://www.worldcat.org/oclc/&amp;#039; .. oclc .. &amp;#039; &amp;#039; .. oclc .. &amp;#039;]&amp;#039;&lt;br /&gt;
    else&lt;br /&gt;
    	return oclc&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Defautluser0</name></author>
	</entry>
</feed>