View Single Post
Old 02-21-2023, 05:18 PM   #25
isarl
Addict
isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.
 
Posts: 287
Karma: 2534928
Join Date: Nov 2022
Location: Canada
Device: Kobo Aura 2
Quote:
Originally Posted by Lys View Post
I think it was @chaley, because I'm pretty sure I ran in his & davidfor examples and discussion on how to use the template functions to create collections.

Indeed, I remember correctly: https://www.mobileread.com/forums/sh...d.php?t=347056
https://www.mobileread.com/forums/sh...d.php?t=346321
At a quick glance, the examples in these threads are trying to do a bit of extra stuff and so the author abbreviation gets lost in a bit of noise. Here's a template I just came up with which seems to work:

Code:
program:
  result = '';
  for a in 'author_sort' separator '&':
    result = list_join(', ', result, ',', substr(a, 0, 1), ',')
  rof
The for loop's value is the value of the last top expression in it, which for an assignment is the assigned value, in this case the final value of result. This will not return a value with a spurious comma at the end of the list, which I was getting when trying something similar using strcat().
isarl is offline   Reply With Quote