View Single Post
Old 04-01-2025, 08:21 AM   #826
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 correoparaappzz View Post
Q:What is supposed to happen with multiple authors?
A:authors separately

Q:Is the column supposed to be hierarchical?
A:yes

Q:why are you surrounding the first letters with "[" "]"
A:i like how it looks
I think this does what you want. To make a valid hierarchical item, in authors it replaces periods and commas, and in series it replaces periods. If you have commas in series names then you must replace those as well.
Code:
program:
	def first_letter(x):
		return strcat('[', substr(x, 0, 1), ']')
	fed;

# Replace periods with unicode "One Dot Leader" (․)
	period = '․';
# Replace commas with unicode "Small Comma" (﹐)
	comma = '﹐';

	if $series then
		series = strcat('.', first_letter($series), '.', re($series, '\.', period))
	else
		series = '.Standalone'
	fi;

	sep = '';
	result = '';
	for aut in 'authors':
		result = strcat(result, sep, first_letter(aut), '.', re(re(aut, '\.', period), ',', comma), series);
		sep = ','
	rof;
	result
chaley is offline   Reply With Quote