Ir al contenido

Diferencia entre revisiones de «Módulo:Citas»

7 bytes eliminados ,  12 junio
sin resumen de edición
m (1 revisión importada)
Sin resumen de edición
 
(No se muestran 3 ediciones intermedias de 2 usuarios)
Línea 274: Línea 274:
     if not checkurl( URL ) then
     if not checkurl( URL ) then
         error_str = seterror( 'bad_url', {}, false, " " ) .. error_str;
         error_str = seterror( 'bad_url', {}, false, " " ) .. error_str;
     elseif mw.title.getCurrentTitle():inNamespaces(0, 100, 104) and
     elseif  
     not mw.title.getCurrentTitle().text:match('Wikipedia') and
     not mw.title.getCurrentTitle().text:match('Wiki TVenserio') and
     URL:match('//[%a%.%-]+%.wikipedia%.org') then
     URL:match('//www.wikitvenserio.com') then
     error_str = seterror( 'bad_url_autorreferencia', {}, false, " " ) .. error_str;
     error_str = seterror( 'bad_url_autorreferencia', {}, false, " " ) .. error_str;
     end
     end
Línea 597: Línea 597:
     while true do
     while true do
pattern = pages:match("%[(%w*:?//[^ ]+%s+)[%w%d].*%]"); -- pattern is the opening bracket, the url and following space(s): "[url "
    local urlPattern = "%[%w*:?//[^ ]+%s+([%w%d].*)%]"
if nil == pattern then break; end -- no more urls
local urlMatch = pages:match(urlPattern); -- pattern is the opening bracket, the url and following space(s): "[url "
pages = pages:gsub(pattern, ""); -- remove as many instances of pattern as possible
if nil == urlMatch then break; end -- no more urls
pages = pages:gsub(urlPattern, "%1"); -- remove as many instances of pattern as possible
end
end
pages = pages:gsub("[%[%]]", ""); -- remove the brackets
pages = pages:gsub("[%[%]]", ""); -- remove the brackets