Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 07-13-2014, 09:21 AM   #16
mikapanja
Perfectionist
mikapanja can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermikapanja can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermikapanja can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermikapanja can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermikapanja can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermikapanja can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermikapanja can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermikapanja can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermikapanja can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermikapanja can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermikapanja can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
Posts: 62
Karma: 12802
Join Date: Apr 2014
Device: none
Quote:
Originally Posted by BetterRed View Post
Two passes on closing quotes are only required if punctuation is sometimes inside e.g ‘This is the end of the sentence.’ and other times outside e.g. ‘This is the end of the sentence’.; having both in the same text would be an exception, probably an error.
Not necessarily. Let me use your examples.

- ‘This is the end of the sentence.’ - most cases, covered by pass one

- He played Billy Holiday’s ‘I Cover the Waterfront’ all night.... - various names (books, songs, movies) and expressions in the middle of the sentence are not covered by pass one, but by pass two (no punctuation before the closing quote, and a space after the closing quote). Other punctuation marks in pass two are probably overkill, but will do no harm. If one is averse to using them, the pass two could be shortened to:

Search: ’([ ])
Replace: ”\1
mikapanja is offline   Reply With Quote
Old 07-15-2014, 09:41 PM   #17
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: 74,037
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by kovidgoyal View Post
Smarten punctuation does preserve straight quotes on measurements. https://bugs.launchpad.net/calibre/+bug/1285351

To be precise it replaces them with the correct typographic prime
Is there any way Smarten punctuation can be programmed to do a single quote to double quote conversion for when we have UK type eBooks that have the single quote? I prefer double quotes as that is what I am used to.
JSWolf is offline   Reply With Quote
Advert
Old 07-15-2014, 09:42 PM   #18
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: 74,037
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by mikapanja View Post
@ JSWolf

I believe this should cover it, but it will replace all the quotes, both in dialogues and outside them, except those that are part of a contraction. Of course, the book must have proper punctuation to begin with.

1) Replace opening single curly quotes with opening double curly quotes
Search:
Replace:

2) Replace closing single curly quotes with closing double curly quotes (two passes)

Search: ([.|…|,|:|;|?|!|\-|–|—])’
Replace: \1”

Search: ’([ |.|…|,|:|;|?|!|\-|–|—])
Replace: ”\1

Some of the combinations are unlikely to be found, but I guess better an overkill than missed instances
Thanks. I'll have to give it a go and see how well it works.
JSWolf is offline   Reply With Quote
Old 07-17-2014, 12:43 PM   #19
arspr
Dead account. Bye
arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.
 
Posts: 587
Karma: 668244
Join Date: Mar 2011
Device: none
Be really careful when detecting straight single quotes BEFORE words as in English there are at least two very different uses:
'em >>> Contractions, so you should substitute by a RIGHT/CLOSING curly quote.
'Start of dialogue' >>> so you should substitute by a LEFT/OPENING curly quote.
arspr is offline   Reply With Quote
Old 07-17-2014, 08:56 PM   #20
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by arspr View Post
Be really careful when detecting straight single quotes BEFORE words as in English there are at least two very different uses:
'em >>> Contractions, so you should substitute by a RIGHT/CLOSING curly quote.
I use these Regex in Sigil after running any sort of "Smarten Punctuation":

Note: That is a LEFT single quote in the Search.

Search: ‘([Tt]was\b)
Replace: ’\1

Search: ‘([Tt]is\b)
Replace: ’\1

Search: ‘([Ee]m\b)
Replace: ’\1

This works on your common words: 'twas, 'tis, 'em. (I am not too sure how many others there are, but those three are the only ones I run across in the books I work on).

I also do a Regex for this one and replace on a case-by-case basis for this one:

Search: ‘([0-9])
Replace: ’\1

Which is typically used when shortening decades: ’90s, ’00s, ’60s, ...

Last edited by Tex2002ans; 07-17-2014 at 08:58 PM.
Tex2002ans is offline   Reply With Quote
Advert
Old 07-17-2014, 11:57 PM   #21
GrannyGrump
Obsessively Dedicated...
GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.
 
