From 425d8af73e754e4c39d4a86f724233d762c4de44 Mon Sep 17 00:00:00 2001 From: Aldo Bleeker Date: Mon, 22 Mar 2021 19:24:34 +0100 Subject: [PATCH 1/3] Python 3 fix --- DeDRM_plugin/flatxml2html.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DeDRM_plugin/flatxml2html.py b/DeDRM_plugin/flatxml2html.py index f1ca81d..45e6949 100644 --- a/DeDRM_plugin/flatxml2html.py +++ b/DeDRM_plugin/flatxml2html.py @@ -559,7 +559,7 @@ class DocParser(object): if (link > 0): linktype = self.link_type[link-1] title = self.link_title[link-1] - title = title.rstrip(b'. ') + title = title.rstrip(b'. ').decode('utf-8') alt_title = parares[lstart:] alt_title = alt_title.strip() # now strip off the actual printed page number From 91e4645315782e916577813f321122aee1b9af28 Mon Sep 17 00:00:00 2001 From: Aldo Bleeker Date: Mon, 5 Apr 2021 12:16:02 +0200 Subject: [PATCH 2/3] Another Python 3 fix --- DeDRM_plugin/k4mobidedrm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DeDRM_plugin/k4mobidedrm.py b/DeDRM_plugin/k4mobidedrm.py index 43392ee..cede191 100644 --- a/DeDRM_plugin/k4mobidedrm.py +++ b/DeDRM_plugin/k4mobidedrm.py @@ -191,7 +191,7 @@ def unescape(text): else: # named entity try: - text = chr(htmlentitydefs.name2codepoint[text[1:-1]]) + text = chr(html.entities.name2codepoint[text[1:-1]]) except KeyError: pass return text # leave as is From 4229b8ff85e1180ec991d4e6b1ea0807094f85a3 Mon Sep 17 00:00:00 2001 From: Aldo Bleeker Date: Mon, 5 Apr 2021 17:06:24 +0200 Subject: [PATCH 3/3] Another Python 3 fix --- DeDRM_plugin/flatxml2html.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DeDRM_plugin/flatxml2html.py b/DeDRM_plugin/flatxml2html.py index 45e6949..2fe80c3 100644 --- a/DeDRM_plugin/flatxml2html.py +++ b/DeDRM_plugin/flatxml2html.py @@ -770,10 +770,10 @@ class DocParser(object): first_para_continued = False (pclass, pdesc) = self.getParaDescription(start,end, regtype) if not pclass: - if orig_regtype.endswith(b'.right') : pclass = 'cl-right' - elif orig_regtype.endswith(b'.center') : pclass = 'cl-center' - elif orig_regtype.endswith(b'.left') : pclass = 'cl-left' - elif orig_regtype.endswith(b'.justify') : pclass = 'cl-justify' + if orig_regtype.endswith(b'.right') : pclass = b'cl-right' + elif orig_regtype.endswith(b'.center') : pclass = b'cl-center' + elif orig_regtype.endswith(b'.left') : pclass = b'cl-left' + elif orig_regtype.endswith(b'.justify') : pclass = b'cl-justify' if pclass and (ptype == 'full') and (len(pclass) >= 6): tag = 'p' if pclass[3:6] == b'h1-' : tag = 'h4'