View Single Post
Old 09-07-2022, 12:54 AM   #7514
Amalthia
Wizard
Amalthia ought to be getting tired of karma fortunes by now.Amalthia ought to be getting tired of karma fortunes by now.Amalthia ought to be getting tired of karma fortunes by now.Amalthia ought to be getting tired of karma fortunes by now.Amalthia ought to be getting tired of karma fortunes by now.Amalthia ought to be getting tired of karma fortunes by now.Amalthia ought to be getting tired of karma fortunes by now.Amalthia ought to be getting tired of karma fortunes by now.Amalthia ought to be getting tired of karma fortunes by now.Amalthia ought to be getting tired of karma fortunes by now.Amalthia ought to be getting tired of karma fortunes by now.
 
Amalthia's Avatar
 
Posts: 1,204
Karma: 1000000
Join Date: Jan 2007
Location: Anchorage, AK
Device: Sony Reader PRS-505, PRS-650, PRS-T3, Pocketbook HD2
Quote:
Originally Posted by JimmXinu View Post
chapter_title_strip_pattern removes ':' if it's present, but it's chapter_title_add_pattern that's putting it in the final product.

I didn't figure out until the PS that you're really talking about chapters with a ${title} value vs without after chapter_title_strip_pattern is applied.

The easy route is to just change to something else, like '.' -- "Chapter 1." standing alone looks better, IMO.

But then I'm also perfectly happy with '1. Chapter 1'.

chapter_title_add_pattern is implemented using python's builtin string.Template mechanism. I don't believe it has any way to conditionally include or exclude parts without actually putting them in the pattern.

I can't think of any way without adding new code. I hesitate to do that because it's pretty niche. And would need to be configurable, you want ':', I'd use '.', somebody else would want ' - ', etc.

I'll consider it if more users speak up in favor.
Thanks for the explanation. It helps me understand why the regex changes I made to chapter_title_strip_pattern: didn't seem to do what I thought they would!

Ideally, authors would find a more consistent way to label their chapters. I'll try a few different punctuation marks and see which one works best for the chapters that don't have titles, since we can't use the chapter_title_strip_pattern: twice, or add to the end of it to remove just colon.

Have a good night!
Amalthia
Amalthia is offline   Reply With Quote