-- this is all so very experimental. If anything works, I hope to hive it off
-- proper modules for people to use. Do not expect anything here to work,
-- or be within eyeshot of reasonable style.
local export = {};
local ga = {};
local sga = {};
function ga.lenite ( frame )
-- when called from a template, lenites the first argument according to
-- modern Irish rules and orthography. If an argument of ...|art=|...
-- is supplied, it will trigger slightly different rules for lenition
-- of "s" after "an".
local retval
local word = frame.args
local haitch = "h" -- default to lowercase or Titlecase
if mw.ustring.match( word, "^%u%u" ) then
haitch = "H"
-- unless the first two letters are uppercase, in which case
-- assume it's UPPERCASE.
end
if mw.ustring.match( word, "^" ) then
-- straightforward consonants
retval = mw.ustring.gsub( word, "^(.)", "%1" .. haitch )
elseif mw.ustring.match( word, "^" ) then
-- "s" is more complicated.
if frame.args.art then
retval = "t" .. word
else
retval = mw.ustring.gsub( word, "^(.)", "%1" .. haitch )
end
else
-- if initial vowel, or already lenited, or /S/,
-- or one of those strange foreign letters like "k" or "z",
-- then don't touch it.
retval = word
end
return retval
end
function ga.eclipse ( frame )
local retvar
local word = frame.args
local eclipsis = {
= "n-a", = "nA",
= "n-á", = "nÁ",
= "mb", = "mB",
= "gc", = "gC",
= "nd", = "nD",
= "n-e", = "nE",
= "n-é", = "nÉ",
= "bhf", = "bhF",
= "ng", = "nG",
= "n-i", = "nI",
= "n-í", = "nÍ",
= "n-o", = "nO",
= "n-ó", = "nÓ",
= "bp", = "bP",
= "dt", = "dT",
= "n-u", = "nU",
= "n-ú", = "nÚ"
}
return( mw.ustring.gsub( word, "^.", eclipsis ) )
end
function sga.lenite ( frame )
local retval
local word = frame.args
local lenition = {
= 'ch', = 'Ch',
= 'ḟ', = 'Ḟ',
= 'ph', = 'Ph',
= 'ṡ', = 'Ṡ',
= 'th', = 'Th'
}
return( mw.ustring.gsub( word, "^.", lenition ) )
end
function sga.nasalise ( frame )
local retval
local word = frame.args
if mw.ustring.match( word, "^" ) then
retval = "n-" .. word
elseif mw.ustring.match( word, "^" ) then
retval = "n" .. word
elseif mw.ustring.match( word, "^b" ) then
retval = "m-" .. word
elseif mw.ustring.match( word, "^B" ) then
retval = "m" .. word
else
retval = word
end
return retval
end
export.lenite = ga.lenite
export.eclipse = ga.eclipse
export.nasalise = sga.nasalise
export.sga_lenite = sga.lenite
return export;