OPDSbrowser refactoring (#9703)

Refactoring:
-removed duplicated code
-removed passing of username/password through all the modules
-logical order of the methods
-some optimizing and drying
-comments

New features:
-subcatalog link can be saved to the list of servers (eg: direct link to the catalog of books by an author)
-more book information can be fetched and shown (Book information)
-fixed access to the Standard library (by @KGKopli, closes #9372)
reviewable/pr9691/r7
hius07 2 years ago committed by GitHub
parent a8ff3a6571
commit c36a2929ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -43,7 +43,6 @@ function OPDS:addToMainMenu(menu_items)
if not self.ui.view then
menu_items.opds = {
text = _("OPDS catalog"),
sorting_hint = "search",
callback = function() self:showCatalog() end
}
end

File diff suppressed because it is too large Load Diff

@ -72,6 +72,7 @@ function OPDSParser:createFlatXTable(xlex, curr_element)
end
function OPDSParser:parse(text)
text = text:gsub("<%?xml%-stylesheet.-%?>", "")
-- luxl doesn't handle XML comments, so strip them
text = text:gsub("<!%-%-.-%-%->", "")
-- luxl is also particular about the syntax for self-closing, empty & orphaned tags...

@ -327,7 +327,7 @@ describe("OPDS module #nocov", function()
local item_table = OPDSBrowser:genItemTableFromCatalog(catalog, "https://www.gutenberg.org/ebooks.opds/?format=opds")
assert.truthy(item_table)
assert.are.same(item_table[1].text, "Search")
assert.are.same(item_table[1].text, "\u{f002} " .. "Search")
end)
it("should generate URL on rel=subsection", function()
local catalog = OPDSParser:parse(navigation_sample)

Loading…
Cancel
Save