"মডিউল:উদ্ধৃতি" পাতাটির দুইটি সংশোধিত সংস্করণের মধ্যে পার্থক্য

খেলাঘর থেকে হালনাগাদ
(খেলাঘর থেকে, সঠিক বিন্যাসের তারিখ স্বয়ংক্রিয়ভাবে বাংলা হবে যদি তা ইংরেজিতে থাকে)
(খেলাঘর থেকে হালনাগাদ)
 
local function safe_join( tbl, duplicate_char )
local f = {}; -- create a function table appropriate to type of 'dupicate character'
--[[
if 1 == #duplicate_char then -- for single byte ascii characters use the string library functions
Note: we use string functions here, rather than ustring functions.
f.gsub=string.gsub
f.match=string.match
This has considerably faster performance and should work correctly as
f.sub=string.sub
long as the duplicate_char is strict ASCII. The strings
else -- for multi-byte characters use the ustring library functions
in tbl may be ASCII or UTF8.
f.gsub=mw.ustring.gsub
]]
f.match=mw.ustring.match
f.sub=mw.ustring.sub
end
 
local str = ''; -- the output string
local comp = ''; -- what does 'comp' mean?
end
-- typically duplicate_char is sepc
if comp:f.sub(comp, 1,1) == duplicate_char then -- is first charactiercharacter same as duplicate_char? why test first character?
-- Because individual string segments often (always?) begin with terminal punct for ththe
-- preceding segment: 'First element' .. 'sepc next element' .. etc?
trim = false;
end_chr = str:f.sub(str, -1,-1); -- get the last character of the output string
-- str = str .. "<HERE(enchr=" .. end_chr.. ")" -- debug stuff?
if end_chr == duplicate_char then -- if same as separator
str = str:f.sub(str, 1,-2); -- remove it
elseif end_chr == "'" then -- if it might be wikimarkup
if str:f.sub(str, -3,-1) == duplicate_char .. "''" then -- if last three chars of str are sepc''
str = str:f.sub(str, 1, -4) .. "''"; -- remove them and add back ''
elseif str: f.sub(str, -5,-1) == duplicate_char .. "]]''" then -- if last five chars of str are sepc]]''
trim = true; -- why? why do this and next differently from previous?
elseif str:f.sub(str, -4,-1) == duplicate_char .. "]''" then -- if last four chars of str are sepc]''
trim = true; -- same question
end
elseif end_chr == "]" then -- if it might be wikimarkup
if str:f.sub(str, -3,-1) == duplicate_char .. "]]" then -- if last three chars of str are sepc]] wikilink
trim = true;
elseif str:f.sub(str, -3,-1) == duplicate_char .. '"]' then -- if last three chars of str are sepc"] quoted external link
trim = true;
elseif str: f.sub(str, -2,-1) == duplicate_char .. "]" then -- if last two chars of str are sepc] external link
trim = true;
elseif str:f.sub(str, -4,-1) == duplicate_char .. "'']" then -- normal case when |url=something & |title=Title.
trim = true;
end
elseif end_chr == " " then -- if last char of output string is a space
if str:f.sub(str, -2,-1) == duplicate_char .. " " then -- if last two chars of str are <sepc><space>
str = str:f.sub(str, 1,-3); -- remove them both
end
end
if value ~= comp then -- value does not equal comp when value contains html markup
local dup2 = duplicate_char;
if dup2:f.match(dup2, "%A" ) then dup2 = "%" .. dup2; end -- if duplicate_char not a letter then escape it
value = value:f.gsub(value, "(%b<>)" .. dup2, "%1", 1 ) -- remove duplicate_char if it follows html markup
else
value = value:f.sub(value, 2, -1 ); -- remove duplicate_char when it is first character
end
end
end
return str;
end
 
 
if 0 < #c then
if not is_set (Contribution) then -- |contributor= requires |contribution=
table.insert( z.message_tail, { set_error( 'contributor_missing_required_param', 'contributionঅবদান')}); -- add missing contribution error message
c = {}; -- blank the contributors' table; it is used as a flag later
end
if 0 == #a then -- |contributor= requires |author=
table.insert( z.message_tail, { set_error( 'contributor_missing_required_param', 'authorলেখক')}); -- add missing author error message
c = {}; -- blank the contributors' table; it is used as a flag later
end
 
local UrlAccess = A['UrlAccess'];
if not is_valid_parameter_value (UrlAccess, 'urlইউআরএল-accessসংগ্রহ', cfg.keywords ['url-access']) then
UrlAccess = nil;
end
local error_message = '';
-- AirDate has been promoted to Date so not necessary to check it
local date_parameters_list = {['accessসংগ্রহের-dateতারিখ']=AccessDate, ['archiveআর্কাইভের-dateতারিখ']=ArchiveDate, ['dateতারিখ']=Date, ['doiডিওআই-brokenভাঙ্গার-dateতারিখ']=DoiBroken,
['embargo']=Embargo, ['lay-date']=LayDate, ['publicationপ্রকাশনার-dateতারিখ']=PublicationDate, ['yearবছর']=Year};
 
anchor_year, Embargo, error_message = dates(date_parameters_list, COinS_date);
 
if modified then -- if the date_parameters_list values were modified
AccessDate = date_parameters_list['accessসংগ্রহের-dateতারিখ']; -- overwrite date holding parameters with modified values
ArchiveDate = date_parameters_list['archiveআর্কাইভের-dateতারিখ'];
Date = date_parameters_list['dateতারিখ'];
DoiBroken = date_parameters_list['doiডিওআই-brokenভাঙ্গার-dateতারিখ'];
LayDate = date_parameters_list['lay-date'];
PublicationDate = date_parameters_list['publicationপ্রকাশনার-dateতারিখ'];
end
else
not is_set(ScriptTitle) then
if 'episode' == config.CitationClass then -- special case for cite episode; TODO: is there a better way to do this?
table.insert( z.message_tail, { set_error( 'citation_missing_title', {'seriesধারাবাহিক'}, true ) } );
else
table.insert( z.message_tail, { set_error( 'citation_missing_title', {'titleশিরোনাম'}, true ) } );
end
end
TransTitle = " " .. TransTitle;
else
TransError = " " .. set_error( 'trans_missing_title', {'titleশিরোনাম'} );
end
end
if is_set (Translators) then
Others = safe_join ({sepc .. ' ' .., wrap_msg ('translated', Translators, use_lowercase) .., Others}, sepc);
end
if is_set (Interviewers) then
Others = safe_join ({sepc .. ' ' .., wrap_msg ('interview', Interviewers, use_lowercase) .., Others}, sepc);
end
if in_array(config.CitationClass, {"journal","citation"}) and is_set(Periodical) then
if is_set(Others) then Others = safe_join ({Others .., sepc .. " "}, sepc) end -- add terminal punctuation & space; check for dup sepc; TODO why do we need to do this here?
tcommon = safe_join( {Others, Title, TitleNote, Conference, Periodical, Format, TitleType, Series, Language, Edition, Publisher, Agency, Volume}, sepc );
elseif in_array(config.CitationClass, {"book","citation"}) and not is_set(Periodical) then -- special cases for book cites
end
end
if args.title or args.url then -- this code used at bn.wiki only; not maintained in en.wiki source
add_maint_cat ('bn.wiki_uses_en-lang_params'); -- add maint cat if English parameter name |title= or |url= is used in the template
end -- end bn.wiki only
return citation0( config, args)
end