模块:Citation/CS1/Suggestions:修订间差异

imported>Great Brightstar
无编辑摘要
imported>Xiplus-abot
已更改“Module:Citation/CS1/Suggestions”的保护设置:​高風險模板:105157引用<!-- 機器人3 -->([编辑=仅允许管理员](无限期)[移动=仅允许管理员](无限期))
 
(未显示2个用户的3个中间版本)
第3行: 第3行:


suggestions = {
suggestions = {
    ['acccessdate'] = 'accessdate',
-- ['acccessdate'] = 'access-date',
    ['accesdate'] = 'accessdate',
-- ['accesdate'] = 'access-date',
    ['access date'] = 'accessdate',
-- ['access date'] = 'access-date',
    ['access-date'] = 'accessdate',
-- ['accessate'] = 'access-date',
    ['accessate'] = 'accessdate',
-- ['accessdare'] = 'access-date',
    ['accessdare'] = 'accessdate',
-- ['accessdatte'] = 'access-date',
    ['accessdatte'] = 'accessdate',
-- ['accessddate'] = 'access-date',
    ['accessddate'] = 'accessdate',
-- ['accessdte'] = 'access-date',
    ['accessdte'] = 'accessdate',
-- ['accessed'] = 'access-date',
    ['accessed'] = 'accessdate',
-- ['accessedate'] = 'access-date',
    ['accessedate'] = 'accessdate',
-- ['accesssdate'] = 'access-date',
    ['accesssdate'] = 'accessdate',
-- ['accssdate'] = 'access-date',
    ['accssdate'] = 'accessdate',
-- ['acessdate'] = 'access-date',
    ['acessdate'] = 'accessdate',
['address'] = 'location',
    ['address'] = 'location',
['année'] = 'year', -- French
    ['année'] = 'year', -- French
['añoacceso'] = 'access-date', -- Spanish, Italian
    ['añoacceso'] = 'accessyear', -- Spanish, Italian
['apellido'] = 'last', -- Spanish, Italian
    ['apellido'] = 'last', -- Spanish, Italian
['archive date'] = 'archive-date',
    ['archive date'] = 'archivedate',
['archive url'] = 'archive-url', -- Spanish, Italian
    ['archive url'] = 'archiveurl', -- Spanish, Italian
['artist'] = 'others',
    ['auteur'] = 'author', -- French
['auteur'] = 'author', -- French
    ['auther'] = 'author',
['auther'] = 'author',
    ['author link'] = 'authorlink',
['authorformat'] = 'name-list-format', -- remove after 2016-01-01
    ['autor'] = 'author', -- Spanish, Italian
['author-format'] = 'name-list-format', -- remove after 2016-01-01
    ['autor2'] = 'author2', -- Spanish, Italian
['author link'] = 'author-link',
    ['autthor'] = 'author',
-- ['autor'] = 'author', -- Spanish, Italian
    ['cita'] = 'quote', -- Spanish, Italian
-- ['autor2'] = 'author2', -- Spanish, Italian
    ['coautores'] = 'coauthors', -- Spanish, Italian
['autthor'] = 'author',
    ['consulté le'] = 'accessdate', -- French
['began'] = 'date', -- remove after 2016-01-01
    ['distributor'] = 'publisher',
['chapter_title'] = 'chapter',
    ['éditeur'] = 'editor', -- French
['cita'] = 'quote', -- Spanish, Italian
    ['editorial'] = 'publisher',
['coautores'] = 'coauthors', -- Spanish, Italian
    ['en ligne le'] = 'archivedate', -- French
['consulté le'] = 'access-date', -- French
    ['enlaceautor'] = 'authorlink', -- Spanish, Italian
['deadlink'] = 'dead-url',
    ['fecha'] = 'date', -- Spanish, Italian
['distributor'] = 'publisher',
    ['fechaacceso'] = 'accessdate', -- Spanish, Italian
['éditeur'] = 'editor', -- French
    ['fechaarchivo'] = 'archivedate', -- Spanish, Italian
['editon'] = 'edition',
    ['filetype'] = 'format',
['editoin'] = 'edition',
    ['first 1'] = 'first1',
['editorformat'] = 'name-list-format', -- remove after 2016-01-01
    ['foramt'] = 'format',
['editor-format'] = 'name-list-format', -- remove after 2016-01-01
    ['formato'] = 'format', -- Spanish, Italian
['editorgiven'] = 'editor-given', -- remove after 2016-01-01
    ['frist'] = 'first',
['editorial'] = 'publisher',
    ['idioma'] = 'language', -- Spanish, Italian
['editorsurname'] = 'editor-surname', -- remove after 2016-01-01
    ['lang'] = 'language',
['en ligne le'] = 'archive-date', -- French
    ['langauge'] = 'language',
['ended'] = 'date', -- remove after 2016-01-01
    ['langue'] = 'language', -- French
['enlaceautor'] = 'author-link', -- Spanish, Italian
    ['last 1'] = 'last1',
['fecha'] = 'date', -- Spanish, Italian
    ['lieu'] = 'location', -- French
['fechaacceso'] = 'access-date', -- Spanish, Italian
    ['lire en ligne'] = 'url', -- French
['fechaarchivo'] = 'archive-date', -- Spanish, Italian
    ['loaction'] = 'location',
['filetype'] = 'format',
    ['locatoin'] = 'location',
['first 1'] = 'first1',
    ['mois'] = 'month', -- French
['foramt'] = 'format',
--   ['name'] = 'author', -- 'name' is often erroneously used for 'title' and 'work' as well, so no suggestion is better than a wrong suggestion
['formato'] = 'format', -- Spanish, Italian
    ['newpaper'] = 'newspaper',
['frist'] = 'first',
    ['news'] = 'newspaper',
['idioma'] = 'language', -- Spanish, Italian
    ['nom'] = 'last', -- French
['isnb'] = 'isbn',
    ['nom1'] = 'last1', -- French
['lang'] = 'language',
    ['nombre'] = 'first', -- Spanish, Italian
['langauge'] = 'language',
    ['obra'] = 'work', -- Spanish, Italian
['langue'] = 'language', -- French
    ['origdate'] = 'origyear',
['last 1'] = 'last1',
    ['other'] = 'others',
['lieu'] = 'location', -- French
    ['pagees'] = 'pages',
['lire en ligne'] = 'url', -- French
    ['página'] = 'page', -- Spanish, Italian
['loaction'] = 'location',
    ['páginas'] = 'pages', -- Spanish, Italian
['locatoin'] = 'location',
    ['passage'] = 'pages', -- French
['mois'] = 'month', -- French
    ['périodique'] = 'publisher', -- French
['month'] = 'date', -- remove after 2016-01-01
    ['plublisher'] = 'publisher',
-- ['name'] = 'author', -- 'name' is often erroneously used for 'title' and 'work' as well, so no suggestion is better than a wrong suggestion
    ['prénom'] = 'first', -- French
['nespaper'] = 'newspaper',
    ['prénom1'] = 'first1', -- French
['newpaper'] = 'newspaper',
    ['pub'] = 'publisher',
['news'] = 'newspaper',
    ['pubisher'] = 'publisher',
['nom'] = 'last', -- French
    ['publiser'] = 'publisher',
['nom1'] = 'last1', -- French
    ['publsher'] = 'publisher',
['nombre'] = 'first', -- Spanish, Italian
    ['publsiher'] = 'publisher',
['obra'] = 'work', -- Spanish, Italian
    ['pulbication-place'] = 'publication-place',
['origdate'] = 'orig-year',
    ['pulbisher'] = 'publisher',
['other'] = 'others',
    ['retrieved'] = 'accessdate',
['pagees'] = 'pages',
    ['série'] = 'work', -- French
['página'] = 'page', -- Spanish, Italian
    ['service'] = 'agency',
['páginas'] = 'pages', -- Spanish, Italian
    ['suscripción'] = 'subscription', -- Spanish, Italian
['passage'] = 'pages', -- French
    ['tile'] = 'title',
['périodique'] = 'publisher', -- French
    ['tite'] = 'title',
['plublisher'] = 'publisher',
    ['titolo'] = ' title', -- Spanish, Italian
['pmcid'] = 'pmc',
    ['titre'] = 'title', -- French
['prénom'] = 'first', -- French
    ['título'] = 'title', -- Spanish, Italian
['prénom1'] = 'first1', -- French
    ['transchapter'] = 'trans-chapter',
['ps'] = 'postscript',
    ['translator'] = 'others',
['pub'] = 'publisher',
    ['transtitle'] = 'trans-title',
-- ['pubisher'] = 'publisher',
    ['ubicación'] = 'location', -- Spanish, Italian
-- ['publiser'] = 'publisher',
    ['urlarchivo'] = 'archiveurl', -- Spanish, Italian
-- ['publishers'] = 'publisher',
-- ['publsher'] = 'publisher',
-- ['publsiher'] = 'publisher',
['pulbication-place'] = 'publication-place',
-- ['pulbisher'] = 'publisher',
-- ['pulisher'] = 'publisher',
['retrieved'] = 'access-date',
['separator'] = 'mode', -- remove after 2016-01-01
['série'] = 'work', -- French
['service'] = 'agency',
['suscripción'] = 'subscription', -- Spanish, Italian
['tile'] = 'title',
['tite'] = 'title',
['titolo'] = 'title', -- Spanish, Italian
['titre'] = 'title', -- French
['título'] = 'title', -- Spanish, Italian
['transchapter'] = 'trans-chapter',
['translator'] = 'others',
['transtitle'] = 'trans-title',
['ubicación'] = 'location', -- Spanish, Italian
['urlarchivo'] = 'archive-url', -- Spanish, Italian
['vol'] = 'volume',
}
}
return suggestions;
 
 
--[[--------------------------< P A T T E R N S >--------------------------------------------------------------
 
Here we use Lua patterns to make suggestions.  The form is ['pattern'] = 'correct',
 
Lua patterns are not regex though they are similar.  The escape character is '%', not '\'.  For more information about
lua patterns, see: Extension:Scribunto/Lua_reference_manual#Patterns
 
Patterns should probably always include the '^' and '$' anchor assertions to prevent a partial match from incorrectly
suggesting the wrong parameter name.  For instance, the pattern 'a[utho]+r' matches 'author' in the no-longer-supported
parameter |author-separator= so the code suggests '|author='; the same pattern also matches the no-longer-supported
parameter |separator= (returning 'ator') so again, the code suggests '|author='.
 
One capture is supported, typically the enumerator from an enumerated parameter (the '6' in |author6=, etc.)  The value from the
capture replaces $1 in the 'correct' value.
 
]]
 
local patterns = {
['^ac+es+ ?d?a?t?e?$'] = 'access-date',
['^a[utho]+r$'] = 'author',
['^a[utho]+r(%d+)$'] = 'author$1', -- enumerated
['^pu[blish]+ers?$'] = 'publisher',
}
 
return {suggestions = suggestions, patterns=patterns};