I have found that the above program does not work. It works when I make a custom column, but when I put the code in the template box, on the book details settings page, everything defaults to the default.
I thought it worked, but found that the author links for books from ao3 and ff.net are saved in the "manage authors" settings. So I was mistaken. I don't know how that came to be, when I started this code all author links pointed to wikipedia. Which is the calibre default author link on the book details page.
From what I can gather, the field('publisher') is not being accessed in the book details template box.
This is the final code I tested in custom columns. But I want it to work in the book details template, is that possible?
Code:
program:
default = strcat("https://en.wikipedia.org/w/index.php?search=", field('author'));
ao3 = strcat("http://archiveofourown.org/works/search?work_search[creator]=", field('author'));
ffnet = strcat("https://www.fanfiction.net/search.php?keywords=", field('author'), "&ready=1&type=writer");
rkfic = strcat("http://www.rockfic.com/user_profile.php?user_id=", field('#authorid'), "&user=", field('author'), "&m=c");
author_lookup =
switch(
field('publisher'),
'archiveofourown.org',
ao3,
'www.fanfiction.net',
ffnet,
'rockfic',
rkfic,
default
);