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 02-09-2021, 08:37 AM   #16
413Michele
Enthusiast
413Michele began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Jan 2021
Location: Italy
Device: Kobo Libra 2, Kindle Paperwhite (1st gen)
Quote:
Originally Posted by JSWolf View Post
You do not need #toc_1" because all it does is slow down using the ToC. With the unnecessary ID, the code has to load the chapter and then find the ID before displaying the chapter instead of just loading and displaying the chapter.
Those IDs were autogenerated during the calibre ToC generation, and correct me if I'm wrong, but I think having IDs makes the index more "resilient", right? I think the alternative are file positions, which may cause problems if the file is edited later.

Quote:
Also, it would be easier to find what's in what file if you renamed your files. So if Section0004.xhtml is chapter one, name it chapter01.xhtml.
Sadly the text was all in a single xhtml file, I'd rather it had coherent divisions, but it's not so (I then split it in 2 parts for size reasons but it doesn't matter here).
413Michele is offline   Reply With Quote
Old 02-09-2021, 08:46 AM   #17
413Michele
Enthusiast
413Michele began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Jan 2021
Location: Italy
Device: Kobo Libra 2, Kindle Paperwhite (1st gen)
Quote:
Originally Posted by davidfor View Post
Nothing there looks wrong. And a couple of tests I have done seem to be fine. I think we need to see more code. What is around the heading? Is it at the top of the file or somewhere further down? The fact that calibre added an id means it isn't the first of that heading level in the file.

If the book has copyright, you can use the ScrambleBook plugin to produce a version that can be posted here.
I can attach the full book, as it's not copyrighted (it asks for attribution though, so here is the source

Quote:
If the existing code is '<h2 class="chapterClass">', then changing the tag to a "p" will generally keep the desired formatting. But, if it is just '<h2>', I have to change to '<p class="chapterClass">' and create a class 'chapterClass' that displays the text correctly. With your version, there isn't any change needed or new classes.
Oh yeah, understood I try to be as conservative as possible with books I didn't create
Attached Files
File Type: epub NEW_Candido, o L'ottimismo - Voltaire.epub (383.7 KB, 220 views)
413Michele is offline   Reply With Quote
Advert
Old 02-09-2021, 03:01 PM   #18
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: 40,588
Karma: 157444382
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
I took a quick look at the book and did a bit of editing to add missing classes and do some cleanup. I also split on chapter boundaries which is my personal preference.
Attached Files
File Type: epub Modded_DNSB_Candido, o L'ottimismo - Voltaire.epub (425.5 KB, 218 views)
DNSB is offline   Reply With Quote
Old 02-09-2021, 07:45 PM   #19
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by 413Michele View Post
I can attach the full book, as it's not copyrighted (it asks for attribution though, so here is the source
From a comment you made, I realised the problem was when the destination was not near the top of the book. I was able to test and prove this didn't work in the calibre viewer and the editor preview. I assume this is a bug, but, I honestly don't know what the ebook specs say about this.

Quote:
Oh yeah, understood I try to be as conservative as possible with books I didn't create
I wasn't quite sure whether you were asking a question or making a joke. So, I decided to answer it. And I generally agree with you on this. When I edit a book I try to keep the overall style the same. And make as little impact on the internal code as possible. Occasionally, it is so bad, that I just throw it away and start again. There are some book sources, that I automatically do this. Smashwords tends to be one.

But, splitting the chapters, like @DNSB has done, is something I generally do. For a book like this, I would assume each chapter started on a new page in the original paper version, so splitting it won't harm anything. And produces a book that works better.
davidfor is offline   Reply With Quote
Old 02-11-2021, 04:31 PM   #20
413Michele
Enthusiast
413Michele began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Jan 2021
Location: Italy
Device: Kobo Libra 2, Kindle Paperwhite (1st gen)
Quote:
Originally Posted by davidfor View Post
I wasn't quite sure whether you were asking a question or making a joke. So, I decided to answer it. And I generally agree with you on this. When I edit a book I try to keep the overall style the same. And make as little impact on the internal code as possible. Occasionally, it is so bad, that I just throw it away and start again. There are some book sources, that I automatically do this. Smashwords tends to be one.

But, splitting the chapters, like @DNSB has done, is something I generally do. For a book like this, I would assume each chapter started on a new page in the original paper version, so splitting it won't harm anything. And produces a book that works better.
No I didn't understand in the beginning, so the explanation was necessary. Sorry, communicating with emojis is complicated...

Regarding the book internals I have a similar policy too, with the only difference that if I don't like a file I try to find a better version. Sometimes you can't though and you must work on the bad version. I agree that having a file per chapteris the best thing, no problems with ToC and the book loads faster as the files are tiny.

Quote:
From a comment you made, I realised the problem was when the destination was not near the top of the book. I was able to test and prove this didn't work in the calibre viewer and the editor preview. I assume this is a bug, but, I honestly don't know what the ebook specs say about this.
About this I think I'll open a bug in calibre, after taking a look at the epub specs. I already verified that it happens with EPUB3 and AZW3 too, so there's that.
413Michele is offline   Reply With Quote
Advert
Old 11-21-2023, 08:32 AM   #21
Beathan
Junior Member
Beathan began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Nov 2023
Device: PocketBook HD2
Hello Everyone, I looked through this thread but did not succeed with my problem. Maybe anyone can help me out with this:

How to change chapters I have in my epub, looking as:
<p class="calibre_0">Chapter NN</p>

where NN is a chapter numbering starting from 1 up to, 89 (or 104)

I want to change this chapter line into:
<h2>Chapter NN</h2> preventing NN, of course

Is there a way to make it changed using Find/Replace option?
Beathan is offline   Reply With Quote
Old 11-21-2023, 10:33 AM   #22
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: 30,451
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Use the Diaps Editing Toolbag plugin:
https://www.mobileread.com/forums/sh....php?p=2980740
theducks is offline   Reply With Quote
Old 11-21-2023, 10:41 AM   #23
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: 30,451
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Actually, thinking this over a bit, you really should include a class="justincase" so you can adjust the style the specific H2 (chapter heads) if needed.

A simple REGEX

S: <p class="calibre_0">(Chapter \d+)</p>
R: <h2 class="justincase">\1</h2>
theducks is offline   Reply With Quote
Old 11-21-2023, 10:45 AM   #24
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: 76,474
Karma: 136564766
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 theducks View Post
Actually, thinking this over a bit, you really should include a class="justincase" so you can adjust the style the specific H2 (chapter heads) if needed.

A simple REGEX

S: <p class="calibre_0">(Chapter \d+)</p>
R: <h2 class="justincase">\1</h2>
This is what I would do.

S: <p class="calibre_0">(.*)</p>
R: <h2>\1</h2>

No need for the class. Just style h2 as wanted.
JSWolf is offline   Reply With Quote
Old 11-21-2023, 11:09 AM   #25
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: 30,451
Karma: 58055868
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 JSWolf View Post
This is what I would do.

S: <p class="calibre_0">(.*)</p>
R: <h2>\1</h2>

No need for the class. Just style h2 as wanted.
Poor choices on both counts:

Including Chapter ABSOLUTELY limits the change to those. There could be other uses of "calibre_0"

AND

There could be other uses of h2
theducks is offline   Reply With Quote
Old 11-21-2023, 04:41 PM   #26
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 12,375
Karma: 92073397
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Quote:
Originally Posted by theducks View Post
Poor choices on both counts:

Including Chapter ABSOLUTELY limits the change to those. There could be other uses of "calibre_0"

AND

There could be other uses of h2
Yes, if it's needing fixed, who knows what lurks!
Quoth is offline   Reply With Quote
Old 11-21-2023, 05:46 PM   #27
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: 76,474
Karma: 136564766
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 theducks View Post
Poor choices on both counts:

Including Chapter ABSOLUTELY limits the change to those. There could be other uses of "calibre_0"

AND

There could be other uses of h2
That's true about calibre_0 being used elsewhere.

But not using a class and jut using <h2> is not a poor choice. It's a rather good choice. Any place you can not use a class is good such a <p>.
JSWolf is offline   Reply With Quote
Old 11-21-2023, 06:00 PM   #28
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 12,375
Karma: 92073397
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Quote:
Originally Posted by JSWolf View Post
But not using a class and jut using <h2> is not a poor choice. It's a rather good choice. Any place you can not use a class is good such a <p>.
You like HTML 3?
Quoth is offline   Reply With Quote
Old 11-22-2023, 06:11 AM   #29
Beathan
Junior Member
Beathan began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Nov 2023
Device: PocketBook HD2
Quote:
Originally Posted by theducks View Post
Actually, thinking this over a bit, you really should include a class="justincase" so you can adjust the style the specific H2 (chapter heads) if needed.

A simple REGEX

S: <p class="calibre_0">(Chapter \d+)</p>
R: <h2 class="justincase">\1</h2>
Thank you, this solution made my expetations!

The other problem I face is to remove a soft hyphen from all words.
So I need to replace all accurances of

'any character different than space and any special' soft-hyphen 'any character different than space and any special'

to combining those two strings without the hyphen

In example: con-vert into convert
Beathan is offline   Reply With Quote
Old 11-22-2023, 06:18 AM   #30
Beathan
Junior Member
Beathan began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Nov 2023
Device: PocketBook HD2
For regex I used:

F: [a-zA-Z]-[a-zA-Z]
R:
but can not manage the Replace string
Beathan is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Where do displayed chapter titles come from? JJ Johnson ePub 11 10-17-2020 08:15 PM
Chapter #s or Chapter Titles? bmcox Writers' Corner 33 02-01-2013 08:03 AM
Titles, subtitles & alternative "display" titles jigme ePub 2 08-31-2011 06:19 PM
Ebook chapter titles: with or without chapter number? amoroso Writers' Corner 16 06-14-2011 07:35 AM


All times are GMT -4. The time now is 03:34 AM.


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