Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 03-29-2026, 03:52 AM   #1
ryder
Enthusiast
ryder began at the beginning.
 
Posts: 44
Karma: 10
Join Date: May 2024
Device: Clara 2E
Calibre conversion is not using my command

Hey everybody,

I am trying to change the css of an epub with Calibre conversion, but it's not working at all.

All I want to do is to change it from this:
</span></span></p><p class="calibre_">

to that:
</span></span></p><p class="calibre_"><br/>

So I just want to add <br/> at the end. It is not working through search and replace and also not in the Look & feel tab.

How is it possible to change it without going to edit the ebook and use the search and replace option there?

Thank you.
ryder is offline   Reply With Quote
Old 03-29-2026, 12:10 PM   #2
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,655
Karma: 64144480
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by ryder View Post
Hey everybody,

I am trying to change the css of an epub with Calibre conversion, but it's not working at all.

All I want to do is to change it from this:
</span></span></p><p class="calibre_">

to that:
</span></span></p><p class="calibre_"><br/>

So I just want to add <br/> at the end. It is not working through search and replace and also not in the Look & feel tab.

How is it possible to change it without going to edit the ebook and use the search and replace option there?

Thank you.
Are you sure the code is
Code:
</span></span></p><p class="calibre_">
and does not include a newline?
Code:
</span></span></p>
<p class="calibre_">
The REGEX would include
Code:
</span></span></p>\s+<p class="calibre_">
But why not use a top margin or have the conversion insert a blank line between paragraphs?
theducks is offline   Reply With Quote
Advert
Old 03-29-2026, 12:31 PM   #3
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: 82,708
Karma: 151278869
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by ryder View Post
Hey everybody,

I am trying to change the css of an epub with Calibre conversion, but it's not working at all.

All I want to do is to change it from this:
</span></span></p><p class="calibre_">

to that:
</span></span></p><p class="calibre_"><br/>

So I just want to add <br/> at the end. It is not working through search and replace and also not in the Look & feel tab.

How is it possible to change it without going to edit the ebook and use the search and replace option there?

Thank you.
What is the code before you do a conversion?
JSWolf is offline   Reply With Quote
Old 03-29-2026, 03:22 PM   #4
ryder
Enthusiast
ryder began at the beginning.
 
Posts: 44
Karma: 10
Join Date: May 2024
Device: Clara 2E
Quote:
Originally Posted by theducks View Post
Are you sure the code is
Code:
</span></span></p><p class="calibre_">
and does not include a newline?
Code:
</span></span></p>
<p class="calibre_">
The REGEX would include
Code:
</span></span></p>\s+<p class="calibre_">
But why not use a top margin or have the conversion insert a blank line between paragraphs?
Thanks for the reply. Yes it is this code:
Code:
</span></span></p><p class="calibre_">
But it is not the whole code. The problem is that it's coming from bad conversions before I knew what I was doing and unfortunately I don't have the original epubs anymore. But I have found a trick to have the first word of a chapter without an indent. And thats why I am trying to add the <br/> to my code after every chapter in the ebook. It's working inside the editing tab, but not in the conversion.

Is there something I can do about it?
ryder is offline   Reply With Quote
Old 03-29-2026, 03:34 PM   #5
ryder
Enthusiast
ryder began at the beginning.
 
Posts: 44
Karma: 10
Join Date: May 2024
Device: Clara 2E
Quote:
Originally Posted by JSWolf View Post
What is the code before you do a conversion?
Thanks for your reply.

A code might look like this:

<body class="calibre">
<h2 id="calibre_toc_9" class="calibre3">Chapter One</h2>
<p class="calibre1">Mike Jorgova watched

or like that:

[...]height:1em"></p><p class="calibre1">

The problem often is that the first word is indented.

If I change from the above code the following part to this:

</h2>
<p class="calibre1"><br/>

or that:

height:1em"></p><p class="calibre1"><br/>

Then the first word after a chapter is not indented, which is what I would like to accomplish. I just need to go inside the editing tab every time. I don't know why it is not working through the search and replace of a conversion.
ryder is offline   Reply With Quote
Advert
Old 03-29-2026, 03:39 PM   #6
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,808
Karma: 9501034
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Yea, I think you are going about this all wrong.

