Module:R:Perseus: difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
No edit summary |
Dan Polansky (talk | contribs) Remove «» as per pervious practice: we had no quotation marks, and these particular ones are not the usual quotation marks used in English typography |
||
Line 17: | Line 17: | ||
return ( |
return ( |
||
beta == '' and '' or |
beta == '' and '' or |
||
' |
'[' .. format_perseus_url(title, beta, redirect) .. ' ' .. title .. '] in ' |
||
) |
) |
||
end |
end |
Revision as of 07:08, 16 July 2016
- The following documentation is located at Module:R:Perseus/documentation. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox (diff)
This module implements {{R:Autenrieth}}
, {{R:Elementary Lewis}}
, {{R:Harpocration}}
, {{R:L&S}}
, {{R:LSJ}}
, {{R:Middle Liddell}}
, {{R:Peck}}
, {{R:PersEnc}}
, {{R:Platner}}
, {{R:Slater}}
, {{R:Smith's Antiquities}}
, {{R:Smith's Geography}}
, {{R:Smith's Persons}}
, {{R:Stillwell}}
, and {{R:Zoega}}
.
1 June 2016: An LSJ collision set was added to allow several thousand entries such as πεῖ (peî) and πέρα (péra) to be redirected to the appropriate Perseus lemma disambiguation pages without template arguments. The code was slightly refactored to mitigate the added complexity.
local export = {}
local collisions_lsj = require("Module:R:LSJ/collision-data")
function is_collision(x)
if collisions_lsj[mw.ustring.lower(x)] == nil then return false else return true end
end
function format_perseus_url(title, beta, redirect)
local url_redirect_lhs = 'http://www.perseus.tufts.edu/hopper/resolveform?type=exact&lookup='
local url_entry_lhs = 'http://www.perseus.tufts.edu/hopper/text?doc=Perseus:text:1999.04.0057:entry='
local url_rhs = redirect and '&lang=greek' or ''
return (redirect and url_redirect_lhs or url_entry_lhs)..beta..url_rhs
end
function format_perseus_wikilink(title, beta, redirect)
return (
beta == '' and '' or
'[' .. format_perseus_url(title, beta, redirect) .. ' ' .. title .. '] in '
)
end
function export.create(frame)
local args = frame:getParent().args
local title = args['w'] or mw.title.getCurrentTitle().text
local beta = args[1] or require("Module:grc-polytonic-to-perseus-betacode").polytonic_to_perseus_betacode(title) --polytonic_to_perseus_beta(title)
local redirect = is_collision(title) and not args[1] and not args['w']
return format_perseus_wikilink(title, beta, redirect)
end
return export