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 01-17-2013, 09:43 AM   #181
Ahu Lee
Member
Ahu Lee began at the beginning.
 
Posts: 21
Karma: 10
Join Date: Jan 2013
Device: none
theducks,

it was #1 . What a shame!

Thank you!
Ahu Lee is offline   Reply With Quote
Old 01-25-2013, 11:43 PM   #182
MuskratBooks
Junior Member
MuskratBooks began at the beginning.
 
Posts: 1
Karma: 34
Join Date: Jan 2013
Device: K3
Find & fix quote in split paragraphs

In Sigil this expression has been helpful:
(“[^”\r\n]*)</p>\s+<p class="calibre.">
Replace with (has a trailing space): \1

This indentifies paragraphs where a opening smart quote is not matched with a closing smart quote and joins that paragraph with the next one. Its not fool proof, but saves a lot of time.

I use calibre conversion to switch straight quotes to smart quotes. Its under "Look Feel", check by "smarten punctuation". Easier to fix its mistakes than to find and fix 'em all.

Good Luck!
MuskratBooks is offline   Reply With Quote
Old 01-26-2013, 09:27 AM   #183
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
Quote:
Originally Posted by MuskratBooks View Post
In Sigil this expression has been helpful:
(“[^”\r\n]*)</p>\s+<p class="calibre.">
Replace with (has a trailing space): \1

This indentifies paragraphs where a opening smart quote is not matched with a closing smart quote and joins that paragraph with the next one. Its not fool proof, but saves a lot of time.

I use calibre conversion to switch straight quotes to smart quotes. Its under "Look Feel", check by "smarten punctuation". Easier to fix its mistakes than to find and fix 'em all.

Good Luck!
You have to be careful, quite a lot of books (especially older ones), have quoted multi paragraphs - usually a long speech, where the closing quotes are missing, because it continues in next paragraph, which (usually) starts with a quote.


In calibre, you can use the 'modify e-pub' plugin that can do the smarten punctuation, without a full conversion.
Perkin is offline   Reply With Quote
Old 02-01-2013, 05:52 AM   #184
ditke
Junior Member
ditke began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Feb 2013
Device: none
I've read previous posts but my problem is either not covered in them or I simply missed it.

How can I, in the Replace field in Sigil, refer to part of the search regex given in the Find field? For example, the text
"theAmerican" should be changed to "the American".

The Search field is easy, "[a-z][A-Z]" but "[a-z] [A-Z]" does not work in the Replace field beacause Sigil replaces the regex text as a literal instead of keeping the lower case and the upper case letters, whatever they are.

I have almost no knowledge of regular expressions, please help me in this.
ditke is offline   Reply With Quote
Old 02-01-2013, 06:26 AM   #185
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by ditke View Post
How can I, in the Replace field in Sigil, refer to part of the search regex given in the Find field? For example, the text
"theAmerican" should be changed to "the American".
Use round brackets:

Find: ([a-z])([A-Z])
Replace: \1 \2

For more information search for backreferences.
Doitsu is offline   Reply With Quote
Old 02-01-2013, 08:26 AM   #186
ditke
Junior Member
ditke began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Feb 2013
Device: none
It works perfectly, thank you so much, Doitsu!
ditke is offline   Reply With Quote
Old 02-02-2013, 09:06 AM   #187
Sabardeyn
Guru
Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.
 
Sabardeyn's Avatar
 
Posts: 644
Karma: 1242364
Join Date: May 2009
Location: The Right Coast
Device: PC (Calibre), Nexus 7 2013 (Moon+ Pro), HTC HD2/Leo (Freda)
I'm off topic here, as this is about a *.CBR and otherwise has nothing to do with Sigil, but the recent post reminded me I meant to inquire.

I've got a series of images with a page number added at the end, but the existing page numbering is a disaster. Is there a means of stripping any ending numbers (only), without removing numbers from other locations in the filename?

