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 08-17-2012, 09:07 PM   #1
drummerboy
Junior Member
drummerboy began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2012
Device: none
Problem: Sigil Auto-adding Attributes to <p>'s

I accidentally added a class to a <p> (e.g. <p class="xyz">) tag instead of inserting <span class="xyz"> after the <p>. I have a pretty large document in which all instances of this were replaced as such.

This seems easy enough to fix with Sigil's find and replace function and it actually does work very well. After replacing all instances of <p class="xyz"> with <span class="xyz">, it even adds a closing </span> right before the </p> for the line which is excellent.

The problem is that, for some reason, Sigil also decides to add <span class="xyz"> to every instance of <p> when I only asked it to replace <p class="xyz">.

It is cool that it closes the tags for me as doing that manually would take forever considering the epub file I am editing has a lot of these instances in them, but is there any way to stop it from adding things onto every <p> when all it needs to do is close the <span class="xyz">?

I guess if that isn't possible, is there a way to prevent Sigil from automatically "correcting" and closing tags? After which, I would just manually add each closing </span>.

Any help on this matter would be great!
drummerboy is offline   Reply With Quote
Old 08-17-2012, 09:09 PM   #2
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 38,504
Karma: 19471833
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2), Sony PRS-650, Sony PRS-T1, nook STR, iPad 1, iPhone 5
Try turning off Tidy.
JSWolf is offline   Reply With Quote
 
Advertisement
Old 08-17-2012, 09:23 PM   #3
drummerboy
Junior Member
drummerboy began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2012
Device: none
I tried turning both that and the Well-formed Errors checker off, just in case, though it is still doing the same thing.

I could probably just extract everything from the .epub and use a text editor to avoid all this since I'd be doing it manually if I have to resort to that anyway. I was definitely digging the auto-closing of the tags, though!
drummerboy is offline   Reply With Quote
Old 08-18-2012, 04:05 AM   #4
mmat1
Det
mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.
 
mmat1's Avatar
 
Posts: 995
Karma: 1529558
Join Date: Jan 2012
Location: Zischebattem
Device: Acer Lumiread
Quote:
Originally Posted by drummerboy View Post
The problem is that, for some reason, Sigil also decides to add <span class="xyz"> to every instance of <p> when I only asked it to replace <p class="xyz">.
I noticed this strange behaviour several times with regex and "auto-correction".

To avoid this "auto-correction" you'll have to make the s/r in "current file"- mode with "well-formed" check off.

And it would'nt hurt to turn off tidy as well
mmat1 is offline   Reply With Quote
Old 08-19-2012, 04:33 AM   #5
Ahmad Samir
Zealot
Ahmad Samir , Klaatu Barada Niktu!Ahmad Samir , Klaatu Barada Niktu!Ahmad Samir , Klaatu Barada Niktu!Ahmad Samir , Klaatu Barada Niktu!Ahmad Samir , Klaatu Barada Niktu!Ahmad Samir , Klaatu Barada Niktu!Ahmad Samir , Klaatu Barada Niktu!Ahmad Samir , Klaatu Barada Niktu!Ahmad Samir , Klaatu Barada Niktu!Ahmad Samir , Klaatu Barada Niktu!Ahmad Samir , Klaatu Barada Niktu!
 
Posts: 114
Karma: 5246
Join Date: Jul 2010
Device: none
I don't think even turning Tidy off will help in this particular case; you can try is adding the closing </span> when you do the search/replace, with search Mode set to Regex:
Find: <p class="xyz">(.+?)</p>
Replace: <p><span class="xyz">\1</span></p>


FWIW, turning the well-formed check off, means that Sigil will still perform the well-formed checking and apply whatever fixes without notifying you. So basically that option turns off the notification but not the check itself.
Ahmad Samir is offline   Reply With Quote
Old 08-19-2012, 06:10 AM   #6
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: 3,182
Karma: 7180223
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-300, PRS-T1
You should never rely on any program auto inserting code when it has to guess what you mean. That is disaster waiting to happen.
Toxaris is offline   Reply With Quote
Old 08-19-2012, 10:15 AM   #7
dwig
Guru
dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.
 
dwig's Avatar
 
Posts: 996
Karma: 1843322
Join Date: Dec 2004
Location: Paradise (Key West, FL)
Device: Current:Dell Venue 8 Pro - Retired:Kindle 3, Clie UX50, T415, ...
Quote:
Originally Posted by drummerboy View Post
...
I guess if that isn't possible, is there a way to prevent Sigil from automatically "correcting" and closing tags? ...
Sigil is NOT CORRECTING your error (open <span> tag) by closing it for you. What it is doing is assuming the <span> was intended to continue past the end of one <p> and continue in the next all the way to the end of the document. To "fix" things so that they work properly, it closes the <span> at the end of the <p> and re-opens it in the next <p> so that it can continue properly.
dwig is offline   Reply With Quote
Old 08-19-2012, 11:50 AM   #8
theducks
Grand Sorcerer
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: 15,250
Karma: 6020307
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by Toxaris View Post
You should never rely on any program auto inserting code when it has to guess what you mean. That is disaster waiting to happen.

Which is not to say the automatic Warning/advice tools are not useful. but to let any tool that has not passed the Turing Test, decide

I would love to have Tag/parenthesis matching markers in CV, especially when faced with multiple nested spans
theducks 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
Auto adding books from sub folders tonyhehir Library Management 4 12-27-2013 05:47 PM
auto-adding RFE jacktanner Library Management 0 05-07-2012 01:23 PM
Is auto-relinking a Sigil feature? dlw Sigil 2 06-27-2011 01:43 AM
auto-generated TOC with Sigil 0.4 bobcdy Sigil 2 04-05-2011 01:48 AM
Auto-adding content? and Thanks.... ApK Calibre 4 02-27-2010 10:09 PM


All times are GMT -4. The time now is 11:33 AM.


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