Sətir 1: |
Sətir 1: |
| + | local u = {} |
| | | |
| local z = { | | local z = { |
Sətir 113: |
Sətir 114: |
| message, | | message, |
| ' (', | | ' (', |
| + | |
| make_wikilink ( | | make_wikilink ( |
| table.concat ( | | table.concat ( |
| { | | { |
− | cfg.messages['help page link'], | + | error_state.anchor_page or cfg.messages['help page link'], -- для рувики: часть документации на русском, часть - на английском |
| '#', | | '#', |
| error_state.anchor | | error_state.anchor |
| }), | | }), |
− | cfg.messages['help page label']), | + | error_state.anchor_label or cfg.messages['help page label']), -- для рувики: часть документации на русском, часть - на английском |
| ')' | | ')' |
| }); | | }); |
| | | |
| + | -- message = table.concat ({message, ' (', substitute (cfg.presentation['wikilink'], |
| + | -- {cfg.messages['help page link'] .. '#' .. error_state.anchor, cfg.messages['help page label']}), ')'}); |
| + | -- message = message .. " ([[" .. cfg.messages['help page link'] .. |
| + | -- "#" .. error_state.anchor .. "|" .. |
| + | -- cfg.messages['help page label'] .. "]])"; |
| + | |
| z.error_ids[ error_id ] = true; | | z.error_ids[ error_id ] = true; |
| if in_array( error_id, { 'bare_url_missing_title', 'trans_missing_title' } ) | | if in_array( error_id, { 'bare_url_missing_title', 'trans_missing_title' } ) |
Sətir 334: |
Sətir 342: |
| local wl_type = 2; -- assume that str is a complex wikilink [[L|D]] | | local wl_type = 2; -- assume that str is a complex wikilink [[L|D]] |
| | | |
− | L, D = str:match ('^%[%[([^|]+)|([^%]]+)%]%]$'); -- get L and D from [[L|D]] | + | L, D = str:match ('%[%[([^|]+)|([^%]]+)%]%]'); -- get L and D from [[L|D]] |
| | | |
| if not is_set (D) then -- if no separate link | | if not is_set (D) then -- if no separate link |
− | D = str:match ('^%[%[([^%]]*)|*%]%]$'); -- get D from [[D]] | + | D = str:match ('%[%[([^%]]*)|*%]%]'); -- get D from [[D]] |
| wl_type = 1; | | wl_type = 1; |
| end | | end |
Sətir 350: |
Sətir 358: |
| | | |
| return wl_type, D, L or ''; | | return wl_type, D, L or ''; |
− | end
| |
− |
| |
− |
| |
− | --[[--------------------------< S T R I P _ A P O S T R O P H E _ M A R K U P >--------------------------------
| |
− |
| |
− | Strip wiki italic and bold markup from argument so that it doesn't contaminate COinS metadata.
| |
− | This function strips common patterns of apostrophe markup. We presume that editors who have taken the time to
| |
− | markup a title have, as a result, provided valid markup. When they don't, some single apostrophes are left behind.
| |
− |
| |
− | Returns the argument without wiki markup and a number; the number is more-or-less meaningless except as a flag
| |
− | to indicate that markup was replaced; do not rely on it as an indicator of how many of any kind of markup was
| |
− | removed; returns the argument and nil when no markup removed
| |
− |
| |
− | ]]
| |
− |
| |
− | local function strip_apostrophe_markup (argument)
| |
− | if not is_set (argument) then
| |
− | return argument, nil; -- no argument, nothing to do
| |
− | end
| |
− |
| |
− | if nil == argument:find ( "''", 1, true ) then -- Is there at least one double apostrophe? If not, exit.
| |
− | return argument, nil;
| |
− | end
| |
− |
| |
− | local flag;
| |
− | while true do
| |
− | if argument:find ( "'''''", 1, true ) then -- bold italic (5)
| |
− | argument, flag=argument:gsub("%'%'%'%'%'", ""); -- remove all instances of it
| |
− | elseif argument:find ( "''''", 1, true ) then -- italic start and end without content (4)
| |
− | argument, flag=argument:gsub("%'%'%'%'", "");
| |
− | elseif argument:find ( "'''", 1, true ) then -- bold (3)
| |
− | argument, flag=argument:gsub("%'%'%'", "");
| |
− | elseif argument:find ( "''", 1, true ) then -- italic (2)
| |
− | argument, flag=argument:gsub("%'%'", "");
| |
− | else
| |
− | break;
| |
− | end
| |
− | end
| |
− |
| |
− | return argument, flag; -- done
| |
| end | | end |
| | | |
Sətir 405: |
Sətir 373: |
| | | |
| | | |
− | --[[--------------------------< E X P O R T S >----------------------------------------------------------------
| |
− | ]]
| |
| | | |
− | return { | + | return { -- return exported functions and tables |
− | is_set = is_set, -- exported functions | + | is_set = is_set, |
| in_array = in_array, | | in_array = in_array, |
| substitute = substitute, | | substitute = substitute, |
Sətir 422: |
Sətir 388: |
| make_wikilink = make_wikilink, | | make_wikilink = make_wikilink, |
| set_selected_modules = set_selected_modules, | | set_selected_modules = set_selected_modules, |
− | strip_apostrophe_markup = strip_apostrophe_markup,
| + | z = z, |
− | z = z, -- exported table | |
| } | | } |