Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 09-03-2024, 02:04 AM   #1
Tenome
Enthusiast
Tenome began at the beginning.
 
Posts: 49
Karma: 26
Join Date: Jan 2022
Device: none
Standalone or bulk "Restructure to Sigl Norm"?

I have a bunch of epubs from all over the place that I want to standardize. Is Sigil's "restructure" script able to be run by itself? I assume it's in the Github, but I dunno where. Alternatively, suggesting another way to restructure many books would be appreciated. Thanks.
Tenome is offline   Reply With Quote
Old 09-03-2024, 07:24 AM   #2
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,044
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
The restructure code is not a "script". It's not something that could be simply copied out of Sigil's codebase and used elsewhere. It's C++ code that's intertwined with the rest of Sigil's C++ code.

Sigil's simply not geared toward the editing of bulk epubs. Calibre should be able to do this sort of thing.
DiapDealer is offline   Reply With Quote
Old 09-03-2024, 06:49 PM   #3
Tenome
Enthusiast
Tenome began at the beginning.
 
Posts: 49
Karma: 26
Join Date: Jan 2022
Device: none
Dang. Guess I'll see if Calibre can do it, though I don't like how there doesn't seem to be a way to turn off its renaming of CSS classes.
Tenome is offline   Reply With Quote
Old 09-03-2024, 08:17 PM   #4
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,044
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Tenome View Post
Dang. Guess I'll see if Calibre can do it, though I don't like how there doesn't seem to be a way to turn off its renaming of CSS classes.
I'm pretty sure you can restructure using calibre without actually converting (which would trigger all kinds of other changes). But it's been a while since I've used Calibre. I think it (the restructure feature) was a part of Calibre's editor.
DiapDealer is offline   Reply With Quote
Old 09-06-2024, 03:35 AM   #5
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 677
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Quote:
Originally Posted by Tenome View Post
Dang. Guess I'll see if Calibre can do it, though I don't like how there doesn't seem to be a way to turn off its renaming of CSS classes.
In Calibre's directory there is a program "ebook-convert.exe" that you can use on a command line.

It converts between formats, but doing epub to epub cleans up a lot of things, and doesn't rename classes, though it may create some new ones (e.g. if there are spans with styling).

Just do: "ebook-convert oldbook.epub newbook.epub" and see how it goes.
See https://manual.calibre-ebook.com/gen...k-convert.html for options, though default makes it manageable and I continue in Sigil.
Note that it may resize and compress images if they're "large", you can just reimport the originals or try using the option " --output-profile tablet" which will (usually) make it leave images as-is.
AlanHK is offline   Reply With Quote
Old 09-06-2024, 11:16 AM   #6
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,044
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
But I don't think calibre will restructure an epub using an epub to epub conversion. The OP is talking about homogenizing the physical archive structure (everything in OEBPS, Text, CSS, Images, Fonts, Misc folders) of a lot of epubs. I could be wrong, but I don't think a simple conversion will do that.
DiapDealer is offline   Reply With Quote
Old 09-06-2024, 08:13 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,006
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by DiapDealer View Post
I'm pretty sure you can restructure using calibre without actually converting (which would trigger all kinds of other changes). But it's been a while since I've used Calibre. I think it (the restructure feature) was a part of Calibre's editor.


The calibre ebook-editor has an Arrange into folders in its Tools menu, but I don't think it's available from the command line.

It might be possible to use the Action Chain and Editor Chain plugins to restructure multiple books in a calibre library.

BR
BetterRed is offline   Reply With Quote
Old 09-08-2024, 11:16 AM   #8
Tenome
Enthusiast
Tenome began at the beginning.
 
Posts: 49
Karma: 26
Join Date: Jan 2022
Device: none
Thanks for the replies, I'll see if Calibre can manage it somehow. The reason I'm trying to homogenize the epubs is so I can mass-replace the CSS file inside with my own. Calibre sort of has that option when converting, but it renames the classes and throws out everything that isn't used, which I'm trying to avoid. So I'll try ebook-convert.exe. The Arrange into Folders option from the editor seems to be exactly what I'm looking for, can't believe it's not a command line feature!

