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

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

Notices

Reply
 
Thread Tools Search this Thread
Old 02-13-2019, 05:02 PM   #16
phossler
Guru
phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.
 
Posts: 811
Karma: 156340
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Quote:
Originally Posted by theducks View Post
Maybe you could have your search use the 'OR' type regex (aword|bword|cword|dword)
I could do that, but it more of an efficiency / productivity question

I won't know apriori the word or words or phrases to build the OR RegEx Find.

Proofing or fixing a book, when I come across a word or phrase (typically foreign) that I want in italics (or bold or <span>-ed or whatever) everywhere in the book, I could select the text, and then run a stored search "Make Selection Italic" IF there were a way to have Find somehow use what ever is selected

MS Word's Find&Replace lets you use ^c for the clipboard contents, and there's so much in Calibre, I didn't know there was something similar, or if it could be easily added

Last edited by phossler; 02-13-2019 at 05:05 PM.
phossler is offline   Reply With Quote
Old 02-13-2019, 05:18 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: 23,183
Karma: 24100002
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: K4NT, Galaxy Tab A, Kobo Aura2
Quote:
Originally Posted by phossler View Post
I could do that, but it more of an efficiency / productivity question

I won't know apriori the word or words or phrases to build the OR RegEx Find.

Proofing or fixing a book, when I come across a word or phrase (typically foreign) that I want in italics (or bold or <span>-ed or whatever) everywhere in the book, I could select the text, and then run a stored search "Make Selection Italic" IF there were a way to have Find somehow use what ever is selected

MS Word's Find&Replace lets you use ^c for the clipboard contents, and there's so much in Calibre, I didn't know there was something similar, or if it could be easily added
Clips use what is selected
I have a clip
Code:
<span lang="es">\1</span>
The common ones, have show on the clip bar. The lesser use ones are in nested clip folders
I just select and click the LANG= clip on my toolbar
theducks is offline   Reply With Quote
Advert
Old 02-13-2019, 05:27 PM   #18
phossler
Guru
phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.
 
Posts: 811
Karma: 156340
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
'Clips' or 'Snippets'?

I couldn't find 'Clips' and there doesn't seem to be 'Clips Toolbar'

You might be thinking of Sigil ???

Even so, they're more of an ad hoc thing IIRC, not a global F&R
phossler is offline   Reply With Quote
Old 02-13-2019, 05:45 PM   #19
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 13,289
Karma: 10793754
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by phossler View Post
'Clips' or 'Snippets'?

I couldn't find 'Clips' and there doesn't seem to be 'Clips Toolbar'

You might be thinking of Sigil ???

Even so, they're more of an ad hoc thing IIRC, not a global F&R
They're in Preferences->Editor Settings, see Snippets for doco.

BR
BetterRed is offline   Reply With Quote
Old 02-13-2019, 07:27 PM   #20
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: 23,183
Karma: 24100002
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: K4NT, Galaxy Tab A, Kobo Aura2
Quote:
Originally Posted by phossler View Post
'Clips' or 'Snippets'?

I couldn't find 'Clips' and there doesn't seem to be 'Clips Toolbar'

You might be thinking of Sigil ???

Even so, they're more of an ad hoc thing IIRC, not a global F&R
theducks is offline   Reply With Quote
Advert
Old 02-13-2019, 07:33 PM   #21
phossler
Guru
phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.
 
Posts: 811
Karma: 156340
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Quote:
Originally Posted by BetterRed View Post
They're in Preferences->Editor Settings, see Snippets for doco.

BR
Thanks, I've used snippets a little but they're still one at a time

jbacelar's suggestion seems to offer a way to do a global F&R

It just requires some careful manual copy/pasting, and not as IMHO user friendly as having a token representing the selected text
phossler is offline   Reply With Quote
Old 02-13-2019, 11:09 PM   #22
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 34,410
Karma: 10323934
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Simply edit your saved search, replacing the matched word in the search definition, then run it on all files. Done in about 5 clicks.
kovidgoyal is offline   Reply With Quote
Old 02-14-2019, 09:58 AM   #23
phossler
Guru
phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.
 
