Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 09-06-2022, 06:38 PM   #46
enuddleyarbl
Guru
enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.
 
enuddleyarbl's Avatar
 
Posts: 734
Karma: 1077122
Join Date: Sep 2013
Device: Kobo Forma
Quote:
Originally Posted by Turtle91 View Post
...
Code:
p.first::first-line {font-variant:small-caps; font-size:1.15em}
...
Usually, manually converting a couple of ALL CAPS words at the start of each sentence to proper sentence case isn't too much of an issue. But, I was just playing with a book with 130+ chapters with many ALL CAP words and that was just too much.

I found a thread of yours on the Sigil forum from about 10 years ago where you asked about converting these clumps of ALL CAP words to sentence case. Have you found anything that works well in Calibre?
enuddleyarbl is offline   Reply With Quote
Old 09-06-2022, 06:50 PM   #47
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,131
Karma: 18727091
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Not quite. I think the creators of Sigil are contemplating having some kind of sentence case/title case option... Right now I think Calibre has the regex functions which could do it but I haven't practiced enough with it to feel competent. I use the following regex to get it mostly done:

find: <p class="first">([A-Z])([A-Z ]+)*
replace: <p class="first">\1\L\2\E

I put the class="first" to designate the first paragraph in a chapter...you'll have to adjust.

I roll through the ePub one at a time in case it tries to change proper names or 'I' to lower case.

Not completely automatic...but 130 chapters shouldn't take more than a few minutes.
Turtle91 is offline   Reply With Quote
Advert
Old 09-06-2022, 07:37 PM   #48
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 enuddleyarbl View Post
I found a thread of yours on the Sigil forum from about 10 years ago where you asked about converting these clumps of ALL CAP words to sentence case. Have you found anything that works well in Calibre?
I wrote about this back in:

and more recently in:

There were a few other discussions in there:

But honestly, proper Title Casing is a very hard problem, and all tools I've tested have flaws. "Edge cases" wrong like:
  • Names
  • Acronyms
  • Accents
  • Roman Numerals
  • Letters after punctuation

(For example, I do not recommend CapitalizeMyTitle anymore. Whatever algorithm they used years ago has progressively gotten worse, I believe ever since they got purchased by that rotten Grammarly.)

There are a few python libraries, like:

but this, too, has serious flaws.

Calibre does a decent job with ALL CAPS -> Titlecase... definitely one of the better ones.

What you would need is a custom TitleCasing plugin where you can check options (like what to do after hyphens).

- - -

Side Note: Personally, what I do when having to work on hundreds/thousands of chapter titles, is:
  • Export a giant list of all titles.
    • For example, ripping out every <h2>ALL CAPS TITLE</h2>
  • Run entire list through a capitalize tool.
  • Run original list through secondary capitalize tool.
  • Compare both lists together.
  • Skim down list to make manual corrections.
    • Words like "of", "and", ...

Then I could easily map:

Code:
<h2>ALL CAPS TITLE</h2>
to the equivalent line in:

Code:
<h2>All Caps Title</h2>
and do a mass Search/Replace.

