![]() |
#16 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 110
Karma: 972092
Join Date: Jan 2012
Device: iPhone
|
Also, before automatically putting headings around the chapter titles, how can you make the chapter description in one line with the word "Chapter" so that you can see the description of the chapter in the table of contents, instead of just "Chapter i, chapter ii," etc.
|
![]() |
![]() |
![]() |
#17 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,909
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:
eg Heading 3 followed by a Heading 4 <h3> Chapter n <h4> The chapter title Then a Search and replace to turn the 2 into a single with styling Code:
replace: <h3 class="chapter">Chapter \1 <br class="ctspace" /> <span class="cst">\2<\span><\h3> .chapter CSS sets the basics of the chapter number .ctspace sets the spacing between the 2 lines (if inherited is not acceptable) .cst controls the chapter title Because you used a BR, the toc (NCX) will use both In some cases, you might want a different treatment <h3 title="create your replace template here" > And Leave the original heading text intact |
|
![]() |
![]() |
![]() |
#18 |
Junior Member
![]() Posts: 7
Karma: 10
Join Date: Sep 2013
Device: Kindle Touch
|
A nice add-in to Sigil would be a search and replace like Adobe Dreamweaver uses, where you can look for specific tags with specific attributes and change them, so you could globally change (for example) all instances of <span style="font-style:italic;"> and replace them - and their closing tags - with <em> and </em>.
|
![]() |
![]() |
![]() |
#19 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Quote:
If you search for: <span style="font-style:italic;">(.*?)</span> and replace it by <em>\1</em> is would normally work fine. |
|
![]() |
![]() |
![]() |
#20 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
In a perfect world, Toxaris, your expression would work fine. But oftentimes, spans are nested... which means it could easily replace the wrong closing tag. Consider:
Code:
<span style="font-style: italic;">These words are normal, where <span style="font-size: .75em;">THESE ONES</span> are simulated small-caps.</span> Matt's right. While I probably wouldn't get a lot of use out of such a feature, I can see how many might find a feature like that quite handy. Meaning a feature that would allow you to modify/remove an element having a certain class--a feature based on an engine which was aware of the paired-tag nature of (x)html and could always find the correct closing tag without fail. |
![]() |
![]() |
![]() |
#21 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Instead of . (anything) use [^<>] (anything except < or >), that will miss spans with something inside, but at least it will not catch something wrong, unless the code is wrong to start with.
|
![]() |
![]() |
![]() |
#22 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
It's just that every now and again, it would be nice to be able to 'nuke' a particularly pointless class of span without having to think of all the nested 'gotchas' that may bite you (or cause you to have to design a multi-pass strategy). Just every once in a while, mind you. The rest of the time, I enjoy the mental challenge. ![]() |
|
![]() |
![]() |
![]() |
#23 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
I didn't say it was perfect...
![]() |
![]() |
![]() |
![]() |
#24 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
|
![]() |
![]() |
![]() |
#25 | |
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:
Just my $.02. Hitch |
|
![]() |
![]() |
![]() |
#26 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
You are right. We are so accustomed to those things done automatically for us, we miss it when not there.
I also totally agree with the regex functions of word. Very powerful if you know it. It resembles 'normal' regex, but not quite. |
![]() |
![]() |
![]() |
#27 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Quote:
In short, I am reprogramming a major part to make the convert to HTML process faster and more accurate. Sir, big thanks. |
|
![]() |
![]() |
![]() |
#28 | |
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:
Hitch |
|
![]() |
![]() |
![]() |
#29 | |||
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 119
Karma: 64428
Join Date: Aug 2011
Device: none
|
Quote:
Quote:
Quote:
|
|||
![]() |
![]() |
![]() |
#30 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
![]() To be honest, I don't have the slightest problem using regex inside another scripting (or full-blown programming) language where some logic can be applied to correctly handle the opening and closing of tags (including any potential nesting issues) it's too handy NOT to make use of. And for the quick stuff that I do within Sigil, Regex is my bestest buddy. But there are times when I ask too much of him: unforeseen scenarios with nested spans and divs are usually involved when that happens. Last edited by DiapDealer; 09-09-2013 at 07:19 PM. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |