Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 06-14-2019, 09:50 AM   #1
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,624
Karma: 3120635
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
style filtering?

Using the latest Calibre editor (3.44).

Usually (for the last two or three years I would say), when producing an ePub, I automatically join a second stylesheet, voluntarily oversized. Then, I edit the book by picking up and adding some additional styles or rules named on this second stylesheet. Last I remove the unused styles or rules, blend the two stylesheets and reorder the remaining one.

I was unable to work this way because the Calibre editor removed automatically all the unused styles or rules before I started modifying anything. It is very frustrating.

Is it an intended behaviour?

Last edited by roger64; 06-14-2019 at 10:07 AM.
roger64 is offline   Reply With Quote
Old 06-14-2019, 10:40 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The calibre editor does not make *any* automated changes to a book whatsoever. Arre you sure you are not confusing it with Sigil? The only way it will remove unused styles is if you use the remove unused styles tool.
kovidgoyal is offline   Reply With Quote
Advert
Old 06-14-2019, 10:45 AM   #3
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,624
Karma: 3120635
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Quote:
Originally Posted by kovidgoyal View Post
The calibre editor does not make *any* automated changes to a book whatsoever. Arre you sure you are not confusing it with Sigil? The only way it will remove unused styles is if you use the remove unused styles tool.
I just realized that, when completing this second stylesheet, I introduced a mistake. An accolade was missing and an odd letter was forgotten. That provoked some unwanted consequences. Everything is now fine as usual.

Sorry for this. Thanks for your reply and support.

Last edited by roger64; 06-14-2019 at 10:49 AM.
roger64 is offline   Reply With Quote
Old 06-14-2019, 03:35 PM   #4
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 46,168
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by kovidgoyal View Post
The calibre editor does not make *any* automated changes to a book whatsoever. Arre you sure you are not confusing it with Sigil? The only way it will remove unused styles is if you use the remove unused styles tool.
Ummm... Sigil also needs the user to trigger removing unused styles. I've never had calibre or Sigil remove a style from a stylesheet without my triggering a unused style check.
DNSB is offline   Reply With Quote
Old 06-14-2019, 06:19 PM   #5
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,718
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by DNSB View Post
Ummm... Sigil also needs the user to trigger removing unused styles. I've never had calibre or Sigil remove a style from a stylesheet without my triggering a unused style check.
Nor I

BR
BetterRed is offline   Reply With Quote
Advert
Old 06-14-2019, 10:22 PM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I wasn't claiming it removes styles automatically, but, at least the last time I used it, it did make lots of changes automatically, simply by opening a book. This was actually one of the primary things I set out not to do when writing the calibre editor.
kovidgoyal is offline   Reply With Quote
Old 06-14-2019, 11:27 PM   #7
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 46,168
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by kovidgoyal View Post
I wasn't claiming it removes styles automatically, but, at least the last time I used it, it did make lots of changes automatically, simply by opening a book. This was actually one of the primary things I set out not to do when writing the calibre editor.
You mean the re-arrangement of the directory structure? That requires saving the file not just opening it. Open and close leaves the structure unchanged.

Given that I've seen a fair number of epubs which did not follow the specification (OCF 2.01)which says there must be a mimetype file in the root and a META.INF directory containing the container.xml file (OCF 3.2 adds 5 other XML files that can be stored in META.INF) while leaving other file locations up to the creator of the epub container file other than not storing them in META.INF, I am ambivalent about disabling Sigil's default directory structure given that it does logical separation of text, styles, images etc. which makes my life easier when editing. I would prefer if it was an option rather than being forced when saving but I would likely turn that option on.

Now if Sigil and calibre's editor made epubcheck mandatory rather than a plugin... Time to step back from that soapbox.
DNSB is offline   Reply With Quote
Old 06-15-2019, 03:38 AM   #8
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
changing directory structure involves much more than just moving files around, you have to re-write the contents of all those files as well to update links/references. Anyway, I am not critcizing Sigil, I was just wondering if the OP had confused the two since not automatically making changes to the book is one of the calibre editors core goals.
kovidgoyal is offline   Reply With Quote
Old 06-15-2019, 06:42 AM   #9
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,624
Karma: 3120635
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
From the OP

Mistakes are mine.