Posts: 811
Karma: 156340
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Quote:
Originally Posted by kovidgoyal View Post
Simply edit your saved search, replacing the matched word in the search definition, then run it on all files. Done in about 5 clicks.
That seems to be the consensus. Jbacelar said the same thing.

It's just that the book I'm trying to cleanup has many foreign words used many times each so I was looking for the most efficient to add <i> tags around each instance of each word

If there were a token (e.g. _SELECTION_) that could be used in the saved search, then it'd only be one click: Select word/phrase, click Saved Search
phossler is offline   Reply With Quote
Old 02-14-2019, 10:02 AM   #24
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 34,410
Karma: 10323934
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
opena text file go through th ebook selecting the words one by one and copying them into the text file, separated by | then use that expression ina single search and replace.
kovidgoyal is offline   Reply With Quote
Old 02-14-2019, 01:57 PM   #25
phossler
Guru
phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.
 
Posts: 811
Karma: 156340
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Quote:
Originally Posted by kovidgoyal View Post
opena text file go through th ebook selecting the words one by one and copying them into the text file, separated by | then use that expression ina single search and replace.
I usually stumble across words/phrases going through the book one at a time, so I know I'd miss something many times and have to keep repeating

So for now, jbacelar's suggestion seems to offer the most flexible way to do a global F&R for <i>Things like this</i>

Thanks to everyone for the ideas and suggestions
phossler is offline   Reply With Quote
Old 02-14-2019, 06:06 PM   #26
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 13,289
Karma: 10793754
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@phossler - IIRC one of the Sigil cleanup plugins works off word lists, I'm not sure if the replacement can include tags - might be worth a look.

BR
BetterRed is offline   Reply With Quote
Old 02-14-2019, 09:22 PM   #27
phossler
Guru
phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.
 
Posts: 811
Karma: 156340
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
@BetterRed --

Thanks for the tip. I used to use Sigil, but when Kovid released his editor module, I switched and standardized on Calibre.

I guess I'll bite the bullet and use jacelar's and KG's suggestion paste the word or phrase into the saved search Find box and do a replace all

It's still much easier than the way I was doing it with the Find/Replace at the bottom of the screen

I'll have a series of saved searches: one to put <i> around all instances of a foreign word or phrase, and others to put a <span lang= .… > around foreign text (might include italics there - hmmm, didn't think of that)

Not sure what the actual rules are for marking/tagging foreign text is, but that'll be a fun research project for another day


Added - actually, the document language is English, so spell check flags the foreign words. From the spell check error report, I can copy the word to the saved search and do a replace all. Removes it from spell check error since I don't like to Ignore or Add To Dictionary

Doesn't work for phrases tho

Last edited by phossler; 02-14-2019 at 09:37 PM.
phossler is offline   Reply With Quote
Old 02-14-2019, 09:40 PM   #28
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 13,289
Karma: 10793754
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@phossler - I don't see them as either/or, so I use both - I find some things easier in Sigil than calibre and vice-versa. And Sigil has a some useful plugins.

IIRC the Sigil devs are planning to dispense with the rigid folder structure.

BR
BetterRed is offline   Reply With Quote
Old 02-20-2019, 03:05 AM   #29
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: 1,187
Karma: 6101597
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by phossler View Post
Added - actually, the document language is English, so spell check flags the foreign words. From the spell check error report, I can copy the word to the saved search and do a replace all. Removes it from spell check error since I don't like to Ignore or Add To Dictionary
This is exactly how I would handle it.

Ever since Calibre added Multi-Language Spellcheck, you can easily mark the words with lang + xml:lang.

Example sentence:

Code:
I ate some español sofritos today.
1. Use Calibre's Tools > Check Spelling with Show only misspelled words checked.

