Edición de «Módulo:Citas»

Advertencia: no has iniciado sesión. Tu dirección IP se hará pública si haces cualquier edición. Si inicias sesión o creas una cuenta, tus ediciones se atribuirán a tu nombre de usuario, además de otros beneficios.

Puedes deshacer la edición. Antes de deshacer la edición, comprueba la siguiente comparación para verificar que realmente es lo que quieres hacer, y entonces publica los cambios para así efectuar la reversión.

Revisión actual Tu texto
Línea 280: Línea 280:
     end
     end
     return table.concat({ "[", URL, " ", safeforurl( label ), "]", error_str });
     return table.concat({ "[", URL, " ", safeforurl( label ), "]", error_str });
end
--[[--------------------------< H D L >------------------------------------------------------------------------
Formats an HDL with minor error checking.
HDL names contain two parts: prefix and suffix separated by a forward slash.
Prefix: character string using any character in the UCS-2 character set except '/'
Suffix: character string of any length using any character in the UCS-2 character set chosen by the registrant
This function checks a HDL name for: prefix/suffix.  If the HDL name contains spaces, endashes, or, if it ends
with a period or a comma, this function will emit a bad_hdl error message.
HDL names are case-insensitive and can incorporate any printable Unicode characters so the test for endashes and
terminal punctuation may not be technically correct but it appears, that in practice these characters are rarely
if ever used in HDLs.
Query string parameters are named here: http://www.handle.net/proxy_servlet.html.  query strings are not displayed
but since '?' is an allowed character in an HDL, '?' followed by one of the query parameters is the only way we
have to detect the query string so that it isn't URL-encoded with the rest of the identifier.
]]
local function hdl (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
local query_params = { -- list of known query parameters from http://www.handle.net/proxy_servlet.html
'noredirect',
'ignore_aliases',
'auth',
'cert',
'index',
'type',
'urlappend',
'locatt',
'action',
}
local hdl, suffix, param = id:match ('(.-)(%?(%a+).+)$'); -- look for query string
local found;
if hdl then -- when there are query strings, this is the handle identifier portion
for _, q in ipairs (query_params) do -- spin through the list of query parameters
if param:match ('^' .. q) then -- if the query string begins with one of the parameters
found = true; -- announce a find
break; -- and stop looking
end
end
end
if found then
id = hdl; -- found so replace id with the handle portion; this will be URL-encoded, suffix will not
else
suffix = ''; -- make sure suffix is empty string for concatenation else
end
local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, suffix = suffix, separator = handler.separator, encode = handler.encode, access = access})
if nil == id:match("^[^%s–]-/[^%s–]-[^%.,]$") then -- HDL must contain a forward slash, must not contain spaces, endashes, and must not end with period or comma
set_message ('err_bad_hdl' );
options.coins_list_t['HDL'] = nil; -- when error, unset so not included in COinS
end
return text;
end
end
--[[--------------------------< N O R M A L I Z E _ L C C N >--------------------------------------------------
--[[--------------------------< N O R M A L I Z E _ L C C N >--------------------------------------------------
Línea 367: Línea 432:
]]
]]
function pmid(id)
function pmid(id)
local test_limit = 45000000; -- update this value as PMIDs approach
local test_limit = 36000000; -- update this value as PMIDs approach
local handler = cfg.id_handlers['PMID'];
local handler = cfg.id_handlers['PMID'];
local err_cat =  ''; -- presume that PMID is valid
local err_cat =  ''; -- presume that PMID is valid
Línea 413: Línea 478:
]]
]]
function pmc(id, embargo)
function pmc(id, embargo)
local test_limit = 12000000; -- update this value as PMCs approach
local test_limit = 10000000; -- update this value as PMCs approach
local handler = cfg.id_handlers['PMC'];
local handler = cfg.id_handlers['PMC'];
local err_cat =  ''; -- presume that PMC is valid
local err_cat =  ''; -- presume that PMC is valid
Línea 419: Línea 484:
local text;
local text;


if id:match("^PMC%d") then
id = id:sub(4, j) -- remove 'PMC' preffix if given
end
if id:match("[^%d]") then -- if PMC has anything but digits
if id:match("[^%d]") then -- if PMC has anything but digits
err_cat = ' ' .. seterror( 'bad_pmc' ); -- set an error message
err_cat = ' ' .. seterror( 'bad_pmc' ); -- set an error message
Línea 597: Línea 659:
     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 "
