Module:Numlinks 2-num: Difference between revisions
try to add edge case detection |
mNo edit summary |
||
| Line 65: | Line 65: | ||
-- Create a grid of links | -- Create a grid of links | ||
local num_rows = 1 + num_links_2 + math.max(num_links_2, curr_num_2 - num_links_2) | local num_rows = 1 + num_links_2 + math.max(num_links_2, math.min(curr_num_2 - num_links_2, num_links_2)) | ||
local num_cols = 1 + num_links_1 + math.max(num_links_1, curr_num_1 - num_links_1) | local num_cols = 1 + num_links_1 + math.max(num_links_1, math.min(curr_num_1 - num_links_1, num_links_1)) | ||
local row_offset = 1 + num_links_2 -- How far from upper edge to current-page's row | local row_offset = 1 + num_links_2 -- How far from upper edge to current-page's row | ||
local col_offset = 1 + num_links_1 -- How far from left edge to current-page's column | local col_offset = 1 + num_links_1 -- How far from left edge to current-page's column | ||