m
→top: Typo fixing, typos fixed: wikipedia → Wikipedia (2), latin → Latin, et al → et al. (7), , → , (2), etc → etc. (8), parenthases → parentheses, Extention → Extension, intials → initials, mesages → messages, realy → really, supress → suppress, upto → up to, atribute → attribute (5)
en>Headbomb m (Reverted edits by CitationCleanerBot (talk) to last version by Le Deluge) |
Viceroy Sam (talk | contribs) m (→top: Typo fixing, typos fixed: wikipedia → Wikipedia (2), latin → Latin, et al → et al. (7), , → , (2), etc → etc. (8), parenthases → parentheses, Extention → Extension, intials → initials, mesages → messages, realy → really, supress → suppress, upto → up to, atribute → attribute (5)) |
||
(One intermediate revision by one other user not shown) | |||
Line 321: | Line 321: | ||
--[[--------------------------< L I N K _ P A R A M _ O K >--------------------------------------------------- | --[[--------------------------< L I N K _ P A R A M _ O K >--------------------------------------------------- | ||
checks the content of |title-link=, |series-link=, |author-link= etc for properly formatted content: no wikilinks, no urls | checks the content of |title-link=, |series-link=, |author-link= etc. for properly formatted content: no wikilinks, no urls | ||
Link parameters are to hold the title of a | Link parameters are to hold the title of a Wikipedia article so none of the WP:TITLESPECIALCHARACTERS are allowed: | ||
# < > [ ] | { } _ | # < > [ ] | { } _ | ||
except the underscore which is used as a space in wiki urls and # which is used for section links | except the underscore which is used as a space in wiki urls and # which is used for section links | ||
Line 624: | Line 624: | ||
local function script_concatenate (title, script) | local function script_concatenate (title, script) | ||
if is_set (script) then | if is_set (script) then | ||
script = format_script_value (script); -- <bdi> tags, lang | script = format_script_value (script); -- <bdi> tags, lang attribute, categorization, etc.; returns empty string on error | ||
if is_set (script) then | if is_set (script) then | ||
title = title .. ' ' .. script; -- concatenate title and script title | title = title .. ' ' .. script; -- concatenate title and script title | ||
Line 646: | Line 646: | ||
end | end | ||
if true == lower then | if true == lower then | ||
msg = cfg.messages[key]:lower(); -- set the message to lower case before | msg = cfg.messages[key]:lower(); -- set the message to lower case before | ||
return substitute( msg, str ); -- including template text | return substitute( msg, str ); -- including template text | ||
Line 772: | Line 771: | ||
end | end | ||
chapter = script_concatenate (chapter, scriptchapter) -- <bdi> tags, lang | chapter = script_concatenate (chapter, scriptchapter) -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped | ||
if is_set (transchapter) then | if is_set (transchapter) then | ||
Line 1,717: | Line 1,716: | ||
if nil == mw.ustring.find (last, "^[A-Za-zÀ-ÖØ-öø-ƿDŽ-ɏ%-%s%']*$") or nil == mw.ustring.find (first, "^[A-Za-zÀ-ÖØ-öø-ƿDŽ-ɏ%-%s%'%.]*$") then | if nil == mw.ustring.find (last, "^[A-Za-zÀ-ÖØ-öø-ƿDŽ-ɏ%-%s%']*$") or nil == mw.ustring.find (first, "^[A-Za-zÀ-ÖØ-öø-ƿDŽ-ɏ%-%s%'%.]*$") then | ||
add_vanc_error (); | add_vanc_error (); | ||
return false; -- not a string of | return false; -- not a string of Latin characters; Vancouver required Romanization | ||
end; | end; | ||
return true; | return true; | ||
Line 1,728: | Line 1,727: | ||
Names in |firstn= may be separated by spaces or hyphens, or for initials, a period. See http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35062/. | Names in |firstn= may be separated by spaces or hyphens, or for initials, a period. See http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35062/. | ||
Vancouver style requires family rank designations (Jr, II, III, etc) to be rendered as Jr, 2nd, 3rd, etc. This form is not | Vancouver style requires family rank designations (Jr, II, III, etc.) to be rendered as Jr, 2nd, 3rd, etc. This form is not | ||
currently supported by this code so correctly formed names like Smith JL 2nd are converted to Smith J2. See http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35085/. | currently supported by this code so correctly formed names like Smith JL 2nd are converted to Smith J2. See http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35085/. | ||
Line 2,198: | Line 2,197: | ||
Validates language names provided in |language= parameter if not an ISO639-1 code. Handles the special case that is Norwegian where | Validates language names provided in |language= parameter if not an ISO639-1 code. Handles the special case that is Norwegian where | ||
ISO639-1 code 'no' is mapped to language name 'Norwegian Bokmål' by | ISO639-1 code 'no' is mapped to language name 'Norwegian Bokmål' by Extension:CLDR. | ||
Returns the language name and associated ISO639-1 code. Because case of the source may be incorrect or different from the case that Wikimedia | Returns the language name and associated ISO639-1 code. Because case of the source may be incorrect or different from the case that Wikimedia | ||
Line 2,277: | Line 2,276: | ||
if is_set (code) then | if is_set (code) then | ||
if 'no' == code then name = 'Norwegian' end; -- override | if 'no' == code then name = 'Norwegian' end; -- override Wikimedia when code is 'no' | ||
if 'en' ~= code then -- English not the language | if 'en' ~= code then -- English not the language | ||
add_prop_cat ('foreign_lang_source', {name, code}) | add_prop_cat ('foreign_lang_source', {name, code}) | ||
Line 2,396: | Line 2,395: | ||
local function style_format (format, url, fmt_param, url_param) | local function style_format (format, url, fmt_param, url_param) | ||
if is_set (format) then | if is_set (format) then | ||
format = wrap_style ('format', format); -- add leading space, | format = wrap_style ('format', format); -- add leading space, parentheses, resize | ||
if not is_set (url) then | if not is_set (url) then | ||
format = format .. set_error( 'format_missing_url', {fmt_param, url_param} ); -- add an error message | format = format .. set_error( 'format_missing_url', {fmt_param, url_param} ); -- add an error message | ||
Line 2,499: | Line 2,498: | ||
for i, v_name in ipairs(v_name_table) do | for i, v_name in ipairs(v_name_table) do | ||
if v_name:match ('^%(%(.+%)%)$') then -- corporate authors are wrapped in doubled parenthese to | if v_name:match ('^%(%(.+%)%)$') then -- corporate authors are wrapped in doubled parenthese to suppress vanc formatting and error detection | ||
first = ''; -- set to empty string for concatenation and because it may have been set for previous author/editor | first = ''; -- set to empty string for concatenation and because it may have been set for previous author/editor | ||
last = v_name:match ('^%(%((.+)%)%)$') | last = v_name:match ('^%(%((.+)%)%)$') | ||
Line 2,506: | Line 2,505: | ||
lastfirstTable = {} | lastfirstTable = {} | ||
lastfirstTable = mw.text.split(v_name, "%s") | lastfirstTable = mw.text.split(v_name, "%s") | ||
first = table.remove(lastfirstTable); -- removes and returns value of last element in table which should be author | first = table.remove(lastfirstTable); -- removes and returns value of last element in table which should be author initials | ||
last = table.concat(lastfirstTable, " ") -- returns a string that is the concatenation of all other names that are not initials | last = table.concat(lastfirstTable, " ") -- returns a string that is the concatenation of all other names that are not initials | ||
if mw.ustring.match (last, '%a+%s+%u+%s+%a+') or mw.ustring.match (v_name, ' %u %u$') then | if mw.ustring.match (last, '%a+%s+%u+%s+%a+') or mw.ustring.match (v_name, ' %u %u$') then | ||
Line 3,760: | Line 3,759: | ||
do -- now do translators | do -- now do translators | ||
control.maximum = #t; -- number of translators | control.maximum = #t; -- number of translators | ||
Translators = list_people(control, t, false, 'translator'); -- et al not currently supported | Translators = list_people(control, t, false, 'translator'); -- et al. not currently supported | ||
end | end | ||
do -- now do contributors | do -- now do contributors | ||
control.maximum = #c; -- number of contributors | control.maximum = #c; -- number of contributors | ||
Contributors = list_people(control, c, false, 'contributor'); -- et al not currently supported | Contributors = list_people(control, c, false, 'contributor'); -- et al. not currently supported | ||
end | end | ||
do -- now do authors | do -- now do authors | ||
control.maximum , author_etal = get_display_authors_editors (A['DisplayAuthors'], #a, 'authors', author_etal); | control.maximum, author_etal = get_display_authors_editors (A['DisplayAuthors'], #a, 'authors', author_etal); | ||
if is_set(Coauthors) then -- if the coauthor field is also used, prevent ampersand and et al. formatting. | if is_set(Coauthors) then -- if the coauthor field is also used, prevent ampersand and et al. formatting. | ||
Line 3,779: | Line 3,778: | ||
Authors, author_etal = name_has_etal (Authors, author_etal, false); -- find and remove variations on et al. | Authors, author_etal = name_has_etal (Authors, author_etal, false); -- find and remove variations on et al. | ||
if author_etal then | if author_etal then | ||
Authors = Authors .. ' ' .. cfg.messages['et al']; -- add et al. to authors parameter | Authors = Authors .. ' ' .. cfg.messages['et al.']; -- add et al. to authors parameter | ||
end | end | ||
else | else | ||
Line 3,894: | Line 3,893: | ||
Title = wrap_style ('quoted-title', Title); | Title = wrap_style ('quoted-title', Title); | ||
Title = script_concatenate (Title, ScriptTitle); -- <bdi> tags, lang | Title = script_concatenate (Title, ScriptTitle); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped | ||
TransTitle= wrap_style ('trans-quoted-title', TransTitle ); | TransTitle= wrap_style ('trans-quoted-title', TransTitle ); | ||
elseif 'report' == config.CitationClass then -- no styling for cite report | elseif 'report' == config.CitationClass then -- no styling for cite report | ||
Title = script_concatenate (Title, ScriptTitle); -- <bdi> tags, lang | Title = script_concatenate (Title, ScriptTitle); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped | ||
TransTitle= wrap_style ('trans-quoted-title', TransTitle ); -- for cite report, use this form for trans-title | TransTitle= wrap_style ('trans-quoted-title', TransTitle ); -- for cite report, use this form for trans-title | ||
else | else | ||
Title = wrap_style ('italic-title', Title); | Title = wrap_style ('italic-title', Title); | ||
Title = script_concatenate (Title, ScriptTitle); -- <bdi> tags, lang | Title = script_concatenate (Title, ScriptTitle); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped | ||
TransTitle = wrap_style ('trans-italic-title', TransTitle); | TransTitle = wrap_style ('trans-italic-title', TransTitle); | ||
end | end | ||
Line 4,200: | Line 4,199: | ||
elseif in_array(config.CitationClass, {"book","citation"}) and not is_set(Periodical) then -- special cases for book cites | elseif in_array(config.CitationClass, {"book","citation"}) and not is_set(Periodical) then -- special cases for book cites | ||
if is_set (Contributors) then -- when we are citing foreword, preface, introduction, etc | if is_set (Contributors) then -- when we are citing foreword, preface, introduction, etc. | ||
tcommon = safe_join( {Title, TitleNote}, sepc ); -- author and other stuff will come after this and before tcommon2 | tcommon = safe_join( {Title, TitleNote}, sepc ); -- author and other stuff will come after this and before tcommon2 | ||
tcommon2 = safe_join( {Conference, Periodical, Format, TitleType, Series, Language, Volume, Others, Edition, Publisher, Agency}, sepc ); | tcommon2 = safe_join( {Conference, Periodical, Format, TitleType, Series, Language, Volume, Others, Edition, Publisher, Agency}, sepc ); | ||
Line 4,379: | Line 4,378: | ||
text = text .. ' ' .. v .. ' ([[:Category:' .. v ..'|link]])'; | text = text .. ' ' .. v .. ' ([[:Category:' .. v ..'|link]])'; | ||
end | end | ||
text = text .. '</span>'; -- maintenance | text = text .. '</span>'; -- maintenance messages (really just the names of the categories for now) | ||
end | end | ||
Line 4,661: | Line 4,660: | ||
--12Mar2014 Autofix keywords "Page=" or "Pages" or "?page=". | --12Mar2014 Autofix keywords "Page=" or "Pages" or "?page=". | ||
--13Mar2014 Autofix keywords for title "t*le" | --13Mar2014 Autofix keywords for title "t*le" | ||
--14Mar2014 Autofix edfix1/edfix2 | --14Mar2014 Autofix edfix1/edfix2 up to 3 garbled editor names. | ||
--14Mar2014 Split autofix of editor1 last/first for name order. | --14Mar2014 Split autofix of editor1 last/first for name order. | ||
--14Mar2014 Split autofix of editor2 last/first for name order. | --14Mar2014 Split autofix of editor2 last/first for name order. |