Module:Infobox interval: Difference between revisions
mNo edit summary |
m Better input handling |
||
| Line 13: | Line 13: | ||
function p.infobox_interval(frame) | function p.infobox_interval(frame) | ||
local debug_mode = frame.args['debug'] | local debug_mode = frame.args['debug'] | ||
local page_name = frame:preprocess('{{PAGENAME}}') | |||
local rational = false | local rational = false | ||
| Line 48: | Line 50: | ||
cents = rat.cents(ratio) | cents = rat.cents(ratio) | ||
ket = rat.as_ket(ratio, frame) | ket = rat.as_ket(ratio, frame) | ||
ratio_string = frame.args['Ratio'] or '' | -- display Ratio unless it is page name, in which case it is probably a fallback | ||
if frame.args['Ratio'] ~= page_name then | |||
ratio_string = frame.args['Ratio'] or '' | |||
end | |||
end | end | ||
elseif ratio ~= nil and value_provided(frame.args['Ket']) then | elseif ratio ~= nil and value_provided(frame.args['Ket']) then | ||
| Line 64: | Line 69: | ||
ket = frame.args['Ket'] | ket = frame.args['Ket'] | ||
end | end | ||
ratio_string = frame.args['Ratio'] or '' | -- Ratio is LaTeX unless it is page name, in which case it is probably a fallback | ||
if frame.args['Ratio'] ~= page_name then | |||
ratio_string = frame.args['Ratio'] or '' | |||
end | |||
end | end | ||
elseif ratio ~= nil and value_provided(frame.args['Cents']) then | elseif ratio ~= nil and value_provided(frame.args['Cents']) then | ||