Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 07-21-2017, 01:48 AM   #1
icallaci
Guru
icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.
 
Posts: 817
Karma: 6528026
Join Date: Sep 2012
Device: Kobo Elipsa
Bulk Change CSS in mutiple ePubs

I realize this is a long shot, but thought I'd ask anyway: the Quality Check plugin has identified ~500 epubs in my library where the CSS contains "line-height: 1;" or "line-height: 1em;". I'd like to change all of these to "line-height: 0;" but the thought of editing 500+ files one at a time is daunting. I've searched for a Windows utility that will do a batch search and replace but after downloading and trying six of them without finding one that will do the job, I'm about to give up. Does anyone know of a Windows utility (preferably free) that will search and replace the text inside epub files? I've tried grepWin, FAR, FNR, TextCrawler, and others without luck. Of course, I'd love it if the Quality Check plugin would allow a simple search and replace (since it already does the search part so quickly and reliably), but I also realize that's not likely to happen. So...can't hurt to ask, right? Thanks.
icallaci is offline   Reply With Quote
Old 07-21-2017, 01:53 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,349
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Use

calibre-debug --expode-book file.epub

which will unpack file.epub into a temp dir and then wait for you to type y after making your changes and then recreate the epub from the temp dir.

You can automate it by using something like expect to pass in the y automatically after running the replace tool.
kovidgoyal is offline   Reply With Quote
Advert
Old 07-21-2017, 02:18 AM   #3
icallaci
Guru
icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.
 
Posts: 817
Karma: 6528026
Join Date: Sep 2012
Device: Kobo Elipsa
Quote:
Originally Posted by kovidgoyal View Post
Use

calibre-debug --expode-book file.epub

which will unpack file.epub into a temp dir and then wait for you to type y after making your changes and then recreate the epub from the temp dir.

You can automate it by using something like expect to pass in the y automatically after running the replace tool.
Yes! Thank you! I was so focused on finding a grep-like tool to parse through the files that I couldn't see any other possible solutions. I'll give that a try tomorrow after a good night's sleep. Thanks again.
icallaci is offline   Reply With Quote
Old 07-21-2017, 02:44 AM   #4
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,349
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
And this change https://github.com/kovidgoyal/calibr...b4ef814c4ad0ea

should make it much simpler to automate.
kovidgoyal is offline   Reply With Quote
Old 07-21-2017, 03:05 AM   #5
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 839
Karma: 2657572
Join Date: Jan 2017
Location: Poland
Device: Various
This commit is great gift for me!
--explode-book and --implode-book with specified folders – that's what I was looking for!
Now I will be able to unpack the ebook, pass it through my edits/changes and pack it back.
Thank you!
BeckyEbook is offline   Reply With Quote
Advert
Old 07-21-2017, 10:19 AM   #6
icallaci
Guru
icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.
 
Posts: 817
Karma: 6528026
Join Date: Sep 2012
Device: Kobo Elipsa
Quote:
Originally Posted by kovidgoyal View Post
And this change https://github.com/kovidgoyal/calibr...b4ef814c4ad0ea

should make it much simpler to automate.
Oh, this is PERFECT! I woke up and it was Christmas morning. Thank you so much.
icallaci is offline   Reply With Quote
Old 07-29-2017, 11:34 AM   #7
icallaci
Guru
icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.
 
Posts: 817
Karma: 6528026
Join Date: Sep 2012
Device: Kobo Elipsa
Quote:
Originally Posted by kovidgoyal View Post
And this change https://github.com/kovidgoyal/calibr...b4ef814c4ad0ea

should make it much simpler to automate.
Kovid, just wanted to let you know that this works beautifully. You have saved me so much time and effort. Thanks a million.
icallaci is offline   Reply With Quote
Old 07-30-2017, 11:13 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,349
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You're welcome
kovidgoyal is offline   Reply With Quote
Old 07-30-2017, 06:16 PM   #9
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,206
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by icallaci View Post
I realize this is a long shot, but thought I'd ask anyway: the Quality Check plugin has identified ~500 epubs in my library where the CSS contains "line-height: 1;" or "line-height: 1em;". I'd like to change all of these to "line-height: 0;" but the thought of editing 500+ files one at a time is daunting.
Removing the line-height might work but setting it to 0? That is going to give rather interesting results -- the line-height is multiplied by the font size to generate the line height.

