Module:alternative forms: Difference between revisions

No edit summary
Undo revision 501826 by Sware (talk)
 
Line 21: Line 21:
}
}


    local m_param_utils = require(parameter_utilities_module)
local m_param_utils = require(parameter_utilities_module)


local param_mods = m_param_utils.construct_param_mods {
local param_mods = m_param_utils.construct_param_mods {
Line 42: Line 42:
stop_when = function(data)
stop_when = function(data)
local stop = not data.any_param_at_index
local stop = not data.any_param_at_index
-- If we haven't found any items yet (stored_itemno == 1), do NOT stop on a hole.
-- Just skip it and keep looking for the first term.
if stop and data.stored_itemno > 1 then
return true
end
if stop and parent_args[data.orig_index + 1] == nil then
if stop and parent_args[data.orig_index + 1] == nil then
track("actual hole in params")
track("actual hole in params")
end
end
return false
return stop
end,
end,
default_separator = default_separator,
default_separator = default_separator,
Line 99: Line 92:
-- If the to-be-linked term is the same as the pagename, display it unlinked.
-- If the to-be-linked term is the same as the pagename, display it unlinked.
for _, item in ipairs(items) do
for _, item in ipairs(items) do
if not item.term and (lang:makeEntryName(item.term)) == pagename then
if not item.term and lang:stripDiacritics(item.term) == pagename then
track("term is pagename")
track("term is pagename")
item.alt = item.alt or item.term
item.alt = item.alt or item.term
Line 129: Line 122:
if labels then
if labels then
if lang:hasTranslit() then
if lang:hasTranslit() then
ins(" " .. require(labels_module).format_processed_labels {
ins(" — " .. require(labels_module).format_processed_labels {
labels = labels, lang = lang
labels = labels, lang = lang
})
})
Line 147: Line 140:
function export.create(frame)
function export.create(frame)
local parent_args = frame:getParent().args
local parent_args = frame:getParent().args
local title = mw.title.getCurrentTitle()
return export.display_alternative_forms(parent_args, mw.loadData("Module:headword/data").pagename)
local PAGENAME = title.text
return export.display_alternative_forms(parent_args, title)
end
end
 
return export
return export