simplest solution is adding:
Quote:
strcat(authors, '<br>', field('publisher'));
|
at the end.
i've done a little explainer which hopefully adds clarity for you or anyone who passes by, but the important bit is above. these comments are probably best read in your template tester!
Quote:
program:
# ok so you know pound signs are comments
authors = field('authors');
publisher = field('publisher');
# these two lines let us call a metadata field by a normal name throughout the program. my "short
# answer" avoids needing this second line by using the built-in field() name instead of assigning
# a nickname, since we don't really transform publisher the way we transform the list of authors
num = count(authors, ' & ');
authors = sublist(authors, 0, 2, ' & ');
# counts the number of authors (we've told it to add one for every '&' sign)
# then reorganizes them into a list ("sublist")
authors = list_re(authors, ' & ', '(.+)', '<b>\1');
authors = re(authors, ' & ', ' <br>');
# these two perform search and replace on the list of authors to remove
# separators and add bold <b> & line break <br> tags in their place
authors = re(authors, '& &', ' <br>');
# this is for if there's accidentally two '&&' signs after the first S&R. it wasn't
# assigned a variable because it was the final output before, but now needs 'authors ='
# since we'll want this incorporated into 'authors' when we use it again below
# re(publisher, '& &', ' <br>'); --- you don't need this. never more than 1 publisher, so no '&&' to replace
# finally, we always 'print' whatever comes last, so you'll have to string everything together with strcat()
# i italicized the publisher to distinguish them but you can remove that if you want
strcat(authors, '<br>', '<i>', publisher)
|
without comments:
Quote:
program:
authors = field('authors');
publisher = field('publisher');
num = count(authors, ' & ');
authors = sublist(authors, 0, 2, ' & ');
authors = list_re(authors, ' & ', '(.+)', '<b>\1');
authors = re(authors, ' & ', ' <br>');
authors = re(authors, '& &', ' <br>');
strcat(authors, '<br>', '<i>', publisher)
|