"ମଡ୍ୟୁଲ:Citation/CS1" ପୃଷ୍ଠାର ସଂସ୍କରଣଗୁଡ଼ିକ ମଧ୍ୟରେ ତଫାତ
Content deleted Content added
No edit summary |
synch from sandbox; |
||
୫୪୯ କ ଧାଡ଼ି:
end
-- if we get this far we have prefix and script
name = cfg.lang_code_remap[lang] or mw.language.fetchLanguageName( lang, "en" );
if is_set (name) then -- is prefix a proper ISO 639-1 language code?
script_value = script_value:gsub ('^%l%l%s*:%s*', ''); -- strip prefix from script
୬୨୮ କ ଧାଡ଼ି:
chapter = script_concatenate (chapter, scriptchapter) -- <bdi> tags, lang atribute, categorization, etc; must be done after title is wrapped
if is_set (chapterurl) then
chapter = external_link (chapterurl, chapter, chapter_url_source, access); -- adds bare_url_missing_title error if appropriate
end
if is_set (transchapter) then
Line ୬୩୯ ⟶ ୬୪୩:
end
-- chapter = external_link (chapterurl, chapter, chapter_url_source, access); -- adds bare_url_missing_title error if appropriate
return chapter .. chapter_error;
Line ୭୯୯ ⟶ ୮୦୩:
end
-- limited enumerated parameters list
name = name:gsub(
state = whitelist.limited_numbered_arguments[ name ];
if true == state then return true; end -- valid actively supported parameter
Line ୮୧୮ ⟶ ୮୨୨:
end
-- all enumerated parameters allowed
name = name:gsub(
state = whitelist.numbered_arguments[ name ];
Line ୮୯୬ ⟶ ୯୦୦:
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
f.gsub=string.gsub
f.match=string.match
f.sub=string.sub
else -- for multi-byte characters use the ustring library functions
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?
Line ୯୨୦ ⟶ ୯୨୭:
end
-- typically duplicate_char is sepc
if
-- Because individual string segments often (always?) begin with terminal punct for
-- preceding segment: 'First element' .. 'sepc next element' .. etc?
trim = false;
end_chr =
-- str = str .. "<HERE(enchr=" .. end_chr.. ")" -- debug stuff?
if end_chr == duplicate_char then -- if same as separator
str =
elseif end_chr == "'" then -- if it might be wikimarkup
if
str =
elseif
trim = true; -- why? why do this and next differently from previous?
elseif
trim = true; -- same question
end
elseif end_chr == "]" then -- if it might be wikimarkup
if
trim = true;
elseif
trim = true;
elseif
trim = true;
elseif
trim = true;
end
elseif end_chr == " " then -- if last char of output string is a space
if
str =
end
end
Line ୯୫୫ ⟶ ୯୬୨:
if value ~= comp then -- value does not equal comp when value contains html markup
local dup2 = duplicate_char;
if
value =
else
value =
end
end
Line ୯୬୭ ⟶ ୯୭୪:
end
return str;
end
Line ୧,୧୦୫ ⟶ ୧,୧୧୨:
if 'vanc' == format then -- Vancouver-like author/editor name styling?
sep = cfg.presentation['
namesep = cfg.presentation['
else
sep = cfg.presentation['
namesep = cfg.presentation['
end
Line ୧,୩୯୪ ⟶ ୧,୪୦୧:
local function get_iso639_code (lang, this_wiki_code)
if cfg.lang_name_remap[lang:lower()] then -- if there is a remapped name (because MediaWiki uses something that we don't think is correct)
return
▲ return remap[lang:lower()][1], remap[lang:lower()][2]; -- for this language 'name', return a possibly new name and appropriate code
end
୧,୪୪୭ କ ଧାଡ଼ି:
local this_wiki_code = this_wiki:getCode() -- get this wiki's language code
local this_wiki_name = mw.language.fetchLanguageName(this_wiki_code, this_wiki_code); -- get this wiki's language name
names_table = mw.text.split (lang, '%s*,%s*'); -- names should be a comma separated list
Line ୧,୪୬୨ ⟶ ୧,୪୫୭:
if 2 == lang:len() or 3 == lang:len() then -- if two-or three-character code
name = mw.language.fetchLanguageName( lang:lower(), this_wiki_code); -- get language name if |language= is a proper code
if not is_set (name) then
name = cfg.lang_code_remap[lang]; -- not supported by MediaWiki; is it in remap?
end▼
end
Line ୧,୪୭୧ ⟶ ୧,୪୬୯:
if is_set (code) then -- only 2- or 3-character codes
name =
if this_wiki_code ~= code then -- when the language is not the same as this wiki's language
if 2 == code:len() then -- and is a two-character code
add_prop_cat ('foreign_lang_source' .. code, {name, code})
else -- or is a recognized language (but has a three-character code)
add_prop_cat ('foreign_lang_source_2' .. code, {code})
end
end
Line ୧,୫୦୮ ⟶ ୧,୫୦୬:
Set style settings for CS1 citation templates. Returns separator and postscript settings
At en.wiki, for cs1:
ps gets: '.'
sep gets: '.'
]]
Line ୧,୫୧୩ ⟶ ୧,୫୧୪:
local function set_cs1_style (ps)
if not is_set (ps) then -- unless explicitely set to something
ps =
end
return
end
Line ୧,୫୨୨ ⟶ ୧,୫୨୩:
Set style settings for CS2 citation templates. Returns separator, postscript, ref settings
At en.wiki, for cs2:
ps gets: '' (empty string - no terminal punctuation)
sep gets: ','
]]
Line ୧,୫୨୭ ⟶ ୧,୫୩୧:
local function set_cs2_style (ps, ref)
if not is_set (ps) then -- if |postscript= has not been set, set cs2 default
ps = cfg.presentation['ps_cs2'];
end
if not is_set (ref) then -- if |ref= is not set
ref = "harv"; -- set default |ref=harv
end
return cfg.presentation['
end
Line ୧,୯୫୫ ⟶ ୧,୯୫୯:
end
local is_journal = 'journal' == cite_class or (in_array (cite_class, {'citation', 'map', 'interview'}) and 'journal' == origin);
if is_set (page) then
Line ୨,୬୦୦ ⟶ ୨,୬୦୪:
-- legacy: promote PublicationDate to Date if neither Date nor Year are set.
local Date_origin; -- to hold the name of parameter promoted to Date; required for date error messaging
if not is_set (Date) then
Date = Year; -- promote Year to Date
Line ୨,୬୦୬ ⟶ ୨,୬୧୨:
Date = PublicationDate; -- promote PublicationDate to Date
PublicationDate = ''; -- unset, no longer needed
Date_origin = A:ORIGIN('PublicationDate'); -- save the name of the promoted parameter
else
Date_origin = A:ORIGIN('Year'); -- save the name of the promoted parameter
end
else
Date_origin = A:ORIGIN('Date'); -- not a promotion; name required for error messaging
end
Line ୨,୬୨୦ ⟶ ୨,୬୩୧:
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};
local date_parameters_list = {
['access-date'] = {val=AccessDate, name=A:ORIGIN ('AccessDate')},
['archive-date'] = {val=ArchiveDate, name=A:ORIGIN ('ArchiveDate')},
['date'] = {val=Date, name=Date_origin},
['doi-broken-date'] = {val=DoiBroken, name=A:ORIGIN ('DoiBroken')},
['embargo'] = {val=Embargo, name=A:ORIGIN ('Embargo')},
['lay-date'] = {val=LayDate, name=A:ORIGIN ('LayDate')},
['publication-date'] ={val=PublicationDate, name=A:ORIGIN ('PublicationDate')},
['year'] = {val=Year, name=A:ORIGIN ('Year')},
};
anchor_year, Embargo, error_message = dates(date_parameters_list, COinS_date);
-- start temporary Julian / Gregorian calendar uncertainty categorization
if COinS_date.inter_cal_cat then
Line ୨,୬୫୬ ⟶ ୨,୬୭୮:
-- for those wikis that can and want to have English date names translated to the local language,
-- uncomment these three lines. Not supported by en.wiki (for obvious reasons)
-- set date_name_xlate() second argument to true to translate English digits to local digits (will translate ymd dates)
-- if date_name_xlate (date_parameters_list, false) then
-- modified = true;
-- end
if modified then -- if the date_parameters_list values were modified
AccessDate = date_parameters_list['access-date'].val;
ArchiveDate = date_parameters_list['archive-date'].val;
Date = date_parameters_list['date'].val;
DoiBroken = date_parameters_list['doi-broken-date'].val;
LayDate = date_parameters_list['lay-date'].val;
PublicationDate = date_parameters_list['publication-date'].val;
end
else
Line ୨,୮୬୩ ⟶ ୨,୮୮୬:
DeadURL = DeadURL:lower(); -- used later when assembling archived text
if is_set( ArchiveURL ) then
if is_set (ChapterURL) then --
OriginalURL = ChapterURL; -- save copy of source chapter's url for archive text
OriginalURLorigin = ChapterURLorigin; -- name of chapter-url parameter for error messages
OriginalFormat = ChapterFormat; -- and original |chapter-format=
if 'no' ~= DeadURL then
ChapterURL = ArchiveURL -- swap-in the archive's url
ChapterURLorigin = A:ORIGIN('ArchiveURL') -- name of archive-url parameter for error messages
ChapterFormat = ArchiveFormat or ''; -- swap in archive's format
ChapterUrlAccess = nil; -- restricted access levels do not make sense for archived urls
end
elseif is_set (URL) then
Line ୩,୦୪୯ ⟶ ୩,୦୭୩:
if is_set (Translators) then
Others = safe_join ({sepc .. ' '
end
if is_set (Interviewers) then
Others = safe_join ({sepc .. ' '
end
Line ୩,୨୩୩ ⟶ ୩,୨୫୭:
if in_array(config.CitationClass, {"journal","citation"}) and is_set(Periodical) then
if is_set(Others) then Others = safe_join ({Others
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
Line ୩,୫୧୦ ⟶ ୩,୫୩୪:
for k, v in pairs( pframe.args ) do
if v ~= '' then
k = mw.ustring.gsub (k, '%d', cfg.date_names.local_digits); -- for enumerated parameters, translate 'local' digits to Western 0-9
if not validate( k, config.CitationClass ) then
error_text = "";
Line ୩,୫୪୮ ⟶ ୩,୫୭୩:
end
missing_pipe_check (v); -- do we think that there is a parameter that is missing a pipe?
-- TODO: is this the best place for this translation?
elseif args[k] ~= nil or (k == 'postscript') then▼
args[k] = v;
▲ elseif args[k] ~= nil or (k == 'postscript') then -- here when v is empty string
args[k] = v; -- why do we do this? we don't support 'empty' parameters
end
end
|