mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user