Last edited by Tenome; 09-08-2024 at 11:27 AM.
Tenome is offline   Reply With Quote
Old 09-08-2024, 11:46 AM   #9
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,452
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 Tenome View Post
Thanks for the replies, I'll see if Calibre can manage it somehow. The reason I'm trying to homogenize the epubs is so I can mass-replace the CSS file inside with my own. Calibre sort of has that option when converting, but it renames the classes and throws out everything that isn't used, which I'm trying to avoid. So I'll try ebook-convert.exe. The Arrange into Folders option from the editor seems to be exactly what I'm looking for, can't believe it's not a command line feature!
MASS REPLACE Does not compute.

eg. class="calibre23" is not a standard across books.
in 1 book it may be used for Headings. Another for Spans. Another for Blockquotes.

The ONLY case you can count on is a Bare Tag (P, Div, H3, ...) (or when the selector is now NOT defined)

I keep (CSS) Clippings of MY STANDARDS. I use those to fix whatever selector Goto Link or style (On the context menu) jumps to. Even then, you will need REGEX foo, to trace out the dogs breath some books have (like a individual stylesheet per chapter file ).
theducks is offline   Reply With Quote
Old 09-08-2024, 08:36 PM   #10
Tenome
Enthusiast
Tenome began at the beginning.
 
Posts: 49
Karma: 26
Join Date: Jan 2022
Device: none
Well, yeah, that's why I don't want Calibre classes, as I mentioned. :P
Tenome is offline   Reply With Quote
Old 09-08-2024, 09:45 PM   #11
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,452
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 Tenome View Post
Well, yeah, that's why I don't want Calibre classes, as I mentioned. :P
Then don't use Calibre to convert.
The classes are assigned as needed... TOP to Bottom (of the book)
Do I have a class with the needed attributes?
Yes: use that here.
No: assign a new (next #) one.
Next block
Repeat until end
Nothing else will change that.
That is not what standard structure does. What it does is put the pieces into folders by usage TYPE.
CSS into Styles
images (of any ext) into Images
Text into Text

(there are others, less common)
And there are certain one that MUST be in the top layer.

If you want your books to look the same, Just delete the Styles folder (not really recommended and there is NO recovery).
That simply allows your devices block level defaults to prevail. There are no defaults for SPANS, so if italics were done that way... they will just be normal

FWIW I touchup every book to my standards (basic font size and margins). For a cleanly done book, I spend 30-60 seconds (I have saved clips. I just use the GoTo Link. to jump to the stylesheet, where I replace-insert the relevant bit of code).
I use the same steps for the messy code (I move inline style= code to the CSS) Some take a few mor minutes, a real hodgepodge can take an hour.
There is NO MAGIC SOLUTION.
theducks is offline   Reply With Quote
Old 09-09-2024, 12:41 AM   #12
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,767
Karma: 75003038
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
Additionally calibre only messes with class names on CONVERSIONS. Other operations such as the editor and its various functions don't mess with class names

Sent from my Pixel 7a using Tapatalk
PeterT is offline   Reply With Quote
Old 09-09-2024, 01:52 AM   #13
Tenome
Enthusiast
Tenome began at the beginning.
 
Posts: 49
Karma: 26
Join Date: Jan 2022
Device: none
To anyone wondering, the Calibre plugins Action Chains and Editor Chains do exactly what I was wanting to do. Thanks all for the help.
Tenome is offline   Reply With Quote
Old 09-09-2024, 11:07 AM   #14
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,044
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Tenome View Post
To anyone wondering, the Calibre plugins Action Chains and Editor Chains do exactly what I was wanting to do. Thanks all for the help.
I figured there was a way to pull it off. Glad you got it working.
DiapDealer is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a way to get "Eject this Device" as a standalone toolbar item? Dal Bhat Calibre 4 06-05-2024 09:08 PM
Setting "Title" from "Title Sort" in bulk. alyshadeshae Library Management 2 09-16-2022 10:43 AM
How to bulk "Polish/embed" covers in pdf files The Holy Library Management 15 08-16-2021 12:08 PM
Browser problem "book-manifest"/can't read ePub // standalone content server on Linux Henning Server 1 10-21-2018 11:35 AM
How "Prove Yourself" is the new publishing norm Steven Lake Writers' Corner 8 07-25-2011 05:52 PM


All times are GMT -4. The time now is 08:06 PM.


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