Modulo:Citazione/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Moroboshi (discussione | contributi)
+gestione per wikisource
Moroboshi (discussione | contributi)
Nessun oggetto della modifica
Riga 815:
 
--[[ ===============================================================================
Genera link a wikisource
===============================================================================]]
local function build_wikisource_link(language, title, chapter, anchor)
if is_set(Editiontitle) then
local wksource = (is_set(language) and (":" .. language .. ":s:")) or "s:"
wksource = wksource return mw.ustring. (format("s:%s%s%s%s", is_set(titlelanguage) and title(language .. ":") or "") ,
wksource title, = wksource .. ((is_set(chapter) and ("/" .. chapter)) or "") ,
wksource = wksource .. ((is_set(anchor) and ("/#" .. anchor)) or "")
end
return wksource
end
 
Riga 1 182:
TitleLink = '';
TransTitle = '';
end
 
---------------------------------------------------------------
-- Compone la stringa del linguaggio
---------------------------------------------------------------
local Language_code = ""
local first_language = ""
if is_set(Language) then
if Language:sub(1,1) == "(" then
Language_code = Language
else
local frame_lingue = {return_error='true'}
for lingua in mw.text.gsplit(Language, ',', true) do
lingua = mw.text.trim(lingua)
if lingua ~= '' then
frame_lingue[#frame_lingue+1] = lingua
end
end
if #frame_lingue > 1 or (#frame_lingue==1 and frame_lingue[1]:lower()~="it" and frame_lingue[1]:lower()~="it-it") then
first_language = frame_lingue[1]:lower();
local lg_error;
Language_code, lg_error = require("Modulo:Linguaggi").lingue(frame_lingue)
if lg_error and #lg_error > 0 then
local error_string = mw.text.listToText(lg_error, ", ", " e " )
table.insert( z.message_tail, { set_error('unknown_language', {error_string}, true) } );
end
end
end
end
if is_set(Edition) then
if A:ORIGIN('Edition') == "ed" or tonumber(Edition) then
Edition = Edition .. "ª ed."
end
end
 
Riga 1 192 ⟶ 1 225:
TitleLink = build_wikisource_link(first_language, TitleLink, "", Anchor)
elseif is_set(Title) then
TitleLink = build_wikisource_link(first_language, Title, "", (is_set(Chapter) and "") or Anchor)
end
if is_set(ChapterLink) then
ChapterLink = build_wikisource_link(first_language, ChapterLink, "", Anchor)
elseif is_set(Chapter) and is_set(Title) then
ChapterLink = build_wikisource_link(first_language, Title, Chapter, Anchor)
end
Riga 1 439 ⟶ 1 472:
elseif is_set(ConferenceURL) then
Conference = external_link( ConferenceURL, nil, ConferenceURLorigin );
end
 
---------------------------------------------------------------
-- Compone la stringa del linguaggio
---------------------------------------------------------------
local Language_code = ""
local first_language = ""
if is_set(Language) then
if Language:sub(1,1) == "(" then
Language_code = Language
else
local frame_lingue = {return_error='true'}
for lingua in mw.text.gsplit(Language, ',', true) do
lingua = mw.text.trim(lingua)
if lingua ~= '' then
frame_lingue[#frame_lingue+1] = lingua
end
end
if #frame_lingue > 1 or (#frame_lingue==1 and frame_lingue[1]:lower()~="it" and frame_lingue[1]:lower()~="it-it") then
first_language = frame_lingue[1]:lower();
local lg_error;
Language_code, lg_error = require("Modulo:Linguaggi").lingue(frame_lingue)
if lg_error and #lg_error > 0 then
local error_string = mw.text.listToText(lg_error, ", ", " e " )
table.insert( z.message_tail, { set_error('unknown_language', {error_string}, true) } );
end
end
end
end
 
if is_set(Edition) then
if A:ORIGIN('Edition') == "ed" or tonumber(Edition) then
Edition = Edition .. "ª ed."
end
end