From a0f4015f7d9e74762bc444ab405dbebba50326ed Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 14 Dec 2020 18:43:23 +0100 Subject: [PATCH] Workaround luxl's issue with self-closing tags once and for all (#6994) * luxl and self-closing tags, once more with feeling... Fix #6993 * More generic fix to the self-closing tag issue w/ luxl Re #6902 & co. --- frontend/ui/opdsparser.lua | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/frontend/ui/opdsparser.lua b/frontend/ui/opdsparser.lua index a1321b3a9..91ba4cfa8 100644 --- a/frontend/ui/opdsparser.lua +++ b/frontend/ui/opdsparser.lua @@ -78,16 +78,11 @@ function OPDSParser:parse(text) text = text:gsub('.-', '') -- luxl doesn't handle XML comments, so strip them text = text:gsub("", "") - -- luxl prefers
, the other two forms are valid in HTML, but will kick luxl's ass + -- luxl is also particular about the syntax for self-closing, empty & orphaned tags... + text = text:gsub("<(%l+)/>", "<%1 />") + -- We also need to handle the slash-less variants for br & hr... text = text:gsub("
", "
") - text = text:gsub("
", "
") - -- Same deal with hr text = text:gsub("
", "
") - text = text:gsub("
", "
") - -- It's also allergic to orphaned (As opposed to a balanced pair)... - text = text:gsub("", "") - -- Let's assume it might also happen to strong... - text = text:gsub("", "") -- Some OPDS catalogs wrap text in a CDATA section, remove it as it causes parsing problems text = text:gsub("", function (s) return s:gsub( "%p", {["&"] = "&", ["<"] = "<", [">"] = ">" } )