Calibre behaviour (do not modify anything if not expressly asked for by the user) is right.
roger64 is offline   Reply With Quote
Old 06-17-2019, 10:04 AM   #10
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,760
Karma: 5706256
Join Date: Nov 2009
Device: many
FWIW, I agree that not changing the original structure is generally a good thing. After Sigil releases it QtWebEngine branch and PageEdit next week, my next project will be to add an option to *not* restructure the ePub when editing no matter how inane or broken the original structure
KevinH is offline   Reply With Quote
Old 06-17-2019, 11:18 PM   #11
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Congrats on moving to web engine I shall watch closely to see how many bugs it causes and hopefully learn from them in calibre (calibre's editor port to web engine is already done, but the viewer and various other doodads are not yet done).
kovidgoyal is offline   Reply With Quote
Old 06-18-2019, 10:59 AM   #12
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,760
Karma: 5706256
Join Date: Nov 2009
Device: many
I am sure you are aware of most of the following but I was not ...

The asynchronous nature of QtWebEngine is way way too understated in the official docs. For example loading (as before), getting plain text or html (as documented), running javascripts (documented) are asynchronous but so are rendering (comes after loading with no signal to say rendering is complete!), grabbing focus (especially in headless mode but no signal to say you have focus), text selection (but at least there is a signal) and etc are all asynchronous and can cause issues depending on your design.

In fact, I have run into many issues due to the lack of signals when trying to run in headless mode just to use a webview to extract text from an element or an entire page due to lack of signals (see QTBUG-75505).

Then there is the need to override the acceptNavigationRequest in QWebEnginePage to handle links pressed but the underlying model has already generated the loadStarted() signal (BEFORE acceptNavigationRequest has returned!) and if you decide to handle a specific link type and return (false for it) the engine later generates a loadFinished(false) even though no load was ever done. (See QTBUG-75185)

The false loadStarted() and loadFinished(false) can interfere with loading and running javascripts as well. I had to add state variables to determine if and when it was perfectly safe to inject/run javascript tracking all load started and loadFinished.

Then there is api documented mouse, and key event handling routines that simply do NOT work (they are never invoked) as many of the user based events are handled by a delegate. So you have to add an event listener at the start and then look for new delegate being added to the QWebPageEngine and then installing listeners on them as they are handled. I still have not figured out why these delegates die and go away (seemingly at random at times).

With the lack of signals for getting focus, rendering, etc, you really have to just hope that the user waits for the window to actually render before trying stuff. In fact, the whole design (when no required signals are provided) actually is very racey and I am not a fan of it.

I think they should have designed a minimal set of signals to track at least the major states of the system including loading, focusing, and rendering to say the very least.

We are not sure how robust the Preview Window is under QWebEngine and simple editing used in our PageEdit (extracted all of BookView as it was a PITA) into a simpler QtWebEngine separate app. Hoping to release the beta in a week or two just to finally see what has to be worked on to get something stable.

All in all a good time was had by all

Last edited by KevinH; 06-18-2019 at 11:07 AM.
KevinH is offline   Reply With Quote
Old 06-18-2019, 11:05 AM   #13
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,760
Karma: 5706256
Join Date: Nov 2009
Device: many
For the record, I studied both the qupzilla, and otter QWebEngine browser implementations to actually see a working model that handled real world stuff. Luckily both exist on github and have some good example working code (and some required workarounds).
KevinH is offline   Reply With Quote
Old 06-18-2019, 11:10 AM   #14
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Yeah in my attempts I quickly decided Qt's API was mostly rubbish and did everything I possibly could in javascript. All the application logic runs in javascript. I rely on Qt for as little as possible.
kovidgoyal is offline   Reply With Quote
Old 06-18-2019, 11:11 AM   #15
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by KevinH View Post
For the record, I studied both the qupzilla, and otter QWebEngine browser implementations to actually see a working model that handled real world stuff. Luckily both exist on github and have some good example working code (and some required workarounds).
I actually wrote my own browser as way to learn the warts of web engine https://github.com/kovidgoyal/vise

so porting calibre stuff to it was relatively painless, in comparison.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Style Sheet entry for a 'hanging' style AThirstyMind Kindle Formats 6 12-10-2016 12:28 AM
Search not filtering? VelvetElvis Library Management 5 05-30-2014 05:12 AM
Possible calibre filtering? Glenndk Calibre 0 07-31-2010 01:34 PM
Mobi TOC style vs ePub style? phearlez Kindle Formats 3 04-11-2010 06:35 AM
0.6.4 and filtering by tags itimpi Calibre 3 08-01-2009 01:43 PM


All times are GMT -4. The time now is 05:48 PM.


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