If all you are trying to do is remove the indent, then simply adjust the CSS

Assuming class="calibre1" is used for all first paragraphs in a chapter, then simply add

text-indent: 0;

to the calibre1 css code.
Karellen is offline   Reply With Quote
Old 03-29-2026, 04:30 PM   #7
ryder
Enthusiast
ryder began at the beginning.
 
Posts: 44
Karma: 10
Join Date: May 2024
Device: Clara 2E
Quote:
Originally Posted by Karellen View Post
Yea, I think you are going about this all wrong.

If all you are trying to do is remove the indent, then simply adjust the CSS

Assuming class="calibre1" is used for all first paragraphs in a chapter, then simply add

text-indent: 0;

to the calibre1 css code.
Thank you, this would work if calibre1 would be just for the first paragraphs, but unfortunately it's not. It's used for every paragraph. So if I put the 0 on indent for calibre1 then there is no indent in every line of the ebook. So what I am trying to do is to seperate the first paragraph from a normal paragraph by copying a lil bit more of the code which makes it unique.

I have come across some codes which are often repeated through many ebooks. And they go like this:

height:1em">*</p><p class="calibre_">
or
</span></p><p class="calibre_1">
or
</span></span></p><p class="calibre_1">

Sometimes it is not calibre_1, but calibre3 or calibre_4 etc. So my thinking was to put every possible combination from _ to 9 inside the search and replace rule and let calibre do the conversion.

But calibre won't even work if I just look up the right code, put it inside search and replace. It's just the same after the conversion. So I have to add my code manually to every ebook by editing it. And I am just talking about the bad conversions. I wouldn't do that with good ebooks of course. Just trying to save the old ones without too much of a hassle.
ryder is offline   Reply With Quote
Old 03-29-2026, 04:40 PM   #8
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,808
Karma: 9501034
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
ok, if it were me, I would change the class of that first paragraph to something unique. (actually if it were me, I would recode the entire book)

Search for...
</h2>
<p class="calibre1">


Replace with...
</h2>
<p class="calibre724">


In your CSS, copy the calibre1 code and create a new calibre724 code.

In that new calibre724 css code, add the text-indent: 0 code.
Karellen is offline   Reply With Quote
Old 03-29-2026, 05:06 PM   #9
ryder
Enthusiast
ryder began at the beginning.
 
Posts: 44
Karma: 10
Join Date: May 2024
Device: Clara 2E
Quote:
Originally Posted by Karellen View Post
ok, if it were me, I would change the class of that first paragraph to something unique. (actually if it were me, I would recode the entire book)

Search for...
</h2>
<p class="calibre1">


Replace with...
</h2>
<p class="calibre724">


In your CSS, copy the calibre1 code and create a new calibre724 code.

In that new calibre724 css code, add the text-indent: 0 code.
Yes, I already did that with some ebooks, but it's very tiring. I wanted the short track with the bulk conversion for those bad epubs. I guess there is no short track for that. But besides the bad css, is there a downside to just add a simple "<br/>" at the end of a code?
ryder is offline   Reply With Quote
Old 03-29-2026, 05:17 PM   #10
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: 82,708
Karma: 151278869
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by ryder View Post
Thanks for your reply.

A code might look like this:

<body class="calibre">
<h2 id="calibre_toc_9" class="calibre3">Chapter One</h2>
<p class="calibre1">Mike Jorgova watched

or like that:

[...]height:1em"></p><p class="calibre1">

The problem often is that the first word is indented.

If I change from the above code the following part to this:

</h2>
<p class="calibre1"><br/>

or that:

height:1em"></p><p class="calibre1"><br/>

Then the first word after a chapter is not indented, which is what I would like to accomplish. I just need to go inside the editing tab every time. I don't know why it is not working through the search and replace of a conversion.
There is a much easier solution.

CSS
Code:
h2 + p {
  text-indent: 0;
}
p {
  margin-top: 0;
  margin-bottom: 0;
  widows: 1;
  orphans: 1;
  text-indent: 1.2em;
}

Then do a search/replace.

