Quote:
Originally Posted by correoparaappzz
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