This means I could also have an "All Caps" title in the TOC while still keeping the "ALL CAPS" visually in the book itself (just like I described in Post #15).

Quote:
Originally Posted by Turtle91 View Post
Not completely automatic...but 130 chapters shouldn't take more than a few minutes.
Heh. Yeah, I still do a lot of manual stuff.

To this date, I still haven't found a satisfactory tool for me.

One of the best capitalizers I've found is in TeXStudio. It has an Edit > Text Operations > To Titlecase (smart) which is quite good.

So sometimes, I even copy/paste text into there, then run it, then paste back where needed.

Last edited by Tex2002ans; 09-06-2022 at 07:47 PM.
Tex2002ans is offline   Reply With Quote
Old 09-06-2022, 08:59 PM   #49
enuddleyarbl
Guru
enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.
 
enuddleyarbl's Avatar
 
Posts: 734
Karma: 1077122
Join Date: Sep 2013
Device: Kobo Forma
Quote:
Originally Posted by Turtle91 View Post
...
find: <p class="first">([A-Z])([A-Z ]+)*
replace: <p class="first">\1\L\2\E
I don't recognize \L or \E in regex (neither does Calibre). Is that particular to Sigil?

EDIT: An example of what I get as a result:
Code:
W\LHAT EMBLEMS\E
EDIT 2: According to:

https://regex101.com/

\L and \E are specific to "PCRE (PHP <7.3)" and Calibre's editor is Python based. I can't find an equivalent.

Last edited by enuddleyarbl; 09-06-2022 at 09:23 PM.
enuddleyarbl is offline   Reply With Quote
Old 09-06-2022, 09:54 PM   #50
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,131
Karma: 18727091
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 are already using Calibre then I would just look up Regex Functions in the Calibre User's Guide. There is an example in there for Title Case, but that could just be slightly modified for Sentence case.

Sorry... I haven't used Calibre's Editor since Sigil came alive again, so I'm not as proficient with it. If you have issues you may find some smart Calibre people on their forum...although there are a few that poke their head's in here occasionally!

Last edited by Turtle91; 09-06-2022 at 09:56 PM.
Turtle91 is offline   Reply With Quote
Advert
Old 09-06-2022, 10:13 PM   #51
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,131
Karma: 18727091
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
I did a google and found this...might help point you in the general direction if you don't want to try the regex functions.

find: ([\.\r\n][ ]*)([A-Za-z\r])([^\.^\r^\n]+)
replace: \1\U\2\L\3
Turtle91 is offline   Reply With Quote
Old 09-07-2022, 07:30 AM   #52
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,978
Karma: 88000007
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Not all style guides agree on nuances of Title case. Also German is different to English anyway with nouns in sentences and if doing pre-20th C book or replicated style they had different rules then.
Quoth is offline   Reply With Quote
Old 09-07-2022, 04:05 PM   #53
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,213
Karma: 4949904
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Those full uppercase first few words of a chapter are pretty annoying. They are ugly and very intrusive when trying to read.

I pieced together this regex that works well in most cases, except for the usual "I" and proper nouns. I can flick through a hundred chapters in a couple of minutes, only stopping when I have to re-capitalise a name.

Find... </span>\b\s?[A-Z’]+(?:\s+[A-Z\.’,\s]+)*\b

Replace... regex function - Lower case (ignore tags)
Karellen is online now   Reply With Quote
Old 09-12-2022, 10:34 AM   #54
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,468
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by bookman156 View Post
There is nothing simpler than using c2sc and smcp. If they are unsupported or a different font is used by the reader you get a better result as fallback. What's difficult about that?

If the font is changed or c2sc and smcp aren't supported, the full caps will stay as full caps, whereas the smcp can be backed up with font-variant-caps: small-caps; so you still get small caps if that is supported.

You've done it the best as is possible.
Yeah, because these function tags are built INTO the font--which 99% of the time, aren't. effectively, you may as well be embedding a proper SC face into the eBook, with now-unnecessary media-query fallbacks if it doesn't work.

And it still requires that you have a device that can work with embedded fonts and certain CSS.

Hitch
Hitch is offline   Reply With Quote
Old 09-13-2022, 02:38 PM   #55
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
Just wanted to put this example from my latest conversion here:

Click image for larger version

Name:	Smallcaps.-.Capitals.and.Lowercase.png
Views:	116
Size:	22.0 KB
ID:	196500

I think it can speak for itself.
Tex2002ans is offline   Reply With Quote
Old 09-14-2022, 09:23 AM   #56
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,468
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by Tex2002ans View Post
Just wanted to put this example from my latest conversion here:

Attachment 196500

I think it can speak for itself.
I'm sure it does, but apparently I'm deaf. What is it precisely that you're demo'ing here, Tex?

H
Hitch is offline   Reply With Quote
Old 09-14-2022, 09:33 AM   #57
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,131
Karma: 18727091
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Smallcaps can be used with lowercase AND uppercase letters - and the uppercase glyph is used while still maintaining a font-size difference. It is also using a font that looks like a telegram or an old typewriter.

It looks really nice actually!
Turtle91 is offline   Reply With Quote
Old 09-14-2022, 09:49 AM   #58
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,468
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by Turtle91 View Post
Smallcaps can be used with lowercase AND uppercase letters - and the uppercase glyph is used while still maintaining a font-size difference. It is also using a font that looks like a telegram or an old typewriter.

It looks really nice actually!
Yes, it does look nice, but...never mind. I officially give up.

Hitch
Hitch is offline   Reply With Quote
Old 09-14-2022, 01:50 PM   #59
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: 75,103
Karma: 131686272
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
To do smallcaps, the characters have to be lowercase. Hence text-transform: lowercase;. If you are converting smallcaps done with a font size to real smallcaps, then you don't need to edit the uppercase text to make it lowercase.
JSWolf is offline   Reply With Quote
Old 09-14-2022, 02:05 PM   #60
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,131
Karma: 18727091
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 JSWolf View Post
To do smallcaps, the characters have to be lowercase. Hence text-transform: lowercase;. If you are converting smallcaps done with a font size to real smallcaps, then you don't need to edit the uppercase text to make it lowercase.
You are incorrect Jon.

Please take the time to actually read what was written previously before making these blanket statements that are demonstrably false.

Here's an exercise for you:

Show us the html you would use to create the following (make sure you keep the difference in font size between the upper and lower case letters) and you must use the upper-case glyph for all the lower-case letters:

"Now Is The Time For All Good Men To Come To The Aid Of Their Countries."

Here's mine:
Code:
.sc {font-variant:small-caps}

<p class="sc">Now Is The Time For All Good Men To Come To The Aid Of Their Countries.</p>
Turtle91 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Concept] Telegram Bot for converting epubs to kepubs (and transferring) Tommalka Kobo Developer's Corner 2 01-01-2022 04:03 AM
Recipe request: Worcester Telegram NSILMike Recipes 0 12-31-2020 08:52 AM
Worcester Telegram Recipe request NSILMike Recipes 0 10-11-2020 07:39 AM
Green Island - Telegram-channel for authors and writers of books Phil J. Parker Self-Promotions by Authors and Publishers 0 06-26-2018 02:23 PM
E-readers chat (telegram, whatsapp)? Mochy Android Devices 4 07-28-2015 08:46 AM


All times are GMT -4. The time now is 06:24 PM.


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