05-14-2017, 04:23 AM | #1 |
Wizard
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> 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 04:27 AM. Reason: span |
05-14-2017, 08:36 AM | #2 | |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
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 | |
|
05-14-2017, 12:36 PM | #3 |
A Hairy Wizard
Posts: 3,225
Karma: 19000635
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 01:27 PM. |
05-14-2017, 01:49 PM | #4 |
Wizard
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 07:26 PM. Reason: accent |
05-24-2017, 05:57 AM | #5 |
Resident Curmudgeon
Posts: 76,491
Karma: 136564766
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 | |
|
05-24-2017, 06:03 PM | #6 | |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
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 08:15 AM. |
|
05-25-2017, 01:15 PM | #7 |
Wizard
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! |
05-26-2017, 08:04 PM | #8 |
A Hairy Wizard
Posts: 3,225
Karma: 19000635
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
|
|
05-27-2017, 02:49 PM | #9 |
frumious Bandersnatch
Posts: 7,536
Karma: 19000001
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
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Improved Charis SIL with smallcaps | JSWolf | General Discussions | 285 | 08-03-2024 11:02 AM |
smallcaps how to? | JSWolf | ePub | 20 | 06-02-2016 03:40 PM |
italics (and smallcaps) not displayed | franklekens | Kobo Reader | 9 | 12-31-2013 11:02 AM |
What part of the CSS can cause this? (smallcaps related in Sigil) | mtrahan | ePub | 15 | 06-01-2011 10:24 AM |
Smallcaps in Kindle | cscotts | Kindle Formats | 5 | 01-26-2011 10:52 AM |