Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 09-02-2013, 02:39 PM   #16
automa
Zealot
automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.
 
automa's Avatar
 
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.
automa is offline   Reply With Quote
Old 09-02-2013, 03:37 PM   #17
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: 29,778
Karma: 54830978
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 automa View Post
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.
Just use a consistent entry (template) format

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>
the:
.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
theducks is online now   Reply With Quote
Advert
Old 09-05-2013, 09:00 AM   #18
Matt Butts
Junior Member
Matt Butts began at the beginning.
 
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>.
Matt Butts is offline   Reply With Quote
Old 09-05-2013, 10:09 AM   #19
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
Quote:
Originally Posted by Matt Butts View Post
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>.
That is already possible, so I am not quite sure you want...

If you search for: <span style="font-style:italic;">(.*?)</span> and replace it by <em>\1</em> is would normally work fine.
Toxaris is offline   Reply With Quote
Old 09-05-2013, 11:14 AM   #20
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: 27,545
Karma: 193191846
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>
Your regex wouldn't work correctly there. I believe Dreamweaver's search & replace tool is (at least partly) based on a parsing engine that knows which closing tag goes with what opening tag... and would handle it correctly.

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.
DiapDealer is offline   Reply With Quote
Advert
Old 09-05-2013, 12:30 PM   #21
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,515
Karma: 18512745
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.
Jellby is offline   Reply With Quote
Old 09-05-2013, 12:59 PM   #22
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: 27,545
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Jellby View Post
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.
I use that a good bit myself. It means I have to go back through and maybe manually check the remaining (but decidedly fewer) instances that had tags inside and were skipped the first time through, but you're right... it shouldn't do any damage to already valid code.

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.
DiapDealer is offline   Reply With Quote
Old 09-05-2013, 03:54 PM   #23
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
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...
Toxaris is offline   Reply With Quote
Old 09-05-2013, 04:00 PM   #24
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: 27,545
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Toxaris View Post
I didn't say it was perfect...
That IS true. You did say; "would normally work fine."
(emphasis mine)
DiapDealer is offline   Reply With Quote
Old 09-05-2013, 09:19 PM   #25
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,460
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by DiapDealer View Post
That IS true. You did say; "would normally work fine."
(emphasis mine)
Around here, anything that normally works fine is besting the odds, anyway. It's XHTML and CSS, folks. When we have tweaky little problems like this, it should serve as a reminder of just how MUCH word-processing programs really do for us. For all the bitching and moaning that goes on about how evil MS is, and how bad Word is....you gotta give it its due; much of what it does is damn near magical, once you understand what a bugger the same "simple" thing is to do in HTML. And, if you really dig into it, it has a very sophisticated regex engine, as well, although not really...intuitive for the average user.

Just my $.02.
Hitch
Hitch is offline   Reply With Quote
Old 09-06-2013, 03:09 AM   #26
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
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.
Toxaris is offline   Reply With Quote
Old 09-09-2013, 10:02 AM   #27
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
Quote:
Originally Posted by DiapDealer View Post
I believe Dreamweaver's search & replace tool is (at least partly) based on a parsing engine that knows which closing tag goes with what opening tag... and would handle it correctly.
Diap, many thanks. This small sentence triggered something that helped me with the right ideas to reprogram parts of my add-in. It remembered me about the whole flamewar with regards to using RegEx on (x)HTML/XML instead of a parser.
In short, I am reprogramming a major part to make the convert to HTML process faster and more accurate.
Sir, big thanks.
Toxaris is offline   Reply With Quote
Old 09-09-2013, 03:38 PM   #28
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,460
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by Toxaris View Post
Diap, many thanks. This small sentence triggered something that helped me with the right ideas to reprogram parts of my add-in. It remembered me about the whole flamewar with regards to using RegEx on (x)HTML/XML instead of a parser.
In short, I am reprogramming a major part to make the convert to HTML process faster and more accurate.
Sir, big thanks.
Oh, GOD. I feel a major beta-testing episode coming on....

Hitch
Hitch is offline   Reply With Quote
Old 09-09-2013, 07:10 PM   #29
signum
Zealot
signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.
 
Posts: 119
Karma: 64428
Join Date: Aug 2011
Device: none
Quote:
Originally Posted by automa View Post
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.
Just to get you headed in the right direction, consider this. Assume you have a 2-line chapter number and title and you want both to appear in the Table of Contents.

Quote:
<h2>Chapter 1</h2>
<h3>A Dark and Stormy Night</h3>
If you change things around a little, like this:

Quote:
<h2 title="Chapter 1: A Dark and Stormy Night">Chapter 1</h2>
<h3 class="sigil_not_in_toc">A Dark and Stormy Night</h3>
This will give you a single line, via the "title", in the Table of Contents and two separate lines, individually styled via the stylesheet.css, in the display.
signum is offline   Reply With Quote
Old 09-09-2013, 07:17 PM   #30
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: 27,545
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Toxaris View Post
Diap, many thanks. This small sentence triggered something that helped me with the right ideas to reprogram parts of my add-in. It remembered me about the whole flamewar with regards to using RegEx on (x)HTML/XML instead of a parser.
In short, I am reprogramming a major part to make the convert to HTML process faster and more accurate.
Sir, big thanks.
It's been a long time since I inspired anybody to do anything.

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.
DiapDealer is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
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


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


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