@slowsmile: Don't give up! Your plugin has potential.
I know you don't want to improve this plugin anymore, but still, I found a few bugs in it, as well as the one that caused spaces to "disappear".
The options.py file was also missing the default entry
Code:
REMOVE_EMPTY_PARAS = False
I didn't check all the features in the plugin.
I was doing a clean test on the example EPUB file attached.
I have shown my modifications in the attached image.
Note that I called this problem a "last file issue" due to the lack of indentation in the cutils2.py file.
This lack of indentation caused the last commands (including space destruction) to appear only in the last (x)HTML file. I think this was the main reason why you could not reproduce the problem described by @DNSB.
The main culprit was a single line that was saving the file and, in the process, cutting out spaces.
You do what you want with it.
Spoiler:
Code:
From 037f91289da18d3105605c73205a50fc55b463cf Mon Sep 17 00:00:00 2001
From: BeckyDTP <becky@fr.pl>
Date: Mon, 11 Dec 2023 16:59:40 +0100
Subject: [PATCH] Fix
---
cutils.py | 3 ++-
cutils2.py | 14 +++++++-------
dialogs2.py | 6 +++---
3 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/cutils.py b/cutils.py
index 98c4295..0da707c 100644
--- a/cutils.py
+++ b/cutils.py
@@ -1381,7 +1381,8 @@ def svgAttributes2CamelCase(wdir, file):
if not svg.has_attr('xmlns:xlink'):
svg['xmlns:xlink'] = "http://www.w3.org/1999/xlink"
- outfp.writelines(str(soup.prettyprint_xhtml(indent_level=0, eventual_encoding="utf-8", formatter="minimal", indent_chars=" ")))
+ outfp.write(str(soup))
+ #outfp.writelines(str(soup.prettyprint_xhtml(indent_level=0, eventual_encoding="utf-8", formatter="minimal", indent_chars=" ")))
outfp.close()
os.remove(file)
os.rename(output, file)
diff --git a/cutils2.py b/cutils2.py
index 830ce2b..832a686 100644
--- a/cutils2.py
+++ b/cutils2.py
@@ -1215,13 +1215,13 @@ def removeUnusedBookmarks2(wdir, t_fnames, href_ids):
if tag.name == 'a' and tag.attrs == {}:
tag.unwrap()
- outfp.write(str(soup))
- #outfp.write(str(soup.prettyprint_xhtml(indent_level=0, eventual_encoding="utf-8", formatter="minimal", indent_chars=" ")))
- outfp.close()
- os.remove(file)
- os.rename(outfile, file)
- options.TOTAL_REMOVED_BOOKMARKS = bm_removed
- svgAttributes2CamelCase(wdir, file)
+ outfp.write(str(soup))
+ #outfp.write(str(soup.prettyprint_xhtml(indent_level=0, eventual_encoding="utf-8", formatter="minimal", indent_chars=" ")))
+ outfp.close()
+ os.remove(file)
+ os.rename(outfile, file)
+ options.TOTAL_REMOVED_BOOKMARKS = bm_removed
+ svgAttributes2CamelCase(wdir, file)
return(0)
def svgAttributes2CamelCase_New(wdir, file):
diff --git a/dialogs2.py b/dialogs2.py
index 105012e..00c1519 100644
--- a/dialogs2.py
+++ b/dialogs2.py
@@ -423,19 +423,19 @@ class AppDialog2(Tk):
options.REMOVE_IDS = False
gui_prefs['remove_divs'] = self.div.get()
- if self.div == True:
+ if self.div.get() == True:
options.REMOVE_DIV_TAGS = True
else:
options.REMOVE_DIV_TAGS = False
gui_prefs['remove_page_links'] = self.rmpagelinks.get()
- if self.rmpagelinks == True:
+ if self.rmpagelinks.get() == True:
options.REMOVE_PAGE_LINKS = True
else:
options.REMOVE_PAGE_LINKS = False
gui_prefs['remove_empty_spans'] = self.rmempty.get()
- if self.rmLH == True:
+ if self.rmempty.get() == True:
options.REMOVE_EMPTY_SPANS = True
else:
options.REMOVE_EMPTY_SPANS = False
--
2.39.1.windows.1