local kb1 ={}; --[[--------------------------) for automated parsing of citation information. -- handle the oddity that is cite encyclopedia and . Here we presume that -- when Periodical, Title, and Chapter are all set, then Periodical is the book (encyclopedia) title, Title -- is the article title, and Chapter is a section within the article. So, we remap local coins_chapter = Chapter; -- default assuming that remapping not required local coins_title = Title; -- et tu if 'ansiklopedi' config.CitationClass or ('kaynak' config.CitationClass and is_set (Encyclopedia)) then if is_set (Chapter) and is_set (Title) and is_set (Periodical) then -- if all are used then coins_chapter = Title; -- remap coins_title = Periodical; end end local coins_author = a; -- default for coins rft.au if 0 element local options = {}; if is_set(config.CitationClass) and config.CitationClass ~= "kaynak" then options.class = config.CitationClass; options.class = "kaynak " .. config.CitationClass; -- class=citation required for blue highlight when used with |ref= else options.class = "kaynak"; end if is_set(Ref) and Ref:lower ~= "none" then -- set reference anchor if appropriate local id = Ref if ('harv' == Ref ) then local namelist = {}; -- holds selected contributor, author, editor name list local year = first_set ({Year, anchor_year}, 2); -- Year first for legacy citations and for YMD dates that require disambiguation if #c > 0 then -- if there is a contributor list namelist = c; -- select it elseif #a > 0 then -- or an author list namelist = a; elseif #e > 0 then -- or an editor list namelist = e; end if #namelist > 0 then -- if there are names in namelist id = anchor_id (namelist, year); -- go make the CITEREF anchor else id = ; -- unset end end options.id = id; end if string.len(text:gsub("", "%1"):gsub("%b<>","")) <= 2 then -- remove <span>'); end no_tracking_cats = no_tracking_cats:lower; if in_array(no_tracking_cats, {"", "no", "false", "n"}) then for _, v in ipairs( z.error_categories ) do table.insert (render, make_wikilink ('Kategori:' .. v)); end for _, v in ipairs( z.maintenance_cats ) do -- append maintenance categories table.insert (render, make_wikilink ('Kategori:' .. v)); end for _, v in ipairs( z.properties_cats ) do -- append properties categories table.insert (render, make_wikilink ('Kategori:' .. v)); end end return table.concat (render); end ----------------------------< C S 1 . C I T A T I O N >------------------------------------------------------ This is used by templates such as to create the actual citation text. function kb1.kaynak(frame) Frame = frame; -- save a copy incase we need to display an error message in preview mode local pframe = frame:getParent local validation, utilities, identifiers, metadata; if nil ~= string.find (frame:getTitle, 'sandbox', 1, true) then -- did the use sandbox version? cfg = mw.loadData('Modül:Kaynak/KB1/Yapılandırma/sandbox'); -- load sandbox versions of support modules whitelist = mw.loadData('Modül:Kaynak/KB1/Beyazliste/sandbox'); utilities = require('Modül:Kaynak/KB1/Araçlar/sandbox'); validation = require('Modül:Kaynak/KB1/Tarih doğrulama/sandbox'); identifiers = require('Modül:Kaynak/KB1/Tanımlayıcılar/sandbox'); metadata = require('Modül:Kaynak/KB1/COinS/sandbox'); else -- otherwise cfg = mw.loadData('Modül:Kaynak/KB1/Yapılandırma'); -- load live versions of support modules whitelist = mw.loadData('Modül:Kaynak/KB1/Beyazliste'); utilities = require('Modül:Kaynak/KB1/Araçlar'); validation = require('Modül:Kaynak/KB1/Tarih doğrulama'); identifiers = require('Modül:Kaynak/KB1/Tanımlayıcılar'); metadata = require('Modül:Kaynak/KB1/COinS'); end utilities.set_selected_modules (cfg); -- so that functions in Utilities can see the cfg tables identifiers.set_selected_modules (cfg, utilities); -- so that functions in Identifiers can see the selected cfg tables and selected Utilities module validation.set_selected_modules (cfg, utilities); -- so that functions in Date validataion can see selected cfg tables and the selected Utilities module metadata.set_selected_modules (cfg, utilities); -- so that functions in COinS can see the selected cfg tables and selected Utilities module dates = validation.dates; -- imported functions from Modül:Kaynak/KB1/Date validation year_date_check = validation.year_date_check; reformat_dates = validation.reformat_dates; date_hyphen_to_dash = validation.date_hyphen_to_dash; date_name_xlate = validation.date_name_xlate; is_set = utilities.is_set; -- imported functions from Modül:Kaynak/KB1/Utilities in_array = utilities.in_array; substitute = utilities.substitute; error_comment = utilities.error_comment; set_error = utilities.set_error; select_one = utilities.select_one; add_maint_cat = utilities.add_maint_cat; wrap_style = utilities.wrap_style; safe_for_italics = utilities.safe_for_italics; is_wikilink = utilities.is_wikilink; make_wikilink = utilities.make_wikilink; z = utilities.z; -- table of error and category tables in Modül:Kaynak/KB1/Utilities extract_ids = identifiers.extract_ids; -- imported functions from Modül:Kaynak/KB1/Identifiers build_id_list = identifiers.build_id_list; is_embargoed = identifiers.is_embargoed; extract_id_access_levels = identifiers.extract_id_access_levels; make_coins_title = metadata.make_coins_title; -- imported functions from Modül:Kaynak/KB1/COinS get_coins_pages = metadata.get_coins_pages; COinS = metadata.COinS; local args = {}; -- table where we store all of the template's arguments local suggestions = {}; -- table where we store suggestions if we need to loadData them local error_text, error_state; local config = {}; -- table to store parameters from the module for k, v in pairs( frame.args ) do config[k] = v; -- args[k] = v; -- debug tool that allows us to render a citation from module end local capture; -- the single supported capture when matching unknown parameters using patterns for k, v in pairs( pframe.args ) do if v ~= then if ('string' type (k)) then k mw.ustring.gsub (k, '%d', cfg.date_names.yerel_rakamlar); -- for enumerated parameters, translate 'local' digits to Western 0-9 end if not validate( k, config.CitationClass ) then error_text ""; if type( k ) ~ 'string' then -- Exclude empty numbered parameters if v:match("%S+") ~ nil then error_text, error_state set_error( 'yazı-görme', {v}, true ); end elseif validate( k:lower, config.CitationClass ) then error_text, error_state set_error( 'parametre-görme-öneri', {k, k:lower}, true ); else if nil suggestions.suggestions then -- if this table is nil then we need to load it if nil ~= string.find (frame:getTitle, 'sandbox', 1, true) then -- did the use sandbox version? suggestions = mw.loadData( 'Modül:Kaynak/KB1/Öneriler/sandbox' ); -- use the sandbox version else suggestions = mw.loadData( 'Modül:Kaynak/KB1/Öneriler' ); -- use the live version end end for pattern, param in pairs (suggestions.patterns) do -- loop through the patterns to see if we can suggest a proper parameter capture = k:match (pattern); -- the whole match if no caputre in pattern else the capture if a match if capture then -- if the pattern matches param = substitute( param, capture ); -- add the capture to the suggested parameter (typically the enumerator) error_text, error_state = set_error( 'parametre-görme-öneri', {k, param}, true ); -- set the error message end end if not is_set (error_text) then -- couldn't match with a pattern, is there an expicit suggestion? if suggestions.suggestions[ k:lower ] ~= nil then error_text, error_state = set_error( 'parametre-görme-öneri', {k, suggestions.suggestions[ k:lower ]}, true ); else error_text, error_state = set_error( 'parametre-görme', {k}, true ); v = ; -- unset value assigned to unrecognized parameters (this for the limited parameter lists) end end end if error_text ~= then table.insert( z.message_tail, {error_text, error_state} ); end 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? 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 for k, v in pairs( args ) do if 'string' type (k) then -- don't evaluate positional parameters has_invisible_chars (k, v); end end return citation0( config, args, frame) end return kb1;