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 12-05-2024, 05:14 PM   #1
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,896
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
Split on Every Incidence of the Word Chapter

When I convert a book, I can go to Structure detection (see image) and insert the following expression in the "Detect chapters at (XPath expression" and insert this expression

//*[re:test(., "Chapter", "i")]

then go to Chapter mark: and choose pagebreak and the conversion will split the HTML at every instant of the word chapter. Making the creation of a TOC easy.

My question is when I'm in the book editor and I choose to split at multiple locations (see image). Which expression can I insert here to have the same result? Currently, after merging the files, if I see the need I will save the book and back out then convert the book to accomplish my desired results. I would much prefer to be able to insert an expression here and do the same thing.

Edit: when I cut and paste the expression above into the edit book split area I get an error. Here are the 2 most common errors.

ERROR: Unhandled exception: <b>AbortError</b>:Cannot split on the &lt;body&gt; tag

ERROR: Unhandled exception: <b>AbortError</b>:The expression //*[re:test(., "Chapter", "i")] did not match any nodes
Attached Thumbnails
Click image for larger version

Name:	configure device.jpg
Views:	174
Size:	195.9 KB
ID:	212367   Click image for larger version

Name:	Specify locations to split at.jpg
Views:	159
Size:	29.5 KB
ID:	212368  

Last edited by DoctorOhh; 12-05-2024 at 09:47 PM.
DoctorOhh is online now   Reply With Quote
Old 12-05-2024, 06:24 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,023
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Did you try the wizard (part of split at multiple locations)?

Usually I just split as is (the way I got the book) and then go back
and check those filenames that do not have the extras from a split., those I merge or delete if empty of content
theducks is offline   Reply With Quote
Advert
Old 12-05-2024, 07:01 PM   #3
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,708
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by DoctorOhh View Post
When I convert a book, I can go to Structure detection (see image) and insert the following expression in the "Detect chapters at (XPath expression" and insert this expression

//*[re:test(., "Chapter", "i")]

then go to Chapter mark: and choose pagebreak and the conversion will split the HTML at every instant of the word chapter. Making the creation of a TOC easy.

My question is when I'm in the book editor and I choose to split at multiple locations (see image). Which expression can I insert here to have the same result? Currently, after merging the files, if I see the need I will save the book and back out then convert the book to accomplish my desired results. I would much prefer to be able to insert an expression here and do the same thing.
Same one I use in Convert (cut and paste) just worked for me. But it didn't persist, maybe it will if you create the expression with the Wizard.

BR
BetterRed is online now   Reply With Quote
Old 12-05-2024, 08:52 PM   #4
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,896
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
Quote:
Originally Posted by theducks View Post
Did you try the wizard (part of split at multiple locations)?
I can use the wizard for underlying html code: p, h1, h2, b, etc... but haven't figured how to use the wizard to split on actual text content.

Quote:
Originally Posted by theducks View Post
Usually I just split as is (the way I got the book) and then go back and check those filenames that do not have the extras from a split., those I merge or delete if empty of content
Six of one half a dozen of the other. I've done it both ways, but I usually merge the content files first then split.
DoctorOhh is online now   Reply With Quote
Old 12-05-2024, 09:44 PM   #5
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,896
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
Quote:
Originally Posted by BetterRed View Post
Same one I use in Convert (cut and paste) just worked for me. But it didn't persist, maybe it will if you create the expression with the Wizard.
I haven't been able to use the wizard to split on actual book content. Split on html such as h1, h2, p, b, i, etc... easy, but not on words in the content.
DoctorOhh is online now   Reply With Quote
Advert
Old 12-05-2024, 09:44 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,318
Karma: 27111242
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
They are both xpath expressions you should be able to use the same in both places.
kovidgoyal is online now   Reply With Quote
Old 12-05-2024, 09:45 PM   #7
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,708
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by DoctorOhh View Post
I can use the wizard for underlying html code: p, h1, h2, b, etc... but haven't figured how to use the wizard to split on actual text content.
I can't recall having any consistent token to which I would apply a rule. I do rare one offs with the splitter in Preview. And, given I mainly read on a Surface Go and I don't often share books, I don't know why I bother with splitting.

BR
BetterRed is online now   Reply With Quote
Old 12-05-2024, 10:43 PM   #8
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,023
Karma: 60358908
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 DoctorOhh View Post
I haven't been able to use the wizard to split on actual book content. Split on html such as h1, h2, p, b, i, etc... easy, but not on words in the content.
Split multiple MUST split between block levels or you have invalid fragmented HTML
theducks is offline   Reply With Quote
Old 12-05-2024, 10:58 PM   #9
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,896
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
Quote:
Originally Posted by kovidgoyal View Post
They are both xpath expressions you should be able to use the same in both places.
That would make sense, but I have never had it run successfully in the edit books split location, yet it always works during the conversion process.
here is an example error.

Spoiler:
calibre, version 7.22.0
ERROR: Unhandled exception: <b>AbortError</b>:Cannot split on the &lt;body&gt; tag