Search for
Code:
</h2>
<p class="calibre1">
and replace it with
Code:
</h2>
<p>
JSWolf is offline   Reply With Quote
Old 03-29-2026, 05:25 PM   #11
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,808
Karma: 9501034
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Quote:
Originally Posted by ryder View Post
But besides the bad css, is there a downside to just add a simple "<br/>" at the end of a code?
Apart from untidy and poor coding, nothing else comes to mind.
Maybe others with greater knowledge might spot problems if there are any.
Karellen is offline   Reply With Quote
Old 03-29-2026, 05:35 PM   #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,655
Karma: 64144480
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Mostly I and others just detest sloppy coding.
Jon's method is clean.
That should be inserted into the CSS someplace AFTER .calibre1 {...} (or whatever the wrong class for the first Paragraph )

A P following a H2 gets no indent.

Make a snippet and simply pate it in the proper place. Wam ,Bam done
theducks is offline   Reply With Quote
Old 03-30-2026, 04:21 PM   #13
ryder
Enthusiast
ryder began at the beginning.
 
Posts: 44
Karma: 10
Join Date: May 2024
Device: Clara 2E
Quote:
Originally Posted by theducks View Post

Make a snippet and simply pate it in the proper place. Wam ,Bam done
Unfortunately it's not just wam, bam, done. I wish it would be like that.
Take this code for instance. I have copied it right out of an ebook which was not converted by me before:

Code:
</head>

<body class="calibre">
  <div class="s2">
    <p class="calibre2"><span class="none4">The Monster</span></p>
  </div>

  <div class="s4">
    <p class="calibre2">&nbsp;</p>

    <p class="calibre2">&nbsp;</p>
  </div>

  <div class="s">
    <p class="calibre2"><span class="none">
Where is the h2 here? I have to search for the equivalent of an h2 for every ebook. Because it is sometimes and h1 or h3 or nothing at all followed by calibre1 or _3 or 2. You see there are too many combinations possible depending who made the ebook in the first place.

So you have to edit every ebook to get rid of the first word indents. Actually this is something which the device should handle, no matter how the epub was converted. An option just like: no indent for first word after chapter or space line? => Hell yeah...

Last edited by ryder; 03-30-2026 at 04:23 PM.
ryder is offline   Reply With Quote
Old 03-30-2026, 04:36 PM   #14
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,808
Karma: 9501034
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Quote:
Originally Posted by ryder View Post
So you have to edit every ebook to get rid of the first word indents. Actually this is something which the device should handle, no matter how the epub was converted. An option just like: no indent for first word after chapter or space line? => Hell yeah...
I think you are asking for too much. The Calibre code required to cover every possible combination of epub coding is astronomical. I would even go far to say that it can't be done without capturing a lot of false fixes. And of course @kovidgoyal will probably just say "submit a PR".

Calibre is an editor's tool. You are the editor. There are a number of incorporated tools to make your editing journey easier. But it is not a magic "press-a-button-to-fix-all" tool.

You need to spend a bit more time understanding the structure and coding of epubs so you can quickly and easily fix those things you choose to fix.
Karellen is offline   Reply With Quote
Old Yesterday, 03:33 AM   #15
ryder
Enthusiast
ryder began at the beginning.
 
Posts: 44
Karma: 10
Join Date: May 2024
Device: Clara 2E
Quote:
Originally Posted by Karellen View Post
I think you are asking for too much. The Calibre code required to cover every possible combination of epub coding is astronomical. I would even go far to say that it can't be done without capturing a lot of false fixes. And of course @kovidgoyal will probably just say "submit a PR".

Calibre is an editor's tool. You are the editor. There are a number of incorporated tools to make your editing journey easier. But it is not a magic "press-a-button-to-fix-all" tool.

You need to spend a bit more time understanding the structure and coding of epubs so you can quickly and easily fix those things you choose to fix.
You are right. My goal was to find the magic bullet, but there is none. At least I have gained some knowledge about converting epubs through this journey.
ryder is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre conversion is not using my command ryder ePub 1 03-29-2026 01:58 PM
Command line after conversion Tominator Conversion 7 07-18-2019 11:34 PM
Get Conversion Settings Command BetterRed Conversion 0 11-02-2012 11:44 PM
Command Line Conversion loo23 Conversion 3 04-07-2012 03:33 PM
Calibre Command Line Conversion bmwr1200c Calibre 1 08-10-2011 07:04 PM


All times are GMT -4. The time now is 01:45 AM.


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