Module:JI ratios: Difference between revisions
Added ratio-parsing function |
No edit summary |
||
| Line 6: | Line 6: | ||
local tip = require("Module:Template input parse") | local tip = require("Module:Template input parse") | ||
p = {} | p = {} | ||
-- INT_LIMIT_MAX is hardcoded to limit the size of output. | -- INT_LIMIT_MAX is hardcoded to limit the size of output. | ||
| Line 134: | Line 131: | ||
return parsed | return parsed | ||
end | |||
-- Footnote generation. Must take in parsed params. There's a hierarchy for | |||
-- search params, as follows: | |||
-- - Go by subgroup. If not, then go by prime limit. If not, then go by int limit. | |||
function p.search_param_footnotes(search_params) | |||
local result = "Not all notable ratios may be shown, and other interpretations are possible." | |||
if search_params["Prime Limit"] ~= nil then | |||
result = string.format("Ratios shown are within the [[%-limit]]. %s", search_params["Prime Limit"], result) | |||
elseif search_params["Int Limit"] ~= nil then | |||
result = string.format("Ratios shown are %s-[[integer-limit|integer limit]]. %s", search_params["Int Limit"], result) | |||
end | |||
return result | |||
end | end | ||