Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Workshop

Notices

Reply
 
Thread Tools Search this Thread
Old 05-14-2017, 03:23 AM   #1
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Reestablishing smallcaps

Hi

I wish to change hundreds of names for smallcap use They are all within their own span.
I would like to go from
Code:
<span class="smcpIncise">SMITH</span>
to
Code:
<span class="smcpIncise">Smith</span>
I can change them one by one, using a right click with Sigil.
I would like to use a batch command to do it...

Last edited by roger64; 05-14-2017 at 03:27 AM. Reason: span
roger64 is offline   Reply With Quote
Old 05-14-2017, 07:36 AM   #2
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,583
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by roger64 View Post
I would like to go from
Code:
<span class="smcpIncise">SMITH</span>
to
Code:
<span class="smcpIncise">Smith</span>
That's relatively easy with Sigil.

In Regex mode, search for:

Code:
<span class="smcpIncise">([[:upper:]])([[:upper:]]{2,})</span>
and replace with:

Code:
<span class="smcpIncise">\1\L\2\E</span>
For more examples see this very old post.
Doitsu is offline   Reply With Quote
Old 05-14-2017, 11:36 AM   #3
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,093
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
If you have any spans with spaces, or any character other than A-Z, then you would also have to check for that. You can also do it with two passes:

pass 1
search:
<span class="smcpIncise">(.*?)</span>

<span class="smcpIncise">\L\1\E</span>

pass 2
search:
<span class="smcpIncise">(.*?)</span>

replace:
<span class="smcpIncise">\u\1</span>


This two-pass technique can be saved as a "Saved Search" and run together with a single click.


After that you would need to individually check each span for words you wish to be capitalized like proper names, "I", "I've", "I'm", etc. Although you can create individual S/R for a bunch of those.

It would be really nice if we could have some kind of "Sentence case" or "Title Case" functionality in the S/R, but as I understand it, Sigil's flavor of Regex doesn't support that. If you absolutely need to have it, then you could try Calibre Editor which has the ability to do Regex Functions.

edit: You can get a "Sentence case" like effect by modifying Doitsu's search slightly. Adding a space or punctuation capture into the second group works well:

Code:
search:
<span class="smcpIncise">([[:upper:]])([[:upper:][:space:][:punct:]]{2,})</span>

replace:
<span class="smcpIncise">\1\L\2\E</span>
Cheers,

Last edited by Turtle91; 05-14-2017 at 12:27 PM.
Turtle91 is offline   Reply With Quote
Old 05-14-2017, 12:49 PM   #4
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Hi

Thank you both for your detailed replies. I will proceed carefully.

Edit: I used the first regex with Sigil (it does not work with the Calibre editor). It proceeded about 95% of all entries. The remaining ones had one or more accented letters of some sort (â, é, ë, ê, ô, ç, etc.). But it was easy to correct. No need to adapt the regex.

Last edited by roger64; 05-14-2017 at 06:26 PM. Reason: accent
roger64 is offline   Reply With Quote
Old 05-24-2017, 04:57 AM   #5
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,897
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
How would you handle the regex if you had something like...

<span class="italic>Mark <span class="smcpIncise">SMITH</span> Jr.</span>
JSWolf is offline   Reply With Quote
Old 05-24-2017, 05:03 PM   #6
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,583
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by roger64 View Post
Edit: I used the first regex with Sigil (it does not work with the Calibre editor). It proceeded about 95% of all entries. The remaining ones had one or more accented letters of some sort (â, é, ë, ê, ô, ç, etc.). But it was easy to correct. No need to adapt the regex.
The regular expressions suggested by Turtle91 and me only work with non-accented characters. To add support for Unicode characters simply prefix the search expression with (*UCP). E.g.

Find:(*UCP)<span class="smcpIncise">([[:upper:]])([[:upper:]]{2,})</span>
Replace:<span class="smcpIncise">\1\L\2\E</span>

will find:
Code:
<span class="smcpIncise">ÉPILOGUE</span>
and replace it with:
Code:
<span class="smcpIncise">Épilogue</span>

Last edited by Doitsu; 05-25-2017 at 07:15 AM.
Doitsu is offline   Reply With Quote
Old 05-25-2017, 12:15 PM   #7
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
@Doitsu

Thank you very much for this very useful tip and congratulations for your extensive knowledge!
roger64 is offline   Reply With Quote
Old 05-26-2017, 07:04 PM   #8
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,093
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Quote:
Originally Posted by roger64 View Post
@Doitsu

Thank you very much for this very useful tip and congratulations for your extensive knowledge!
Ditto! Thanks!!
Turtle91 is offline   Reply With Quote
Old 05-27-2017, 01:49 PM   #9
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,515
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
I guess you are lucky you don't have names like CALDERÓN DE LA BARCA -> Calderón de la Barca
Jellby is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Improved Charis SIL with smallcaps JSWolf General Discussions 274 04-16-2024 08:13 AM
smallcaps how to? JSWolf ePub 20 06-02-2016 02:40 PM
italics (and smallcaps) not displayed franklekens Kobo Reader 9 12-31-2013 10:02 AM
What part of the CSS can cause this? (smallcaps related in Sigil) mtrahan ePub 15 06-01-2011 09:24 AM
Smallcaps in Kindle cscotts Kindle Formats 5 01-26-2011 09:52 AM


All times are GMT -4. The time now is 08:44 PM.


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