![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,620
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> Code:
<span class="smcpIncise">Smith</span> I would like to use a batch command to do it... Last edited by roger64; 05-14-2017 at 03:27 AM. Reason: span |
![]() |
![]() |
![]() |
#2 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,677
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
In Regex mode, search for: Code:
<span class="smcpIncise">([[:upper:]])([[:upper:]]{2,})</span> Code:
<span class="smcpIncise">\1\L\2\E</span> |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,287
Karma: 20171067
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/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> Last edited by Turtle91; 05-14-2017 at 12:27 PM. |
![]() |
![]() |
![]() |
#4 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,620
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 |
![]() |
![]() |
![]() |
#5 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 78,847
Karma: 143095300
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> |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,677
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
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>
Code:
<span class="smcpIncise">Épilogue</span> Last edited by Doitsu; 05-25-2017 at 07:15 AM. |
|
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,620
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! |
![]() |
![]() |
![]() |
#8 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,287
Karma: 20171067
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
|
![]() |
![]() |
![]() |
#9 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,542
Karma: 19001583
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
![]() |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Improved Charis SIL with smallcaps | JSWolf | General Discussions | 289 | 04-05-2025 02:47 PM |
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 |