diff --git a/pdf.c b/pdf.c index e079c54b6..1091ecc6a 100644 --- a/pdf.c +++ b/pdf.c @@ -101,16 +101,17 @@ static int walkTableOfContent(lua_State *L, fz_outline* ol, int *count, int dept lua_pushstring(L, "page"); lua_pushnumber(L, ol->dest.ld.gotor.page + 1); lua_settable(L, -3); + lua_pushstring(L, "depth"); lua_pushnumber(L, depth); lua_settable(L, -3); - lua_pushstring(L, "title"); + lua_pushstring(L, "title"); lua_pushstring(L, ol->title); lua_settable(L, -3); - lua_settable(L, -3); + lua_settable(L, -3); (*count)++; if (ol->down) { walkTableOfContent(L, ol->down, count, depth); diff --git a/unireader.lua b/unireader.lua index 61fd3e26a..c81262b89 100644 --- a/unireader.lua +++ b/unireader.lua @@ -678,15 +678,11 @@ function UniReader:showTOC() end local menu_items = {} local filtered_toc = {} - local curr_page = -1 -- build menu items for _k,_v in ipairs(self.toc) do - if(_v.page >= curr_page) then - table.insert(menu_items, - (" "):rep(_v.depth-1)..self:cleanUpTOCTitle(_v.title)) - table.insert(filtered_toc,_v.page) - curr_page = _v.page - end + table.insert(menu_items, + (" "):rep(_v.depth-1)..self:cleanUpTOCTitle(_v.title)) + table.insert(filtered_toc,_v.page) end toc_menu = SelectMenu:new{ menu_title = "Table of Contents",