View Single Post
Old 12-18-2022, 06:56 AM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,516
Karma: 8065348
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Req13 View Post
I have been trying to figure out how to use the saving books to disk template.

When I save a book that is named something like:

Mark Twain - Anthologies: How Many Are There?

I would like to replace the colon with a semicolon and remove the question mark so that it comes out as this:

Mark Twain - Anthologies; How Many Are There

Is there a way to achieve that? This is all I've been able to work out so far.

Code:
Replace ? with nothing

{authors} - {title:re(\?,)}
--------------------------------------------------------
Replace ? and : with nothing

{authors} - {title:re(\?|\:,)}
--------------------------------------------------------
Replace : with ;

{authors} - {title:re(:,;)}

I'd also like to possibly add to it if I need to change other special characters to something other than an underscore.

Thanks for any help.
One way that is easy to extend in the future.
Code:
program:
	t = $title;
	t = re(t, '\?', '');
	t = re(t, ':', ';');
# Add any more changes that you want.
FWIW: I prefer GPM templates over the other template modes.
chaley is offline   Reply With Quote