Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 02-20-2024, 09:02 AM   #31
xxyzz
Evangelist
xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.
 
Posts: 413
Karma: 2666666
Join Date: Nov 2020
Device: none
I'm now trying to figure out how sections are created, I guess each block level HTML tag is a section?

I think the kindle previewer cli must be able to "see" the book HTML since it could ignore hidden tags and find the css rules of a tag. The style rules are tricky to implement, maybe using a headless browser?

Here is the code: https://github.com/xxyzz/kpfgen, it could only add the cover section for now.
xxyzz is offline   Reply With Quote
Old 02-20-2024, 10:39 AM   #32
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,498
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Quote:
Originally Posted by xxyzz View Post
I'm now trying to figure out how sections are created, I guess each block level HTML tag is a section?
Each individual HTML file of the EPUB being converted becomes a section. For reflowable books sections usually correspond to chapters. For fixed-layout books, such as comics, sections are individual pages or page spreads. Sections are called skeletons in KF8 format.

Quote:
Originally Posted by xxyzz View Post
I think the kindle previewer cli must be able to "see" the book HTML since it could ignore hidden tags and find the css rules of a tag. The style rules are tricky to implement, maybe using a headless browser?
The Kindle Previewer parses the HTML and CSS contained in an EPUB to determine what styles are applied to each element and produces the KFX equivalents for those styles with some adjustments.

Quote:
Originally Posted by xxyzz View Post
Here is the code: https://github.com/xxyzz/kpfgen, it could only add the cover section for now.
I will take a look at it when I have some more free time.
jhowell is offline   Reply With Quote
Advert
Old 02-20-2024, 05:08 PM   #33
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,498
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Quote:
Originally Posted by xxyzz View Post
Thanks! Are there any other table, row or field not used in KFX file?
I started looking at your kpfgen repository and realized when I answered this question originally that I forgot about some key/value pairs that are removed during conversion from KPF to KFX. Those keys with local symbols starting with yj.authoring, yj.conversion, yj.print, or yj.semantics are not needed.
jhowell is offline   Reply With Quote
Old 03-01-2024, 09:37 AM   #34
xxyzz
Evangelist
xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.
 
Posts: 413
Karma: 2666666
Join Date: Nov 2020
Device: none
I have figured out how to use selenium to check if an element is displayed and get all the css rules applied to it.

I guess the text of tags in the same "block" are in the same "structure", probably by checking the "display" css rule. But I don't know which html tag creates the "container" type "structure". It seems the table tag creates the "table" type, and most tags are "text" type.

I could get all the css rules of an element but kindle previewer only uses a few rules on an element and it also change the rule type and value, for example, "padding-left: 1em;" is changed to
Code:
margin_left: {
    value: 3.7039999961853027e0,
    unit: percent
  }
I hope the original rule could work so I don't have to guess how they compute this value...
xxyzz is offline   Reply With Quote
Old 03-01-2024, 02:54 PM   #35
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,498
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Quote:
Originally Posted by xxyzz View Post
I guess the text of tags in the same "block" are in the same "structure", probably by checking the "display" css rule. But I don't know which html tag creates the "container" type "structure". It seems the table tag creates the "table" type, and most tags are "text" type.
As far as I know "structure" is only used for organization of the Ion code and has no semantic meaning. KFX renders the same if a structure is replaced by its contents.

Quote:
Originally Posted by xxyzz View Post
I could get all the css rules of an element but kindle previewer only uses a few rules on an element and it also change the rule type and value, for example, "padding-left: 1em;" is changed to
Code:
margin_left: {
    value: 3.7039999961853027e0,
    unit: percent
  }
I hope the original rule could work so I don't have to guess how they compute this value...
This is an example of "Enhanced Typesetting". Amazon applies heuristics to transform formatting for more consistent rendering across books. In this case making the amount of padding dependent on the screen size instead of on the font size. Sometimes it works and other times it messes things up.

I believe using the original style will work but of course it will render differently from what Amazon produces.
jhowell is offline   Reply With Quote
Advert
Old 04-08-2024, 10:32 AM   #36
xxyzz
Evangelist
xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.
 
Posts: 413
Karma: 2666666
Join Date: Nov 2020
Device: none
The code kind of works now. I test this book https://standardebooks.org/ebooks/le...d/john-tenniel and some titles in context table are not clickable and images somehow can't display. And I haven't add any css rules.

Last edited by xxyzz; 04-09-2024 at 05:27 AM.
xxyzz is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Conversion Output] KFX Output jhowell Plugins 1496 Yesterday 06:10 AM
[Conversion Output] KePub Output Plugin jgoguen Plugins 551 07-18-2023 06:22 AM
KFX to KFX to remove DRM Tomifonication Conversion 12 08-09-2018 01:32 PM
KFX Soon? CRussel Calibre 16 03-06-2016 11:56 AM
catalogue builder output columns are not in the same order in the output KWhytte Library Management 5 12-04-2012 02:03 AM


All times are GMT -4. The time now is 01:52 PM.


MobileRead.com is a privately owned, operated and funded community.