mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
Exporter: selected files (#10453)
Export highlights for selected files. Having a button "Select all files in folder", it is easy to export the whole folder. So, closes #10402. To keep even number of buttons, added a feature "Show selected files list". May be useful to check selections before an operation. Just a sorted list, no titlebar or popup menu, tapping a file jumps to its folder.
This commit is contained in:
@@ -150,11 +150,14 @@ function Exporter:getDocumentClippings()
|
||||
return self.parser:parseCurrentDoc(self.view) or {}
|
||||
end
|
||||
|
||||
--- Parse and export highlights from the currently opened document.
|
||||
function Exporter:exportCurrentNotes()
|
||||
local clippings = self:getDocumentClippings()
|
||||
self:exportClippings(clippings)
|
||||
end
|
||||
|
||||
--- Parse and export highlights from all the documents in History
|
||||
-- and from the Kindle "My Clippings.txt".
|
||||
function Exporter:exportAllNotes()
|
||||
local clippings = {}
|
||||
clippings = updateHistoryClippings(clippings, self.parser:parseHistory())
|
||||
@@ -170,6 +173,19 @@ function Exporter:exportAllNotes()
|
||||
self:exportClippings(clippings)
|
||||
end
|
||||
|
||||
--- Parse and export highlights from selected documents.
|
||||
-- @tparam table files list of files as a table of {[file_path] = true}
|
||||
function Exporter:exportFilesNotes(files)
|
||||
local clippings = self.parser:parseFiles(files)
|
||||
for title, booknotes in pairs(clippings) do
|
||||
-- chapter number is zero
|
||||
if #booknotes == 0 then
|
||||
clippings[title] = nil
|
||||
end
|
||||
end
|
||||
self:exportClippings(clippings)
|
||||
end
|
||||
|
||||
function Exporter:exportClippings(clippings)
|
||||
if type(clippings) ~= "table" then return end
|
||||
local exportables = {}
|
||||
|
||||
Reference in New Issue
Block a user