Module:Favilink Utility: Difference between revisions

attempt to improve link text ('cybernetics credit wedge 2¢' instead of 'cybernetics credit wedge')
mNo edit summary
(attempt to improve link text ('cybernetics credit wedge 2¢' instead of 'cybernetics credit wedge'))
Line 75: Line 75:
     name = frame.args[1]
     name = frame.args[1]
end
end
local result = p.main(name, 'ObjectID', '_pageName=Page')
local result = p.main(name, 'ObjectID', '_pageName=Page,PlainName')
if result == nil then
if result == nil then
     return name .. '(no results)]][[Category:Pages with ID to Page errors'
     return name .. '(no results)]][[Category:Pages with ID to Page errors'
Line 81: Line 81:
     return name .. '(no results)]][[Category:Pages with ID to Page errors'
     return name .. '(no results)]][[Category:Pages with ID to Page errors'
else  
else  
    return result[1]['Page']
link = result[1]['Page']
link = link:sub(1, -3)  -- trim ending ]]
-- use plainname for stuff like cybernetics credit wedge 2¢
link = link .. '|' .. result[1]['PlainName'] .. ']]'
    return link
end
end
end
end


return p
return p