Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 08-17-2012, 08: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, 08: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: 73,957
Karma: 128903250
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Try turning off Tidy.
JSWolf is offline   Reply With Quote
Advert
Old 08-17-2012, 08: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, 03:05 AM   #4
mmat1
Berti
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: 1,196
Karma: 4985964
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, 03: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
Advert
Old 08-19-2012, 05: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: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
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, 09:15 AM   #7
dwig
Wizard
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: 1,613
Karma: 6718479
Join Date: Dec 2004
Location: Paradise (Key West, FL)
Device: Current:Surface Go & Kindle 3 - Retired: DellV8p, Clie UX50, ...
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, 10:50 AM   #8
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,799
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 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


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto adding books from sub folders tonyhehir Library Management 4 12-27-2013 04:47 PM
auto-adding RFE jacktanner Library Management 0 05-07-2012 12:23 PM
Is auto-relinking a Sigil feature? dlw Sigil 2 06-27-2011 12:43 AM
auto-generated TOC with Sigil 0.4 bobcdy Sigil 2 04-05-2011 12:48 AM
Auto-adding content? and Thanks.... ApK Calibre 4 02-27-2010 09:09 PM


All times are GMT -4. The time now is 09:22 PM.


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