Edit Page
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 83: | Line 83: | ||
end |
end |
||
− | function |
+ | function partialTable(frame, firstRow, lastRow) |
⚫ | |||
⚫ | |||
local wikitable = frame.args[1] |
local wikitable = frame.args[1] |
||
local rowP = rowPositions(wikitable) |
local rowP = rowPositions(wikitable) |
||
local length = rows(wikitable) |
local length = rows(wikitable) |
||
⚫ | |||
⚫ | |||
local header = string.sub(wikitable, 1, rowP[1] - 1) |
local header = string.sub(wikitable, 1, rowP[1] - 1) |
||
local body = fetchRows(wikitable, firstRow, lastRow) |
local body = fetchRows(wikitable, firstRow, lastRow) |
||
return header .. body .. "}" |
return header .. body .. "}" |
||
+ | end |
||
+ | |||
+ | function p.tableRange(frame) |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
end |
end |
||
Line 99: | Line 103: | ||
-- Like tableRange, but searches for two strings to determine the range. |
-- Like tableRange, but searches for two strings to determine the range. |
||
-- {{#invoke:table|tableRangeByString|(table)|1970|1980}} produces a table starting from the first row that contains 1970 to the first row that contains 1980. |
-- {{#invoke:table|tableRangeByString|(table)|1970|1980}} produces a table starting from the first row that contains 1970 to the first row that contains 1980. |
||
− | local wikitable = frame.args[1] |
||
− | local rowP = rowPositions(wikitable) |
||
− | local length = rows(wikitable) |
||
local firstRow = findFirstRow(wikitable, frame.args[2]) or 1 |
local firstRow = findFirstRow(wikitable, frame.args[2]) or 1 |
||
local lastRow = findFirstRow(wikitable, frame.args[3]) - 1 or length - 1 |
local lastRow = findFirstRow(wikitable, frame.args[3]) - 1 or length - 1 |
||
+ | return partialTable(frame, firstRow, lastRow) |
||
− | local header = string.sub(wikitable, 1, rowP[1] - 1) |
||
⚫ | |||
− | return header .. body .. "}" |
||
end |
end |
||