01-26-2024, 10:48 AM | #1 |
Member
Posts: 17
Karma: 10
Join Date: Jan 2024
Device: none
|
Modify multiple xhtml files enmasse in one go?
Hello
I have a couple of epubs with over 40-50 xhtml files in them. Unfortunately the *author* didn't create separate css style file(s), but rather incorporated them into each and every xhtml file. I want to modify/update them all, but going through them manually would be quite time consuming process, I just want to replace certain segments at the upper part of files, as they were built identically. Is there a way to speed this process up, not going through them one-by-one? Thank you! |
01-26-2024, 11:29 AM | #2 |
Guru
Posts: 771
Karma: 2297170
Join Date: Jan 2017
Location: Poland
Device: Various
|
I admit that I do not understand the problem.
If styles are written in each head section of the xhtml file between the Code:
<style>...</style> Code:
<link href="../Styles/Style0001.css" type="text/css" rel="stylesheet"/> In addition, if you put your own css file in the Sigil configuration folder with the name user-template2.css (for EPUB2) or user-template3.css (for EPUB3) respectively, and when selecting the "Add Blank Stylesheet" command, you immediately have a ready-made stylesheet file. Perhaps your problem is more complicated, but in that case show an example. Edit: With a few EPUB files I think the whole job would take two minutes. Last edited by BeckyEbook; 01-26-2024 at 11:31 AM. |
Advert | |
|
01-26-2024, 01:56 PM | #3 |
Member
Posts: 17
Karma: 10
Join Date: Jan 2024
Device: none
|
Thank you for the reply.
I did that trick and it works. However that still involves: -opening each xhtml within a given epub -replacing the css tags with that single line As I mentioned, in those epubs (because bad structuring or I don't know) there are 40-50 files to get through. In case of 5 epubs, that's a lot to still click through manually. |
01-26-2024, 02:04 PM | #4 |
Bibliophagist
Posts: 39,817
Karma: 154147706
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
IF the <style>...</style> is identical between the xhtml files in an epub, could you not copy the style from one of the files to a new stylesheet, select all the xhtml files and link them to that stylesheet and then remove the <style>...</style> from all xhtml files in single search/replace?
|
01-26-2024, 02:14 PM | #5 |
Member
Posts: 17
Karma: 10
Join Date: Jan 2024
Device: none
|
That worked, thank you!
|
Advert | |
|
01-26-2024, 02:31 PM | #6 |
Member
Posts: 17
Karma: 10
Join Date: Jan 2024
Device: none
|
Also another question, unrelated to the original issue:
https://i.imgur.com/ZFBEkmL.png https://i.imgur.com/zadBsga.png There are 2 epubs about the same story: - one is "good looking", the other not really - their structuring (how the files are organized/build up) is not identical, different *author* how can I make easy and quick modifications on the second one without too much manual work, going through each paragraph manually/by hand? Is there some kind of way or auto process? Last edited by Pocok; 01-26-2024 at 02:32 PM. Reason: pictures uploading too slowly, switched to direct linking instead |
01-26-2024, 02:54 PM | #7 |
Grand Sorcerer
Posts: 27,968
Karma: 198535232
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Can I just ask why we're consistently giving the word author the asterisk treatment?
|
01-26-2024, 02:58 PM | #8 |
Member
Posts: 17
Karma: 10
Join Date: Jan 2024
Device: none
|
Because they are unknown people (creators), and overall not important to my questions/situation.
Last edited by Pocok; 01-26-2024 at 03:03 PM. |
01-26-2024, 07:31 PM | #9 |
Grand Sorcerer
Posts: 27,968
Karma: 198535232
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I still don't get it, but OK.
|
01-26-2024, 10:17 PM | #10 | |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Quote:
1. By "Sigil configuration folder", I guess you mean the Edit/Preferences folder? In which place precisely should I insert this css file? 2. I do not find "Add Blank Stylesheet" on my Sigil, neither in the "Tools" nor "Insert" menu items. Is it just a new clip? Sigil 2.0.2. Qt 6.6.1. Last edited by roger64; 01-26-2024 at 10:19 PM. |
|
01-26-2024, 11:48 PM | #11 |
Bibliophagist
Posts: 39,817
Karma: 154147706
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Right click on Styles in the Book Browser window, click on Add Blank Stylesheet. See attached image.
|
01-27-2024, 07:24 AM | #12 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Thanks David, I did not think to look here.
Now for the first question... |
01-27-2024, 07:51 AM | #13 |
A Hairy Wizard
Posts: 3,212
Karma: 19000001
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
You are correct, the folder you get from clicking on the button in your edit/preferences section... I think it says "Sigil preferences folder", or something similar, at the bottom of the preferences window. Just put any template files (css, cover, etc.) in that folder. Sigil will see the when it starts up.
|
01-27-2024, 11:22 PM | #14 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Thank you Turtle91.
|
Tags |
epub, manual update, mass update, modify, xhtml |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Some files.html & toc.xhtml (also Cover.xhtml) | chaot | Workshop | 23 | 02-13-2017 12:20 PM |
split docx into multiple xhtml files | xanguera | Conversion | 14 | 08-01-2014 07:09 AM |
Converting multiple text files to xhtml? | Spotnik | Sigil | 19 | 04-12-2011 10:37 PM |
Merge multiple XHTML files at once | gmw | Sigil | 1 | 12-28-2010 02:35 AM |
multiple xhtml's to pdf | monkeyman224 | Amazon Kindle | 3 | 10-16-2010 02:39 AM |