Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 05-10-2020, 10:00 PM   #1
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
TitleCase shortcut and TOC

I had a epub with all the headings in UPPER CASE (drives me nuts)

Q1. Is there a way to convert all words in a <Hx> to Title Case using some kind of Find and Replace? The few LC exceptions ('the', 'a', etc. I can do manually)

Q2. I have Title Case on a shortcut key, but if I highlight text that has a tag in it, nothing happens. E.g. TOM<br/>DICK<br/>HARRY.

Q3. In a heading like TOM<br/>DICK<br/>HARRY, the tags are ignored when making a TOC, so that the TOC entry looks like TOMDICKHARRY

As a work-around, if I use TOM <br/>DICK <br/>HARRY (add space after) then the TOC is at least readable TOM DICK HARRY

Any workarounds?

I did try text-transform, but that didn't seem to do anything

Code:
h1 {
  font-family: sans-serif;
  page-break-before: always;
  page-break-after: avoid;
  text-indent: 0;
  text-align: center;
  margin-top: 2em;
  margin-bottom: 1em;
  font-size: 1.5em;
  font-weight: bold;
  font-style: normal;
  text-transform: capitalize;
}
phossler is offline   Reply With Quote
Old 05-10-2020, 11:33 PM   #2
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
Q3: I use a space before the br. Although in my case it's a space before a span; in my CSS I have a selector/combinator that puts what's in the span on a separate line when it's in a header.

Q1: Yes, look in the thread on regex / regular expressions. Or search on the web.
hobnail is offline   Reply With Quote
Advert
Old 05-10-2020, 11:58 PM   #3
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: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://manual.calibre-ebook.com/function_mode.html
kovidgoyal is offline   Reply With Quote
Old 05-11-2020, 09:01 AM   #4
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Well, that was embarrassing --

Not only was it in the manual, but I had saved it as a Search a long time ago
phossler is offline   Reply With Quote
Old 05-11-2020, 09:04 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,998
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by phossler View Post
Well, that was embarrassing --

Not only was it in the manual, but I had saved it as a Search a long time ago
Mind posting your search solution in case anyone else wants the answer?
JSWolf is offline   Reply With Quote
Advert
Old 05-11-2020, 11:28 AM   #6
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,461
Karma: 145525534
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by JSWolf View Post
Mind posting your search solution in case anyone else wants the answer?
Jon, as the OP said, changing the header to title case is a sample solution in the FAQ.


Automatically fixing the case of headings in the document

Here, we will leverage one of the builtin functions in the editor to automatically change the case of all text inside heading tags to title case:

Find expression: <([Hh][1-6])[^>]*>.+?</\1>

For the function, simply choose the Title-case text (ignore tags) builtin function. The will change titles that look like: <h1>some TITLE</h1> to <h1>Some Title</h1>. It will work even if there are other HTML tags inside the heading tags.
DNSB is online now   Reply With Quote
Old 05-11-2020, 02:17 PM   #7
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Quote:
Originally Posted by JSWolf View Post
Mind posting your search solution in case anyone else wants the answer?
As Kovid said

https://manual.calibre-ebook.com/function_mode.html
Attached Thumbnails
Click image for larger version

Name:	Capture.JPG
Views:	149
Size:	48.6 KB
ID:	179196  
phossler is offline   Reply With Quote
Old 05-13-2020, 09:46 AM   #8
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Quote:
Originally Posted by kovidgoyal View Post
@KG --

Any chance of having

Q2. the TitleCase shortcut key work even if there are some tags in the selected text by just ignoring the tags?

Q3. the TOC 'honor' any tags in the headings, normally <br/>?
phossler is offline   Reply With Quote
Old 05-13-2020, 11:49 AM   #9
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: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Not sure what you mean by (1) and for (2) no toc entries are always single line of plain text
kovidgoyal is offline   Reply With Quote
Old 05-13-2020, 01:51 PM   #10
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
(1) if I highlight text that has a tag in it, and select the text and choose TitleCase, nothing happens. E.g. TOM<br/>DICK<br/>HARRY doesn't get turned into Tom<br/>Dick<br/>Harry<br/>

(2) In a heading like TOM<br/>DICK<br/>HARRY, the tags are ignored when making a TOC, so that the TOC entry looks like TOMDICKHARRY

I don't understand how your TitleCase works for (1), but it would seem to me (obviously just my opinion) that (2) requiring all TOC entries to be a single line can be limiting. Maybe just transforming tags in a space?
Attached Thumbnails
Click image for larger version

Name:	Capture2.JPG
Views:	121
Size:	85.6 KB
ID:	179224   Click image for larger version

Name:	Capture.JPG
Views:	120
Size:	35.9 KB
ID:	179225  

Last edited by phossler; 05-13-2020 at 01:55 PM. Reason: Forgot pictures :-(
phossler is offline   Reply With Quote
Old 05-13-2020, 01:55 PM   #11
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: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
(1) has nothing to do with tags, but rather that all upper case words are assumed to be acronyms. lower case them first then titlecase them. And you should insert spaces before each <br> as well, which will take care of (2) for you as well.
kovidgoyal is offline   Reply With Quote
Old 05-13-2020, 03:19 PM   #12
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Ahh --

1. I didn't realize the acronyms part

2. I had just assumed that tags, etc. would be treated as white space and I wouldn't have to force the extraneous space in to get the formatting to work

Thanks for the explanation
phossler is offline   Reply With Quote
Old 05-13-2020, 04:19 PM   #13
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: 29,809
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
I always put a space BEFORE the <br /> for a clean looking TOC entry whe I use H# tags to generate from multi-line headings

I never knew WHY all case tools I have ever used (inc DOS apps), would never mix case an upper only word (I knew I had to first lower).
Kovid makes perfect sense.
theducks is online now   Reply With Quote
Old 05-13-2020, 09:04 PM   #14
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Hmmm - it seems that putting a space AFTER each <br/> is more reliable

Doing it that way, if you make UPPER CASE with br/'s into lower case and then into Title Case, it works and you end with TitleCase. The TOC is also correct.

Sort of appears to me that it treats UPPER+<br/>+space as a word but not space+<br/>+UPPER as a word
Attached Thumbnails
Click image for larger version

Name:	Capture.JPG
Views:	116
Size:	91.5 KB
ID:	179229  
phossler is offline   Reply With Quote
Old 05-13-2020, 09:11 PM   #15
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: 29,809
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Space After
Staggers the Viewed text

Line One
Line Two
(exaggerated)
theducks is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
keyboard shortcut for TOC in viewer? calibre4evar Calibre 8 01-05-2015 12:28 AM
Multiple HTML files w/ TOC to MOBI, not added in order listed in TOC dysfunction Conversion 3 01-03-2014 12:40 AM
Ho do I create a TOC for ePub which does convert to an active TOC in Kindle Previewer K-Thom Calibre 1 09-24-2013 06:32 PM
TOC Shortcut? runtmms Amazon Kindle 12 11-14-2010 05:36 PM
Making a TOC for LRFs? Issues with Calibre + LRF TOC editor not working Magitek LRF 0 05-06-2009 01:25 PM


All times are GMT -4. The time now is 10:19 PM.


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