Ultimately I want my output to look like:
Terminator 2 -- ch14 pg023.jpg
With preceding zeros as placeholders to force proper viewing order.

I've tried: [0-9,3] to find the page numbers, but that removes all of the numbers in the example filename shown above.

If I try appending the $, then I get no matches. I know it has to be something I am doing wrong.

Adding page numbers back in is a straight %03d replacement which I've been doing as a second step after stripping the pages (it's a total renumber, nothing can be saved).

PS: My apologies if this message needs to be moved, but I wasn't sure where else it might be more relevant within the forums.
Sabardeyn is offline   Reply With Quote
Old 02-02-2013, 09:55 AM   #188
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
I take it you're extracting, using a proper re-name util, then re-packing.
Search : (.*pg)\d{1,3}(\.jpg)
(stores all upto (and including) 'pg', discard the next digits, store extension)
Replace \1<whatever inserts counter>\2
so if ? is a number counter char \1???\2
(or depending on regex you'd need $ instead of \ for group replacement.

Last edited by Perkin; 02-02-2013 at 09:57 AM.
Perkin is offline   Reply With Quote
Old 02-02-2013, 04:49 PM   #189
Sabardeyn
Guru
Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.
 
Sabardeyn's Avatar
 
Posts: 644
Karma: 1242364
Join Date: May 2009
Location: The Right Coast
Device: PC (Calibre), Nexus 7 2013 (Moon+ Pro), HTC HD2/Leo (Freda)
Perkin,
Thanks for understanding what I'm doing despite me leaving the extract/fix/repack process unmentioned. I did however leave you with a bad example - that was the output, not the input.

The thing is, I cannot use "pg" as that is something I am adding. Basically the input files are variously named but with numbers at the end.

So a more realistic input page might be:
Terminator 2 23.jpg
that I want to rename into:
Terminator 2 -- ch14 pg023.jpg

There are other naming issues, but I've managed to handle them. Perhaps not optimally, but they get the job done. I just can't seem to isolate the numbers at the end of the filename and strip them. To the best of my knowledge my bulk renamer is using python flavored regex.

I haven't tried you code yet, but I will.
Sabardeyn is offline   Reply With Quote
Old 02-02-2013, 05:55 PM   #190
mzmm
Groupie
mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.
 
mzmm's Avatar
 
Posts: 171
Karma: 86271
Join Date: Feb 2012
Device: iPad, Kindle Touch, Sony PRS-T1
--edit, not sure if this helps, unfamiliar with 'extract/fix/repack process'

i think you'd need to do a couple of passes to turn 1.jpg into 001.jpg, 11.jpg into 011.jpg, etc.

Code:
(.*?\s)(\d)(\.jpg)
\100\2\3

and then
(.*?\s)(\d{2})(\.jpg)
\10\2\3

Last edited by mzmm; 02-02-2013 at 06:01 PM.
mzmm is offline   Reply With Quote
Old 02-03-2013, 08:24 AM   #191
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
@Sabardeyn, can you give a few more (differing?) example filenames - so we can see what's consistent or what isn't, with what you would like them mapped to.

What's the name of your Batch Rename app/script, I can then scan through it's docs and try and see what the correct replace would be.
Perkin is offline   Reply With Quote
Old 02-28-2013, 11:55 AM   #192
ReaderRabbit
Member
ReaderRabbit began at the beginning.
 
ReaderRabbit's Avatar
 
Posts: 24
Karma: 10
Join Date: Mar 2011
Location: Colorado
Device: Cruz Tablet
Talking Joining Paragraphs when opening and closing quotes are not in same paragraph

Quote:
Originally Posted by MuskratBooks View Post
In Sigil this expression has been helpful:
(“[^”\r\n]*)</p>\s+<p class="calibre.">
Replace with (has a trailing space): \1

This indentifies paragraphs where a opening smart quote is not matched with a closing smart quote and joins that paragraph with the next one. Its not fool proof, but saves a lot of time.

I use calibre conversion to switch straight quotes to smart quotes. Its under "Look Feel", check by "smarten punctuation". Easier to fix its mistakes than to find and fix 'em all.

Good Luck!

Thank you Muskrat. This answers my question from 1/13/13 perfectly!

Step 1: I go into Calibre and change straight quotes to curley quotes, then
Step 2: I open the book in Sigil and use your Regex suggestion and it works perfectly.

At first it didn't work then I checked to see if I accidentally copied the blank space after your find expression, and I had. I backed the blank space out and it worked

I ♥ brainiacs!
ReaderRabbit is offline   Reply With Quote
Old 02-28-2013, 01:26 PM   #193
Ripplinger
350 Hoarder
Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.
 
Ripplinger's Avatar
 
Posts: 3,574
Karma: 8281267
Join Date: Dec 2010
Location: Midwest USA
Device: Sony PRS-350, Kobo Glo & Glo HD, PW2
Quote:
Originally Posted by MuskratBooks View Post
In Sigil this expression has been helpful:
(“[^”\r\n]*)</p>\s+<p class="calibre.">
Replace with (has a trailing space): \1

This indentifies paragraphs where a opening smart quote is not matched with a closing smart quote and joins that paragraph with the next one. Its not fool proof, but saves a lot of time.

I use calibre conversion to switch straight quotes to smart quotes. Its under "Look Feel", check by "smarten punctuation". Easier to fix its mistakes than to find and fix 'em all.

Good Luck!
This is fantastic and works great. I swapped the double quotes to single quotes then to find those within the string. It also found a couple of wrong direction quotes for me as well. Edit: And found a few instances of 2 single quotes where a double quote should have been.

Is there a way to find the reverse situation, to find paragraphs where there is an ending quote but was no starting quote at the beginning of the paragraph?

Last edited by Ripplinger; 02-28-2013 at 02:43 PM.
Ripplinger is offline   Reply With Quote
Old 03-04-2013, 04:48 AM   #194
mzmm
Groupie
mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.
 
mzmm's Avatar
 
Posts: 171
Karma: 86271
Join Date: Feb 2012
Device: iPad, Kindle Touch, Sony PRS-T1
Quote:
Originally Posted by Ripplinger View Post
Is there a way to find the reverse situation, to find paragraphs where there is an ending quote but was no starting quote at the beginning of the paragraph?
think that's a bit more difficult. if there's no space between the <p> tags and the text you could use something like this

Code:
<p[^>]*>(?<!")(\w.+?")</p>
which finds a <p> followed by an alphanumeric character that is not preceded by a quotation mark. not the best solution, but for simple and consistent texts it could work.
mzmm is offline   Reply With Quote
Old 03-04-2013, 06:50 AM   #195
Ripplinger
350 Hoarder
Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.
 
Ripplinger's Avatar
 
Posts: 3,574
Karma: 8281267
Join Date: Dec 2010
Location: Midwest USA
Device: Sony PRS-350, Kobo Glo & Glo HD, PW2
I couldn't get that to work at all and was about to give up and then realized you didn't use the curly smart quotes. Once I changed it to smart quotes, it would work somewhat, but it will also pick up any sentence or paragraph that doesn't immediately start with a quote. So it would pick up paragraphs like this:

Pamela shuddered. “We’ve been making ourselves polite to a murderess.”

And there's usually far too many of those types of sentences to want to read through over 500 of them to find the beginning quote buried further in.
Ripplinger 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
Examples of Subgroups emonti8384 Lounge 32 02-26-2011 06:00 PM
Accessories Pen examples Gunnerp245 enTourage Archive 15 02-21-2011 03:23 PM
Stylesheet examples? Skitzman69 Sigil 15 09-24-2010 08:24 PM
Examples kafkaesque1978 iRiver Story 1 07-26-2010 03:49 PM
Looking for examples of typos in eBooks Tonycole General Discussions 1 05-05-2010 04:23 AM


All times are GMT -4. The time now is 11:14 PM.


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