45,645
edits
No edit summary |
No edit summary |
||
Line 26: | Line 26: | ||
-- if set to "none" abbreviations aren't formatted at all | -- if set to "none" abbreviations aren't formatted at all | ||
ErrorCategory = "[[Category:Pages with errors in interlinear text]]", | ErrorCategory = "[[Category:Pages with errors in interlinear text]]", | ||
AmbiguousGlossCategory = "", | AmbiguousGlossCategory = "[[Category:Articles with ambiguous glossing abbreviations]]", | ||
MessageGlossingError = "Error(s) in interlinear glossing", | MessageGlossingError = "Error(s) in interlinear glossing", | ||
combining_gender_numbers = "[0-9][0-9]?$", --e.g. G4 '4th gender' or CL7 'class 7' | combining_gender_numbers = "[0-9][0-9]?$", --e.g. G4 '4th gender' or CL7 'class 7' | ||
Line 231: | Line 231: | ||
--------------------- | --------------------- | ||
local function gloss_lookup(a, label, wikilink) | local function gloss_lookup(a, label, wikilink) | ||
local _label, _wikilink, _lookup = nil, nil, nil | local _label, _wikilink, _lookup, source = nil, nil, nil, nil | ||
if gloss_override[a] then _lookup = gloss_override[a] | if gloss_override[a] then | ||
_lookup = gloss_override[a] | |||
source = "local" | |||
elseif data.abbreviations[a] then _lookup = data.abbreviations[a] end | elseif data.abbreviations[a] then _lookup = data.abbreviations[a] end | ||
if _lookup and _lookup.expansion ~= "" then | if _lookup and _lookup.expansion ~= "" then | ||
Line 272: | Line 274: | ||
if not label then label = _label end | if not label then label = _label end | ||
if not wikilink then wikilink = _wikilink end | if not wikilink then wikilink = _wikilink end | ||
return label, wikilink | return label, wikilink, source | ||
end | end | ||
Line 288: | Line 290: | ||
then | then | ||
if glossing_type ~= "no abbr" | if glossing_type ~= "no abbr" | ||
then label, wikilink = gloss_lookup(gloss2, label, wikilink) | then label, wikilink, source = gloss_lookup(gloss2, label, wikilink) | ||
end | end | ||
end | end | ||
Line 305: | Line 307: | ||
else abbr_label = wikilink end | else abbr_label = wikilink end | ||
gloss_node:attr("title", abbr_label) | gloss_node:attr("title", abbr_label) | ||
if data.abbreviations[gloss2] then | if source ~= "local" and data.abbreviations[gloss2] then | ||
if data.abbreviations[gloss2].ambiguous then | if data.abbreviations[gloss2].ambiguous then | ||
gloss_node:addClass(conf.class.GlossAbbrAmb) | gloss_node:addClass(conf.class.GlossAbbrAmb) | ||
Line 314: | Line 316: | ||
then gloss_node:wikitext("[[", wikilink, "|" , gloss, "]]") | then gloss_node:wikitext("[[", wikilink, "|" , gloss, "]]") | ||
else gloss_node:wikitext(gloss) end | else gloss_node:wikitext(gloss) end | ||
if displaying_messages then -- logging gloss lookups: | if source ~= "local" and displaying_messages then -- logging gloss lookups: | ||
local message = "" | local message = "" | ||
if label then | if label then | ||
Line 491: | Line 493: | ||
args.italics2 = args.italics2 or "yes" | args.italics2 = args.italics2 or "yes" | ||
args.glossing3 = args.glossing3 or "yes" | args.glossing3 = args.glossing3 or "yes" | ||
if args.lang and not args.lang2 then args.lang2 = args.lang .."-Latn" end | |||
if args.transl and not args.transl2 then args.transl2 = args.transl end | if args.transl and not args.transl2 then args.transl2 = args.transl end | ||
if_auto_translit = true | if_auto_translit = true | ||
Line 521: | Line 524: | ||
end | end | ||
--and this looks looks for a list of abbreviations set within the template: | --and this looks looks for a list of abbreviations set within the template: | ||
local _ablist = args.abbreviations | local _ablist = args.abbreviations | ||
if _ablist and _ablist ~= "" | |||
then set_custom_glosses(_ablist) end | |||
local _ablist = args.ablist | |||
if _ablist and _ablist ~= "" | if _ablist and _ablist ~= "" | ||
then set_custom_glosses(_ablist) end | then set_custom_glosses(_ablist) end | ||
Line 578: | Line 584: | ||
end | end | ||
line[i].attr.lang = line[i].lang | line[i].attr.lang = line[i].lang | ||
--the following emulates the behaviour of {{Bo-textonly}} (see Template talk:Fs interlinear#Tibetan): | |||
if template_name == 'Template:Fs interlinear' then | |||
if _lang == "bo" and i == 1 then | |||
line[1].class = line[1].class .. " uchen" | |||
line[1].attr.style = line[1].attr.style .. "font-size:1.25em; word-wrap:break-word;" | |||
end | |||
end | |||
if yesno(args["italics" .. i]) then | if yesno(args["italics" .. i]) then | ||
Line 815: | Line 828: | ||
end | end | ||
if last_line > 3 and template_name ~= 'Template:Fs interlinear' | if last_line > 3 and template_name ~= 'Template:Fs interlinear' | ||
then temp_track = "" | then temp_track = "[[Category:Pages with interlinear glosses using more than three unnamed parameters]]" | ||
end | end | ||
return tostring(div) .. temp_track .. msg:print_warnings() | return tostring(div) .. temp_track .. msg:print_warnings() |