View Single Post
Old 09-13-2025, 10:13 AM   #1
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,509
Karma: 8065348
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by un_pogaz View Post
Else, I worked of the idea and so here my proposal:
[/SPOILER]
FWIW: I'm currently implementing these changes to the base formatter.
  • ids = selected_books()
  • name = selected_cell(). Returns the lookup name.
  • A 'with' statement that changes the book the template is using for the statement's block. The same local variables are available to the inner and outer block.
Example:
Code:
program: 
	ids = selected_books();
	col = selected_column();
	res = '';
	for id in ids:
		with id:
			# prints information from the book with identifier 'id'
			print($title, field(col));
			res = (if res then res & ',' fi) & field(col);
			template('program: print("inside template", $title)')
		htiw
	rof;
	list_remove_duplicates(res, ',')
Internal template functions and stored templates called from inside the 'with' block use the book with id 'id'.

EDIT: I'm also going to implement "show_in_dialog()" that renders an html string.
chaley is offline   Reply With Quote