| 
			
			 | 
		#151 | 
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525 
				Karma: 8065948 
				Join Date: Jan 2010 
				Location: Notts, England 
				
				
				Device: Kobo Libra 2 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#152 | |
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525 
				Karma: 8065948 
				Join Date: Jan 2010 
				Location: Notts, England 
				
				
				Device: Kobo Libra 2 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 Another example: Code: 
	program: if '^science' inlist_field '#genre' then 'yes' else 'no' fi  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#153 | 
| 
			
			
			
			 Custom User Title 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,358 
				Karma: 79528341 
				Join Date: Oct 2018 
				Location: Canada 
				
				
				Device: Kobo Libra H2O, formerly Aura HD 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Ah, I was looking in the function reference. It works when I tried it.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#154 | 
| 
			
			
			
			 Custom User Title 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,358 
				Karma: 79528341 
				Join Date: Oct 2018 
				Location: Canada 
				
				
				Device: Kobo Libra H2O, formerly Aura HD 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Does inlist_field only work for strings? e.g.: 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Code: 
	program:
	readgoal = strcat('readinggoal:', format_date(today(), 'yyyy'));
	if
		readgoal inlist_field '#admintags'
 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#155 | |
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525 
				Karma: 8065948 
				Join Date: Jan 2010 
				Location: Notts, England 
				
				
				Device: Kobo Libra 2 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 EDIT 2: the changes to the syntax highlighter are now in calibre source. Last edited by chaley; 10-23-2024 at 06:46 PM. Reason: Removed edit 1 -- identifiers now works in the same way as inlist  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#156 | 
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525 
				Karma: 8065948 
				Join Date: Jan 2010 
				Location: Notts, England 
				
				
				Device: Kobo Libra 2 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			28 Oct 2024 (in calibre 7.21) 
		
	
		
		
		
		
		
		
		
		
		
		
		
			
 Last edited by chaley; 11-21-2024 at 11:14 AM.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#157 | 
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,292 
				Karma: 1428263 
				Join Date: Dec 2016 
				Location: Goiânia - Brazil 
				
				
				Device: iPad, Kindle Paperwhite, Kindle Oasis 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Nice. Even simpler. Now I can find all authors without a note like this: 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Code: 
	not template:"""program:
	if $authors in has_note('authors', '') then
		'1'
	else
		 ''
	fi;#@#:t:1"""
 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#158 | |
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525 
				Karma: 8065948 
				Join Date: Jan 2010 
				Location: Notts, England 
				
				
				Device: Kobo Libra 2 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 It will also be at least 10 times slower than the template I posted in the other thread. Perhaps as much as 50 times slower. Of course, this only matters if you have lots of books. This template uses the new has_note() to find books where 1 or more authors don't have a note. It works by returning '1' if all authors for a book have notes, otherwise ''. It will be slightly faster than your template, but nowhere near as fast as the python template. Code: 
	program:
	if list_count(has_note('authors', ''), '&') ==# list_count_field('authors') then
		return '1'
	fi;
	''
 | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#159 | 
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,292 
				Karma: 1428263 
				Join Date: Dec 2016 
				Location: Goiânia - Brazil 
				
				
				Device: iPad, Kindle Paperwhite, Kindle Oasis 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Oh, I see my mistake now. I'll leave the python template, then. 
		
	
		
		
		
		
		
		
		
		
		
		
		
			When using my template, I do think the first time was slow, then other times were fast. I guess it's the work of the cache in action. ________________________ EDIT: I decided to check the difference between the two templates (mine and yours, but not the python one). It seems to find the same results, even if only one author has a note. Then, looking again at the code, I notice it does work: Example: If i have a book with two authors (AuthorA and AuthorB), and only have notes for AuthorA. $authors = 'AuthorA & AuthorB' has_note('authors', '') = 'AuthorA' Now, the comparison if $authors in has_note('authors', '') will return False, as intended. But I'm definitely staying with the python template. Last edited by thiago.eec; 10-28-2024 at 05:11 PM.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#160 | 
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525 
				Karma: 8065948 
				Join Date: Jan 2010 
				Location: Notts, England 
				
				
				Device: Kobo Libra 2 
				
				
				 | 
	
	
	
		
		
			
			 
				
				New template functions
			 
			
			
			12 Feb 2025 - (in calibre 7.26) 
		
	
		
		
		
		
		
		
		
		
		
		
		
			
 Last edited by chaley; 02-16-2025 at 07:56 AM.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#161 | 
| 
			
			
			
			 want to learn what I want 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,681 
				Karma: 7908443 
				Join Date: Sep 2020 
				
				
				
				Device: none 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Interesting updates, thank you! I noticed that running: 
		
	
		
		
			Code: 
	program: make_url_extended('https', 'en.wikipedia.org', '/w/index.php', 'search', field('author'))
on Template tester (good link): https://en.wikipedia.org/w/index.php...B2+Machiavelli on new Template dialog for custom search: https://en.wikipedia.org/w/index.php...%2BMachiavelli  
		 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#162 | |
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525 
				Karma: 8065948 
				Join Date: Jan 2010 
				Location: Notts, England 
				
				
				Device: Kobo Libra 2 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 The problem is that the L&F / Book details dialog *knows* it is for authors only, and in fact doesn't even have the rest of the metadata. Historically, because L&F / Book details knows it is for authors, to simplify things for the expected use case the author is URL-encoded before it gets to the template. Thas is why the template Code: 
	https://www.wikipedia.org/w/index.php?search={author}
If you want to use make_url_extended() there then you must use the variant where you control whether the query value is encoded (again) during URL construction. Code: 
	program:
	qs = query_string('search', $author, 2);
	make_url_extended('https', 'wikepedia.com', '/w/index.php', qs)
This discrepency is why the new custom column link generation feature offers the item value unencoded, URL-encoded with '+' for spaces, and URL-encoded with %20 for spaces. Bottom line: you can't use the same template in L&F/ BD as you use in the new custom column web link feature.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#163 | |
| 
			
			
			
			 Custom User Title 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,358 
				Karma: 79528341 
				Join Date: Oct 2018 
				Location: Canada 
				
				
				Device: Kobo Libra H2O, formerly Aura HD 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	EDIT: Explain above.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#164 | 
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525 
				Karma: 8065948 
				Join Date: Jan 2010 
				Location: Notts, England 
				
				
				Device: Kobo Libra 2 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#165 | 
| 
			
			
			
			 want to learn what I want 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,681 
				Karma: 7908443 
				Join Date: Sep 2020 
				
				
				
				Device: none 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			At the moment I'm trying to figure how a deepseek query could be made using just a url. Not sure it's possible. :\ 
		
	
		
		
		
		
		
		
		
		
		
		
		
			This add-on works fine on browser context menu: https://addons.mozilla.org/en-US/fir.../ask-deepseek/ Spoiler: 
 
		Last edited by Comfy.n; 02-12-2025 at 04:36 PM.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
            
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| A few questions... (template language, mainly) | Clem2605 | Library Management | 2 | 12-30-2020 04:25 AM | 
| Template Language | phossler | Calibre | 8 | 01-12-2016 05:37 PM | 
| Help needed with template language | Mamaijee | Devices | 12 | 02-19-2013 02:52 AM | 
| Help with template language | Pepin33 | Calibre | 8 | 11-11-2012 09:32 AM | 
| Template language question | BookJunkieLI | Library Management | 7 | 02-02-2012 07:55 PM |