From 8026fb824e8c6505d61f2099642fa4d671198769 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 12 Mar 2013 18:33:19 +0100 Subject: kill all the ipairs() --- mod/tex/context/third/rst/rst_context.lua | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'mod/tex/context/third/rst/rst_context.lua') diff --git a/mod/tex/context/third/rst/rst_context.lua b/mod/tex/context/third/rst/rst_context.lua index a5fb603..f880f35 100644 --- a/mod/tex/context/third/rst/rst_context.lua +++ b/mod/tex/context/third/rst/rst_context.lua @@ -844,7 +844,8 @@ function rst_context.deflist (list) local deflist = [[ \\startRSTdefinitionlist ]] - for nd, item in ipairs(list) do + for nd=1, #list do + local item = list[nd] local term = item[1] local nc = 2 local tmp = [[ @@ -862,7 +863,9 @@ function rst_context.deflist (list) \\RSTdeflistdefinition{% ]] - for np, par in ipairs(item[#item]) do -- definitions, multi-paragraph + local final = item[#item] + for np=1, #final do + local par = final[np] tmp = tmp .. [[ \\RSTdeflistparagraph{% ]] .. inline_parser:match(par) .. "}\n" @@ -1056,9 +1059,9 @@ function rst_context.grid_table (tab) ]] while nr <= tab.head_end do local r = tab.rows[nr] - --for i,r in ipairs(tab.rows) do local isempty = true - for n, cell in ipairs(r) do + for n=1, #r do + local cell = r[n] if cell.variant == "normal" then isempty = false break @@ -1067,7 +1070,8 @@ function rst_context.grid_table (tab) if not isempty then local row = [[\\bTR]] - for n,c in ipairs(r) do + for n=1, #r do + local c = r[n] if not (c.parent or c.variant == "separator") then local celltext = inline_parser:match(c.stripped) @@ -1105,9 +1109,9 @@ function rst_context.grid_table (tab) end while nr <= #tab.rows do local r = tab.rows[nr] - --for i,r in ipairs(tab.rows) do local isempty = true - for n, cell in ipairs(r) do + for n=1, #r do + local cell = r[n] if cell.variant == "normal" then isempty = false break @@ -1116,7 +1120,8 @@ function rst_context.grid_table (tab) if not isempty then local row = [[\\bTR]] - for n,c in ipairs(r) do + for n=1, #r do + local c = r[n] if not (c.parent or c.variant == "separator") then local celltext = inline_parser:match(c.stripped) @@ -1164,7 +1169,8 @@ function rst_context.simple_table(tab) if not row.ignore then dbg_write(">hr>" .. #row) head = head .. [[\\bTR]] - for nc,cell in ipairs(row) do + for nc=1, #row do + local cell = row[nc] dbg_write("%7s | ", cell.content) local celltext = inline_parser:match(cell.content) if cell.span then @@ -1203,7 +1209,8 @@ function rst_context.simple_table(tab) if not row.ignore then dbg_write(">tr>" .. #row) body = body .. [[\\bTR]] - for nc,cell in ipairs(row) do + for nc=1, #row do + local cell = row[nc] dbg_write("%7s | ", cell.content) local celltext = inline_parser:match(cell.content) if cell.span then -- cgit v1.2.3