View Single Post
Old 11-10-2021, 10:09 PM   #2
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
As a first pass, the following will produce a value that is the first author plus the series:

Code:
program:
if $series then
   strcat(sublist($author_sort, 0, 1, '&'), '.', $series)
fi
With this you will get something like:

Code:
Butcher, Jim.The Dresden Files
And any book without a series will have nothing.

If you want to simply use the full author sort, then remove the use of the sublist function.

To get an entry for each author:

Code:
program:
program:
if $series then
    val = list_re($author_sort, ' & ', '^(.*)$', strcat('\1.', $series));
    val = re(val, ',', '_');
    val = re(val, ' & ', ',');
    val = re(val, '\.\.', '.') 
fi
For a series called "Some Series" with the author_sort of "Author, First & One, Other", this would produce "Author_ First.Some Series, One_ Other.Some Series". And in the tag browser you get the two entries.

The "re"s are to change the commas to underscores so the tags don't get split there. Then the ampersand to commas so they do. Then, if there a two dots together, change it to one so that you will get the hierarchy. This was a problem for authors like "Firstname I. Surname" which will be "Surname, Firstname I." and when the ".Series Name" is added, the hierarchy split doesn't happen.

It looks ugly, but is seems to work.
davidfor is offline   Reply With Quote