![]() |
#1 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 110
Karma: 972092
Join Date: Jan 2012
Device: iPhone
|
Automation function in Sigil to save a lot of labor?
Is there a setting or certain programming technology by which you could delete all the lines of useless text that are inserted in the book that includes certain words?
What about automating the task of inputting separation lines between the chapters instead of putting them one by one with CTRL SHFT TAB ENTER while scrolling down a long book, which can be a time consuming and tedious process. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Since "chapter" has very little definitive meaning in an epub, how would you propose to automate it in a way that would accomodate everyone? Besides, if you have a specific element (or class of element) you want a chapter-break to precede (or follow), then you can automate the process yourself with "Find & Replace." And save it for later use.
Last edited by DiapDealer; 08-12-2013 at 12:42 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 110
Karma: 972092
Join Date: Jan 2012
Device: iPhone
|
If the Chapter heading section begins with the letter Chapter that would be good enough. Is there a way you can apply heading 1 on all of those paragraphs that begins with the word Chapter? Thank you about the chapter-break idea.
|
![]() |
![]() |
![]() |
#4 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
Please don't use this blindly without having good backups (and I'm sure someone will find a more effective/safe way--that's the beauty of regex ![]() Code:
<p([^>]+)>(.*?)Chapter(.*?)</p> Code:
<h1\1>\2Chapter\3</h1> Even so, any legitimate paragraph with the word "Chapter" in it is going to get caught up as well. If there's a question of case (chapter, Chapter, CHAPTER), simply tell regex to ignore case by preceding the expression with (?i): Code:
(?i)<p([^>]+)>(.*?)Chapter(.*?)</p> Last edited by DiapDealer; 08-12-2013 at 02:51 PM. |
|
![]() |
![]() |
![]() |
#5 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 110
Karma: 972092
Join Date: Jan 2012
Device: iPhone
|
Thank you. And then after that, is there a way to automate the inserting of split marker right before all the heading 1s?
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,641
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
1. In the "Find" field, write "<h1" (if the heading tag is <h1>; if the heading tag would be -for example- <h2> then you should write "<h2" -no quotes-) 2. In the "Replace" field write "<hr class="sigil_split_marker" />\n\n<h1" (no quotes) After that press the button "Replace All". To finish, press the key F6 (or select the menu "Edit" and execute the command "Split at Markers"). Rubén |
|
![]() |
![]() |
![]() |
#7 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
Just add Sigil's split marker code Code:
<hr class="sigil_split_marker" /> ![]() |
|
![]() |
![]() |
![]() |
#8 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Actually, my initial expression will only match paragraphs that DO have some sort of class, id or other attribute assigned. If there are any bare paragraph elements (<p>) to be included in the match, I'd recommend changing the:
Code:
<p([^>]+)> Code:
<p([^>]*?)> Last edited by DiapDealer; 08-12-2013 at 04:02 PM. |
![]() |
![]() |
![]() |
#9 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 110
Karma: 972092
Join Date: Jan 2012
Device: iPhone
|
Thank you! How do I get into Regex S&R mode?
|
![]() |
![]() |
![]() |
#10 |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Apparently.
automa: You should look for "RegexBuddy," which is a fabulous Regex learning program, only $40.00. There's also a fabulous Regex section here in the Pinned stuff, above. There are entire websites and forums dedicated to Regex which I'm sure you'll find incredibly useful. Hitch |
![]() |
![]() |
![]() |
#11 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
There are also various cheatsheets around that will help you.
You are by default in regex mode. You can verify it in the S&R window. |
![]() |
![]() |
![]() |
#12 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
When learning regex you just have to take into account that there are many dialects, and sometimes you need to adapt the recipes from one dialect to another.
|
![]() |
![]() |
![]() |
#13 | |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
I always cringe when I get an email from someone who wants us to "fix their HTML," (or their INDD, etc.), usually for $5-$25 (ha!). I tell them, it's frankly faster and cheaper for us to do it from scratch, at least, most of the time. Trying to troubleshoot someone else's HTML, CSS, etc., takes more time than doing it over. Hitch |
|
![]() |
![]() |
![]() |
#14 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
In the F&R area, there's usually [Normal] displayed
From that dropdown, you can select [Case Sensitive] and/or [Regular Expression] (Doing this from memory since no Sigil on this system) Paul Last edited by phossler; 08-13-2013 at 08:29 AM. |
![]() |
![]() |
![]() |
#15 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,312
Karma: 20171571
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
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sigil 0.5.3: Remarks on search function | DrChiper | Sigil | 8 | 10-12-2012 01:43 PM |
Is it possible to turn off all automation in Sigil? | Iznogood | Sigil | 7 | 06-13-2012 04:05 AM |
Sigil Save As... | Fabe | Sigil | 5 | 01-20-2012 08:55 PM |
0.7.1 Save to Disc function fixed? | grizedale | Calibre | 9 | 06-07-2010 04:49 PM |
Save to Disk Function | Lady Fitzgerald | Calibre | 8 | 06-07-2010 10:06 AM |