Module:Infobox interval: Difference between revisions

Plumtree (talk | contribs)
mNo edit summary
Plumtree (talk | contribs)
mNo edit summary
Line 15: Line 15:
local rational = false
local rational = false
local small = false
local small = false -- numerator and denominator can be represented as Lua numbers, or irrational
local regular = false
local regular = false -- finite and greater than zero
local ratio = nil
local ratio = nil
Line 51: Line 51:
end
end
elseif ratio ~= nil and value_provided(frame.args['Ket']) then
elseif ratio ~= nil and value_provided(frame.args['Ket']) then
cats = cats .. '[[Category:Todo:remove explicit Ket]]'
cats = cats .. '[[Category:Todo:remove explicit ket notation]]'
end
end
Line 64: Line 64:
end
end
elseif ratio ~= nil and value_provided(frame.args['Cents']) then
elseif ratio ~= nil and value_provided(frame.args['Cents']) then
cats = cats .. '[[Category:Todo:remove explicit Cents]]'
cats = cats .. '[[Category:Todo:remove explicit cents]]'
end
end
Line 197: Line 197:
caption = 'Names'
caption = 'Names'
-- removing manual line breaks
-- removing manual line breaks
name = name:gsub('<br/?>', '')
local matches = 0
name, matches = name:gsub('<br/?>', '')
if matches > 0 then
cats = cats .. '[[Category:Todo:remove manual line breaks]]'
end
-- removing whitespaces after commas
-- removing whitespaces after commas
name = name:gsub(',%s+', ',')
name = name:gsub(',%s+', ',')
Line 229: Line 233:
FJS_name = rat.as_FJS(ratio)
FJS_name = rat.as_FJS(ratio)
elseif value_provided(FJS_name) then
elseif value_provided(FJS_name) then
local matches = 0
FJS_name = FJS_name:gsub('%s', '')
FJS_name = FJS_name:gsub('%s', '')
FJS_name = FJS_name:gsub('<br/?>', '')
FJS_name, matches = FJS_name:gsub('<br/?>', '')
FJS_name = FJS_name:gsub('<sup>(.*)</sup>', '^{%1}')
if matches > 0 then
FJS_name = FJS_name:gsub('<sub>(.*)</sub>', '_{%1}')
cats = cats .. '[[Category:Todo:remove manual line breaks]]'
cats = cats .. '[[Category:Todo:remove explicit FJS name]]'
end
FJS_name, matches = FJS_name:gsub('<sup>(.*)</sup>', '^{%1}')
if matches > 0 then
cats = cats .. '[[Category:Todo:replace sup and sub with LaTeX]]'
end
FJS_name, matches = FJS_name:gsub('<sub>(.*)</sub>', '_{%1}')
if matches > 0 then
cats = cats .. '[[Category:Todo:replace sup and sub with LaTeX]]'
end
end
end
if value_provided(FJS_name) then
if value_provided(FJS_name) then
Line 300: Line 313:
end
end


if rational and small then
if rational and small then
table.insert(infobox_data, {
table.insert(infobox_data, {
'<small>[https://www.yacavone.net/xen-calc/?q=' .. ratio_string .. ' open this interval in \'\'xen-calc\'\']</small>'
'<small>[https://www.yacavone.net/xen-calc/?q=' .. ratio_string .. ' open this interval in \'\'xen-calc\'\']</small>'