GrannyGrump's Avatar
 
Posts: 3,200
Karma: 34977896
Join Date: May 2011
Location: JAPAN (US expatriate)
Device: Sony PRS-T2, ADE on PC
Another frequent failure for "Smarten" routines happens when they hit a quoted phrase followed by an em-dash. Often the quote marks preceding the em-dash get reversed.
So instead of seeing
John said: “I told you,“’twas brillig’”—a hush fell.

you see

... “‘twas brillig‘“—a hush fell.

Ah, "smartened" curly quotes do make life interesting.
GrannyGrump is offline   Reply With Quote
Old 07-18-2014, 01:45 AM   #22
arspr
Dead account. Bye
arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.
 
Posts: 587
Karma: 668244
Join Date: Mar 2011
Device: none
Quote:
Originally Posted by Tex2002ans View Post
(I am not too sure how many others there are, but those three are the only ones I run across in the books I work on).
Not very representative but in "The Sot-Weed Factor" there are lots of them:
'twixt, 'tween, 'sheart, 'twill, 'twere, 'twould, 'swounds, ...

And of course 'n' as in Guns 'n' Roses.
arspr is offline   Reply With Quote
Old 07-18-2014, 02:08 AM   #23
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by arspr View Post
Not very representative but in "The Sot-Weed Factor" there are lots of them:
'twixt, 'tween, 'sheart, 'twill, 'twere, 'twould, 'swounds, ...

And of course 'n' as in Guns 'n' Roses.
My saved search is:

Code:
 ‘(em|cause|Cause|cos|til|bout|er|um|tis)
That gets most of 'em. The spelling check finds most of the others.
davidfor is offline   Reply With Quote
Old 07-18-2014, 02:29 AM   #24
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by arspr View Post
And of course 'n' as in Guns 'n' Roses.
Rock ’n’ Roll as well.

Quote:
Originally Posted by davidfor View Post
My saved search is:

Code:
 ‘(em|cause|Cause|cos|til|bout|er|um|tis)
That gets most of 'em. The spelling check finds most of the others.
This is actually much more efficient than what I use, I will be commandeering this for my own usage.

And speaking of the decades rule I mentioned.... The book I am converting just this second uses the WORD FORM of it:

’eighties
’nineties

Never ran across that before. Coincidence? I think not!
Tex2002ans is offline   Reply With Quote
Old 07-26-2014, 05:49 AM   #25
ShellShock
Wizard
ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.
 
ShellShock's Avatar
 
Posts: 1,176
Karma: 2431850
Join Date: Sep 2008
Device: IPad Mini 2 Retina
I want to widen the original question if I may: "Is there a way to limit the scope of a search/replace to the actual text that is displayed to the reader?" E.g., we can currently set the scope to "Current file", "All text files" etc. I was thinking of an additional option to set the scope, e.g., "All inner text". I believe this is what smarty pants does (could be wrong).

This option would enable us to roll our own smarty pants using the Saved searches, without worrying about false positive matches on the xml tags. I currently have a regex to match punctuation that is also matching <> in the xml elements. I guess I could try to exclude these from the regex, but it would be safer if the match scope was limited to inner text.
ShellShock is offline   Reply With Quote
Old 07-28-2014, 07:55 AM   #26
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)
Add 'cuz to the list for a slang/jargon version of 'cause, et al.

Although this might lead to confusion with cuz (cousin), as in "this is my cuz". Or would it be spelled cous? Anyway, something to consider.
Sabardeyn is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reducing file size for straight-text epub? Christi H ePub 5 01-10-2013 10:09 PM
Looking for a tool to find/fix mis-matched quotes... therealjoeblow Calibre 4 09-04-2011 01:25 AM
convert straight quotes to curly quotes alansplace Calibre 3 09-25-2010 03:51 PM
What's with all the straight quotes (inch marks)? DGReader ePub 35 03-03-2010 02:48 PM
Pielrf - Text to LRF with Easy TOC, Headers, Curly-Quotes, etc. (Mac!) EatingPie LRF 104 01-12-2009 12:35 PM


All times are GMT -4. The time now is 05:34 PM.


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