calibre 7.22 embedded-python: True
Windows-10-10.0.26100-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.26100')
Python 3.11.5
Windows: ('10', '10.0.26100', 'SP0', 'Multiprocessor Free')
Interface language: None
EXE path: C:\Program Files\Calibre2\calibre-parallel.exe
Successfully initialized third party plugins: DeACSM (0, 0, 16) && Gather KFX-ZIP (from KFX Input) (2, 18, 0) && DeDRM (10, 0, 9) && Package KFX (from KFX Input) (2, 18, 0) && Audit Log (1, 0, 19) && Barnes & Noble (1, 5, 6) && Count Pages (1, 13, 6) && Diaps Editing Toolbag (0, 5, 0) && EpubCheck (0, 2, 5) && EpubMerge (3, 2, 0) && EpubSplit (3, 9, 0) && Extract ISBN (1, 6, 5) && FanFicFare (4, 40, 0) && Fantastic Fiction (1, 7, 1) && Fantastic Fiction Adults (1, 3, 1) && Favourites Menu (1, 3, 1) && Find Duplicates (1, 10, 9) && Generate Cover (2, 3, 4) && GetFileName (0, 2, 0) && Goodreads (1, 8, 2) && Goodreads Sync (1, 16, 11) && Job Spy (1, 0, 239) && KFX metadata reader (from KFX Input) (2, 18, 0) && From KFX (2, 18, 0) && KFX Input (2, 18, 0) && Set KFX metadata (from KFX Output) (2, 13, 0) && KFX Output (2, 13, 0) && Kindle Collections (1, 7, 29) && Kindle hi-res covers (0, 5, 1) && KindleUnpack - The Plugin (0, 83, 1) && Kobo Books (1, 9, 2) && Manage Series (1, 5, 2) && Modify ePub (1, 8, 5) && Open With (1, 8, 3) && Overdrive Link (2, 57, 0) && Quality Check (1, 13, 16) && Quick Preferences (1, 7, 1) && Reading List (1, 15, 4) && Resize Cover (1, 2, 1) && Save Virtual Libraries To Column GUI (2, 3, 0) && ScrambleEbook (0, 6, 0) && Search The Internet (1, 11, 3) && SmartEject (2, 5, 0) && View Manager (1, 10, 3) && Virtual Library Switcher (1, 0, 1) && Walk Search History (1, 5, 4)
Traceback (most recent call last):
File "calibre\gui2\tweak_book\boss.py", line 1455, in multisplit
File "calibre\ebooks\oeb\polish\split.py", line 282, in multisplit
calibre.ebooks.oeb.polish.split.AbortError: Cannot split on the <body> tag

Last edited by DoctorOhh; 12-05-2024 at 11:02 PM.
DoctorOhh is online now   Reply With Quote
Old 12-05-2024, 11:09 PM   #10
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,896
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
Quote:
Originally Posted by theducks View Post
Split multiple MUST split between block levels or you have invalid fragmented HTML
That what it seems, but doesn't have that requirement during a conversion. However, Kovid indicates above that the expression should work in both places.
DoctorOhh is online now   Reply With Quote
Old 12-05-2024, 11:12 PM   #11
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,896
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
Quote:
Originally Posted by BetterRed View Post
I don't know why I bother with splitting.
I split only when creating TOCs based on files. Cleaning things up and splitting each chapter into its own file feels better when I'm reading.
DoctorOhh is online now   Reply With Quote
Old 12-06-2024, 12:01 AM   #12
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,318
Karma: 27111242
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Ah that's because splitting is a different algorithm. In the conversion what happens is the immediate tag is marked and the splitting happens on marked tags later on. Splitting directly is more complex. Instead use the transform html tool to makr the tags with a class or other attribute and then you use splitting wizard in the next step.
kovidgoyal is online now   Reply With Quote
Old 12-06-2024, 12:49 AM   #13
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,896
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
Quote:
Originally Posted by kovidgoyal View Post
Instead use the transform html tool to makr the tags with a class or other attribute and then you use splitting wizard in the next step.
Thanks for the insight.

I had decided simply saving the epub after I merge the files I desire to split, then switching to conversion is easier for me, than marking as you suggested. I'll give it a second look, maybe, once learned, marking will be best.

Thanks again.
DoctorOhh is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word -> EPUB Chapter titles blank for Headings using Word's {TC...} codes GranitStateColin Conversion 2 12-21-2021 09:29 PM
How to reformat an epub so I can split it at each chapter? MarjaE Editor 6 05-18-2020 11:50 AM
What is the Xpath for "Split html at the word 'chapter" lealla Editor 5 06-26-2015 03:32 AM
Aura HD Last paragraph in chapter gets split Nick Payne Kobo Reader 9 02-16-2014 02:49 AM
Find, replace, split chapter? laelaps Sigil 8 01-20-2011 04:01 PM


All times are GMT -4. The time now is 05:21 AM.


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