Most foreign words should pop up as misspelled. "sofritos" would stick out like a sore thumb.

Use Change selected word to and replace it with something like "@sofritos@".

Note: The very last word in the list is the word itself, so just click on that and make your adjustments:

Click image for larger version

Name:	CalibreMultiLanguageSpellcheck-Step1.png
Views:	18
Size:	17.3 KB
ID:	169817

2. After the end of the first pass, do a mass Search/Replace:

Search: @(.+?)@
Replace: <i lang="es" xml:lang="es">\1</i>

Code:
I ate some español <i lang="es" xml:lang="es">sofritos</i> today.
3. Run Spellcheck List again, and repeat Step 1.

You'll easily be able to see which Spanish words you've caught so far, and narrow the list down further:

Click image for larger version

Name:	CalibreMultiLanguageSpellcheck-Step3.png
Views:	14
Size:	20.0 KB
ID:	169818

4. Now uncheck Show only misspelled words, and do a few more passes. That should get you most of the way there.

5. To attach most "phrases" (which are made up of just individual foreign words)... search for two Spanish italics next to each other:

Search: (<i lang="es" xml:lang="es">.+?)</i> <i lang="es" xml:lang="es">
Replace: \1

and it'll merge them:

Code:
I ate some <i lang="es" xml:lang="es">español sofritos</i> today.
That should carry you most of the way there.

Quote:
Originally Posted by phossler View Post
Not sure what the actual rules are for marking/tagging foreign text is, but that'll be a fun research project for another day
Just wondering, why exactly are you marking all foreign words in italics? Are you trying to enforce a Style Guide (CMOS?) or something along those lines?

Last edited by Tex2002ans; 02-20-2019 at 04:26 AM.
Tex2002ans is offline   Reply With Quote
Old 02-20-2019, 10:00 AM   #30
phossler
Guru
phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.
 
Posts: 811
Karma: 156340
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
1. Some very good ideas -- thanks

2.

a. Proofing APA, MLA, and ASA papers for family members using MS Word

b. I thought it was the convention since that was what I was used to seeing in dead tree books from my student days. I might have over-generalized, but I was going by something like this. APA is similar

c. There are no house rules or S&C in my house for most ebooks, since I mostly just try to re-format for my Kindle and for easier reading, so I just wanted to do it that way (aka No Good Reason )

Of course, for APA, etc. or other papers, I'd follow what ever the guidelines were.


https://style.mla.org/styling-foreign-terms/

Spoiler:
Quote:
How should I treat foreign terms in MLA style?
Treat foreign terms according to the guidelines in the MLA Style Manual and Guide to Scholarly Publishing:

In general, italicize foreign words used in an English text:
The Renaissance courtier was expected to display sprezzatura, or
nonchalance, in the face of adversity.

The numerous exceptions to this rule include quotations entirely in another language (“Julius Caesar said, ‘Veni, vidi, vici’”); non-English titles of works published within larger works (poems, stories, essays, articles), which are placed in quotation marks and not italicized (“El sueño,” the title of a poem by Quevedo); proper nouns (Entente Cordiale), except when italicized through another convention (SS Normandie); and foreign words anglicized through frequent use.


Examples of terms, phrases, and abbreviations that would not be italicized include “concerto,” “raison d’être,” and “e.g.” (100).
phossler 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
Difference in Manual Search and Saved Search phossler Editor 4 10-04-2015 12:17 PM
A wee request regarding search notification (and file selection) sherman Editor 1 04-06-2014 10:50 AM
Sending selection from Search & Replace to different fields? MelBr Calibre 2 03-05-2013 01:00 PM
Saved Search: How 2 theducks Library Management 3 11-27-2012 02:10 PM
Need help setting up a saved search ficbot Calibre 1 07-10-2010 02:10 PM


All times are GMT -4. The time now is 02:47 PM.


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