|
|
#1831 |
|
Enthusiast
![]() Posts: 40
Karma: 10
Join Date: Jul 2023
Device: Kindle ColorSoft
|
Using :has()
Hello, I have an issue trying to use :has() pseudo-class selectors in e-books.
Example: .ChapterS:has(+.SubChapter) { margin-bottom: 1em !important; color: red !important; } The Kindle conversion logs show this: Reading TOC from NCX... Merging user specified metadata... Detecting structure... Inserting metadata into book... Flattening CSS and remapping font sizes... Ignoring CSS rule with invalid selector: '.ChapterS:has(+ blockquote)' (The pseudo-class :has() is unknown) Ignoring CSS rule with invalid selector: '.ChapterS:has(+ .ChapterLocation)' (Expected an argument, got <DELIM '.' at 16>) Ignoring CSS rule with invalid selector: '.ChapterS:has(+ .SubChapter)' (Expected an argument, got <DELIM '.' at 16>) Ignoring CSS rule with invalid selector: '.ChapterS:has(+ blockquote)' (The pseudo-class :has() is unknown) Ignoring CSS rule with invalid selector: '.ChapterS:has(+ .ChapterLocation)' (Expected an argument, got <DELIM '.' at 16>) Ignoring CSS rule with invalid selector: '.ChapterS:has(+ .SubChapter)' (Expected an argument, got <DELIM '.' at 16>) Ignoring CSS rule with invalid selector: '.ChapterS:has(+ blockquote)' (The pseudo-class :has() is unknown) Calibre supports them correctly for the display in the editor (text displays correctly, tested with some color tags) but the conversion doesn't. Is this an issue in Calibre or in KFX Output ? (unclear to me) |
|
|
|
|
|
#1832 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,446
Karma: 96111109
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
Quote:
Even if you avoid calibre's removal of those pseudo-classes by using the CLI of this plugin it still will not work because they are also unsupported by Amazon and will be silently discarded by Amazon's Kindle Previewer during conversion. |
|
|
|
|
|
|
#1833 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,263
Karma: 28183005
Join Date: Apr 2009
Location: USA
Device: iPad Mini, Kindle Colorsoft, Kindle Scribe Colorsoft
|
Presumably these bugs are shared by Send To Kindle? Might be interesting to compare them.
|
|
|
|
|
|
#1834 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,446
Karma: 96111109
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
Most of the bugs seem to have been introduced in attempting to update to x64 MSIX in Windows and ARM in macOS. As far as I can tell the conversion done in Amazon’s servers for send-to-kindle happens under Linux and so it is not affected.
|
|
|
|
|
|
#1835 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,263
Karma: 28183005
Join Date: Apr 2009
Location: USA
Device: iPad Mini, Kindle Colorsoft, Kindle Scribe Colorsoft
|
Quote:
The three epub books that I reported problems with upthread, with entity in alt text are passing muster with STK (as well as Kindle Previewer 4.x). They were not passing when I tried the 3 ePubs weeks ago. Last edited by tomsem; 10-12-2026 at 04:51 PM. |
|
|
|
|
|
|
#1836 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,446
Karma: 96111109
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
They are definitely fixing some of the conversion problems. If they would just fix the handling of SVG images I would strongly recommend upgrading to 4. As it is now it’s a toss up between 3 and 4 for the books I test with.
|
|
|
|
|
|
#1837 |
|
Zealot
![]() ![]() Posts: 105
Karma: 118
Join Date: Aug 2011
Device: Kindle Keyboard; Kindle Fire
|
So I stupidly purchased a new Alexa Tablet as I needed a new Kindle.
I created a Kindle and Books folders in root, placed a test KFX book there and nothing shows in Kindle app. Checked that the local access is set for both folders rebooted the Tablet no change. Formatted and setup fresh still not showing. Thanks Has anyone got any ideas on what else I can try? |
|
|
|
|
|
#1838 | |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 85,574
Karma: 154365185
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
|
|
|
|
|
#1839 |
|
Zealot
![]() ![]() Posts: 105
Karma: 118
Join Date: Aug 2011
Device: Kindle Keyboard; Kindle Fire
|
I assume in the hidden android data .com folder but it's locked down and you can't access it at all.
|
|
|
|
|
|
#1840 |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 85,574
Karma: 154365185
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
|
|
|
|
|
#1841 |
|
Zealot
![]() ![]() Posts: 105
Karma: 118
Join Date: Aug 2011
Device: Kindle Keyboard; Kindle Fire
|
Don't believe there are any yet, I am going to return it. Too many issues you can't send books from my content page to it, and transferring 1000 books took 3 hours and I still have 3500 to go.
Shame as having Play store was nice |
|
|
|
|
|
#1842 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,446
Karma: 96111109
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
Quote:
The folder in which the Kindle for Android app stores books is accessible via MTP as /Android/data/com.amazon.kindle/files. Placing a KFX book file into that folder should cause it to appear in the Kindle app. |
|
|
|
|
|
|
#1843 |
|
Zealot
![]() ![]() Posts: 105
Karma: 118
Join Date: Aug 2011
Device: Kindle Keyboard; Kindle Fire
|
yeah I returned it for now, it's a shame if you can't sideload books without plugging it into a PC it's not ideal for me, though Amazon will think it's great I am sure.
Between the slowness of getting books on and the fact that I couldn't send bought books from the My Content and Devices to it along with the poor home screen design it's just not worth it at the moment. |
|
|
|
|
|
#1844 |
|
Junior Member
![]() Posts: 1
Karma: 10
Join Date: Nov 2026
Device: Onyx Boox Nova 3
|
Minimal KFX Output Linux/Wine KP4 patch
Hello @jhowell, maintainer of https://github.com/yshalsager/calibre-with-kfx here. Thanks for your awesome work on plugins always.
Recently I was trying to get KP4 to work inside linux / wine, but seems KFX Output 2.22.0 doesn't work as is, so I had to make some changes I'm purposing here so you can review when possible. - Find the extracted KP4 CLI through the existing kfx_output_previewer_path tweak, falling back to KP4_PATH. - Recognize KP4 4.0.4 by its CLI executable size (2,987,008 bytes), using the existing get_program_version_from_size() helper. Other sizes remain unknown_<size>, matching historical Linux detection. - Use winepath -w for KP4 input/output arguments, keeping the Unix working directory unchanged. - Use the existing wineprefix() helper for both path conversion and execution. - Set LC_CTYPE=C.UTF-8 for KP4/Wine. Without it, Calibre's cleaned environment corrupts non-ASCII Unix paths. Tested on Linux x86_64 with KP4 4.0.4, Wine 11.21 Staging, Calibre 9.17, and patched KFX Output 2.22.0: - 14 focused tests passed: known/unknown executable sizes and detection without a manifest, path-tweak precedence and operation without `KP4_PATH`, missing configuration, existing error handling, Wine prefixes, path conversion failures, and unchanged KP3 behavior. - Plain English, Arabic/RTL, embedded-font, and IDPF `trees.epub` fixtures converted to KFX and back to EPUB. - A real KFX conversion selected KP4 through `kfx_output_previewer_path` despite an invalid `KP4_PATH`. Code:
--- a/kfxlib/generate_kpf_common.py
+++ b/kfxlib/generate_kpf_common.py
@@ -164,6 +164,17 @@
self.program_version = self.PROGRAM_VERSIONS.get(components)
if self.program_version is None:
self.program_version = "%s_%s" % (UNKNOWN_VERSION_PREFIX, repr(components))
+
+ elif IS_LINUX:
+ PROGRAM_VERSIONS = {2987008: '4.0.4'}
+
+ def locate_program(self):
+ self.program_folder = tweaks.get('kfx_output_previewer_path') or os.getenv('KP4_PATH')
+ if self.program_folder:
+ self.executable_path = os.path.join(self.program_folder, 'KindlePreviewerCLI.exe')
+ if os.path.isfile(self.executable_path):
+ self.is_installed = True
+ self.program_version = self.get_program_version_from_size()
else:
def locate_program(self):
--- a/kfxlib/generate_kpf_using_cli.py
+++ b/kfxlib/generate_kpf_using_cli.py
@@ -2,11 +2,12 @@
import io
import os
import re
+import subprocess
from .generate_kpf_common import (ConversionProcess, ConversionResult, ConversionSequence, KindlePreviewer)
from .message_logging import log
from .utilities import (
- file_read_binary, file_read_utf8, join_search_path, unique_name, windows_user_dir, winepath,
+ file_read_binary, file_read_utf8, join_search_path, unique_name, windows_user_dir, winepath, wineprefix,
IS_LINUX, IS_WINDOWS, PATH_SEPARATOR)
@@ -230,13 +231,22 @@
self.use_wincon = self.application.USE_WINCON
prefix = self.application.ARG_PREFIX
+ self.get_clean_environment()
+ output_path = out_dir
+
+ if IS_LINUX and self.application.is_tool('KPR4'):
+ self.env.update(WINEPREFIX=wineprefix(), LC_CTYPE='C.UTF-8')
+ in_file_name, output_path = [
+ subprocess.check_output(['winepath', '-w', path], env=self.env,
+ universal_newlines=True, timeout=30).rstrip('\r\n')
+ for path in (in_file_name, out_dir)]
self.argv = [
self.application.executable_path,
in_file_name,
prefix + "convert",
prefix + "locale", "en",
- prefix + "output", out_dir,
+ prefix + "output", output_path,
]
if "QC" in self.sequence.flags:
@@ -247,8 +257,6 @@
self.working_dir = out_dir
self.out_file_name = os.path.join(out_dir, "log_KPR_CLI.txt")
-
- self.get_clean_environment()
if IS_LINUX:
for wine_executable in ["wine64", "wine"]:
|
|
|
|
|
|
#1845 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,446
Karma: 96111109
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
Thanks for that! Your changes will be included in the next release of the plugin.
|
|
|
|
![]() |
| Tags |
| kfx, linux, wine |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Conversion Output] KePub Output Plugin | jgoguen | Plugins | 588 | 03-28-2025 03:26 PM |
| Conversion output plugins? | jgoguen | Development | 14 | 08-10-2013 12:19 PM |
| Output file name after conversion | dbellefuil | Calibre | 2 | 06-14-2013 05:40 PM |
| catalogue builder output columns are not in the same order in the output | KWhytte | Library Management | 5 | 12-04-2012 03:03 AM |
| Conversion output folders | TechieLady | Conversion | 6 | 01-19-2012 03:49 AM |