pattern = pages:match("%[([%w/:\.]+%s+)[%w%d].*%]"); -- pattern is the opening bracket, the url and following space(s): "[url "
if nil == pattern then break; end -- no more urls
if nil == pattern then break; end -- no more urls
pages = pages:gsub(pattern, ""); -- remove as many instances of pattern as possible
pages = pages:gsub(pattern, ""); -- remove as many instances of pattern as possible
Línea 855: Línea 917:
         elseif k == 'DOI' then
         elseif k == 'DOI' then
             table.insert( new_list, {handler.label, doi( v, options.DoiBroken ) } );
             table.insert( new_list, {handler.label, doi( v, options.DoiBroken ) } );
        elseif k == 'HDL' then
            table.insert( new_list, {handler.label, hdl( v ) } );
         elseif k == 'LCCN' then
         elseif k == 'LCCN' then
             table.insert( new_list, {handler.label, lccn( v ) } );
             table.insert( new_list, {handler.label, lccn( v ) } );
Línea 1273: Línea 1337:
      
      
     local Quote = A['Quote'];
     local Quote = A['Quote'];
     local TransQuote = A['TransQuote'];
     local PostScript = A['PostScript'];
local PostScript = A['PostScript'];


     local LayURL = A['LayURL'];
     local LayURL = A['LayURL'];
Línea 1835: Línea 1898:
     if is_set(Title) then
     if is_set(Title) then
         if not is_set(TitleLink) and is_set(URL) then  
         if not is_set(TitleLink) and is_set(URL) then  
             Title = externallink( URL, Title, URL_origin, UrlAccess ) .. TransError .. Format       
             Title = externallink( URL, Title ) .. TransError .. Format       
             URL = "";
             URL = "";
             TieneURL = true;
             TieneURL = true;
Línea 2060: Línea 2123:
     if is_set(URL) then
     if is_set(URL) then
         URL = " " .. externallink( URL, nil, URLorigin, UrlAccess );
         URL = " " .. externallink( URL, nil, URLorigin );
     end
     end
      
      
Línea 2074: Línea 2137:
end     
end     


     if is_set(Quote) or is_set(TransQuote) then
     if is_set(Quote) then
     -- Eliminar comillas de Quote
     -- Eliminar comillas de Quote
         if (Quote:sub(1,1) == '"' and Quote:sub(-1,-1) == '"') or
         if (Quote:sub(1,1) == '"' and Quote:sub(-1,-1) == '"') or
Línea 2085: Línea 2148:
           Quote:sub(-1,-1) == '!' then
           Quote:sub(-1,-1) == '!' then
           PostScript = ""
           PostScript = ""
          end
         end
         
         -- Eliminar comillas de TransQuote
        if (TransQuote:sub(1, 1) == '"' and TransQuote:sub(-1, -1) == '"') or
          (Quote:sub(1,1) == '«' and Quote:sub(-1,-1) == '»') then
TransQuote = TransQuote:sub(2, -2);
end
          
          
        -- No añadir el punto final a la cita si el campo TransQuote ya incluye un punto
        if TransQuote:sub(-1,-1) == '.' or TransQuote:sub(-1,-1) == '?' or
          TransQuote:sub(-1,-1) == '!' then
          PostScript = ""
          end
if TransQuote and TransQuote ~= '' then
          Quote = Quote .. " " .. wrap( 'trans-quoted-title', TransQuote );
          TransQuote = wrap( 'trans-quoted-title', TransQuote );
end
         Quote = sepc .." " .. wrap( 'quoted-text', Quote );  
         Quote = sepc .." " .. wrap( 'quoted-text', Quote );  
     end
     end
Ten en cuenta que todas las contribuciones a Wiki TVenserio pueden ser editadas, modificadas o eliminadas por otros colaboradores. Si no deseas que las modifiquen sin limitaciones, no las publiques aquí.
Al mismo tiempo, asumimos que eres el autor de lo que escribiste, o lo copiaste de una fuente en el dominio público o con licencia libre (véase Wiki TVenserio:Derechos de autor para más detalles). ¡No uses textos con copyright sin permiso!
Cancelar Ayuda de edición (se abre en una ventana nueva)

Plantilla usada en esta página:

MediaWiki spam blocked by CleanTalk.