|  11-19-2021, 12:18 PM | #1 | 
| Guru            Posts: 54 Karma: 186734 Join Date: Jun 2013 Device: Samsung Galaxy Tab A9+ | 
				
				Template Language Question
			 
			
			I have a quick question for the forum about calibre template language. When saving my epubs to disk to match Calibre Companion's template I have: {authors:sublist(0,1,&)}/{title:re([—®™],_)} - {authors:re(\.\,,)} But I noticed that if an author's name ends in a period e.g., "Jr." CC ignores the period, not even replacing with an underscore, in creating a subdirectory based on the author's name. My question is how can I use both a sublist and re when creating my subdirectory in the above template? Thanks in advance for your expertise. | 
|   |   | 
|  11-20-2021, 11:25 AM | #2 | 
| Wizard            Posts: 1,216 Karma: 1995558 Join Date: Aug 2015 Device: Kindle | Code:  {:'re(sublist($authors, 0,1,'&'), '\.', '_')'}/{title:re([—®™],_)} - {authors:re(\.\,,)} | 
|   |   | 
| Advert | |
|  | 
|  11-20-2021, 12:40 PM | #3 | 
| Guru            Posts: 54 Karma: 186734 Join Date: Jun 2013 Device: Samsung Galaxy Tab A9+ | |
|   |   | 
|  11-20-2021, 12:54 PM | #4 | 
| Guru            Posts: 54 Karma: 186734 Join Date: Jun 2013 Device: Samsung Galaxy Tab A9+ | 
			
			I got it. It should be: {authors:'re(sublist($, 0, 1, '&'), '\.$', '')'}/{title:re([—®™],_)} - {authors:re(\.$,)} Thanks! Much appreciated. Last edited by jvorzimmer; 11-20-2021 at 01:27 PM. Reason: correction | 
|   |   | 
|  11-20-2021, 01:01 PM | #5 | |
| Grand Sorcerer            Posts: 12,525 Karma: 8065948 Join Date: Jan 2010 Location: Notts, England Device: Kobo Libra 2 | Quote: 
 What version of calibre are you running? If it is before version 5 then you need Code: {authors:'re(sublist($,0,1,'&'), '\.', '_')'}/{title:re([—®™],_)} - {authors:re(\.\,,)} | |
|   |   | 
| Advert | |
|  | 
|  11-20-2021, 01:26 PM | #6 | 
| Guru            Posts: 54 Karma: 186734 Join Date: Jun 2013 Device: Samsung Galaxy Tab A9+ | 
			
			Sorry, I should have mentioned that I'm 4.23.
		 | 
|   |   | 
|  | 
| Tags | 
| language, template, title | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Template language changes | chaley | Library Management | 180 | 09-18-2025 01:01 PM | 
| Template Language | phossler | Calibre | 8 | 01-12-2016 04:37 PM | 
| Help with template language | Pepin33 | Calibre | 8 | 11-11-2012 08:32 AM | 
| Template language question | BookJunkieLI | Library Management | 7 | 02-02-2012 06:55 PM | 
| Stupid question about calibre language template | Cammagno | Calibre | 1 | 01-08-2011 08:00 AM |