I've attached two screen shots, one from ADE 4.5 on my PC and the other from my KA1. Just a titch unreadable, IMNSHO.
Attached Thumbnails
Click image for larger version

Name:	line-height-0.png
Views:	163
Size:	368.0 KB
ID:	158170   Click image for larger version

Name:	screen_001.png
Views:	154
Size:	340.2 KB
ID:	158171  

Last edited by DNSB; 07-30-2017 at 06:26 PM.
DNSB is offline   Reply With Quote
Old 07-30-2017, 11:14 PM   #10
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,725
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Moderator Notice
Far as I can tell these posts have nothing to do with the Quality Check plugin, so I moved them into a new thread.

BR
BetterRed is online now   Reply With Quote
Old 07-30-2017, 11:26 PM   #11
icallaci
Guru
icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.
 
Posts: 817
Karma: 6528026
Join Date: Sep 2012
Device: Kobo Elipsa
I always remove any line-height properties except for initial capitals and superscripts/subscripts, which I had been setting to 1. I've found that 0 works better for those. If I remove line-height from paragraph styles, I don't run into the problem you show in your images at all. So the only line-height properties remaining in my epubs are for <span> or <sup>/<sub> and 0 works great for those.
icallaci is offline   Reply With Quote
Old 07-31-2017, 09:44 AM   #12
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,056
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
IMHO line-height: 1 is non-standard and not friendly to older eyes (even those that can read at normal font size). 1.2 is standard

I also set the line height in <body> and then only for Exceptions like icallaci has outlined

I do use a big line height (2-3) for chapter numbers with titles to control spacing
Code:
<h3 class="chapno">1 <br /> A Chapter w/Title</h3>
(This single heading way also includes the title in the TOC without having to resort to title="" in the H3 tag )
theducks is offline   Reply With Quote
Old 07-31-2017, 10:06 AM   #13
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,756
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Given that icallaci reads with a Kobo, you don't want line-height in <body>. In fact, you want line-height removed where possible because Kobo has a line-height slider in the Aa settings.
JSWolf is offline   Reply With Quote
Old 07-31-2017, 03:19 PM   #14
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,206
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by icallaci View Post
I always remove any line-height properties except for initial capitals and superscripts/subscripts, which I had been setting to 1. I've found that 0 works better for those. If I remove line-height from paragraph styles, I don't run into the problem you show in your images at all. So the only line-height properties remaining in my epubs are for <span> or <sup>/<sub> and 0 works great for those.
The following is what I use for sub/superscripts without having extra space added between lines. I put line-height: 1.2; in the body class since I find it the easiest on my eyes. For chapter headings and other text where I want the white space, I use various margins. For initial/dropcaps, I have several styles to choose from depending on what appearance I want using various margin values to align the capital with the text.

Code:
sub {
  font-size: 0.675em;
  vertical-align: sub;
  vertical-align: -20%;
}

sup {
  font-size: 0.675em;
  vertical-align: super;
  vertical-align: 35%;
}
DNSB is offline   Reply With Quote
Old 07-31-2017, 06:40 PM   #15
icallaci
Guru
icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.
 
Posts: 817
Karma: 6528026
Join Date: Sep 2012
Device: Kobo Elipsa
Even when I read on Android, removing the line-height seems to default to whatever leading or line-height is built into the font itself, so I've never run into a problem with this. But, yes, I mostly read with a Kobo, which allows me to set the line-height for a font if I don't like the default spacing between lines. Works for me, and Kovid's super-duper --explode-book/--implode-book duo is fantastic!
icallaci is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bulk MDE - Change Cover BetterRed Calibre 2 01-20-2017 01:22 AM
Bulk delete custom metadata inside epubs senhal Library Management 8 02-17-2016 12:01 PM
App, tool or way to Bulk extract export all videos, images & content from Epubs? crashnburn ePub 5 01-11-2016 03:20 PM
Color HTML/CSS in Nook Color ePubs taneal1 Nook Developer's Corner 0 12-06-2015 03:56 AM
bulk change file extension, but not name Fedwin Sigil 33 03-14-2015 05:51 AM


All times are GMT -4. The time now is 07:56 PM.


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