View Single Post
Old 09-06-2022, 10:59 PM   #7512
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 7,045
Karma: 4604637
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Quote:
Originally Posted by Amalthia View Post
Now that I've implemented the below code:
Code:
chapter_title_add_pattern: Chapter ${number}: ${title}
chapter_title_strip_pattern:^([0-9]+[\.: -]+)?(Chapter *[0-9]+[\.:, -]*)?
My chapters have a colon "Chapter 1:" is it possible to remove the colon" in the chapter_title_strip_pattern?

...

p.s. I don't want to remove the colon from chapter_title_add_pattern: because then I have "Chapter 1 title of chapter" and I'd like some break between the chapter number and title.
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.
JimmXinu is offline   Reply With Quote