3 PROCESS "opac/parts/relators.tt2";
9 xpath => '//*[@tag="100"]|//*[@tag="110"]|//*[@tag="111"]'
12 label => l('Added Author'),
13 xpath => '//*[@tag="700"]|//*[@tag="710"]|//*[@tag="711"]'
17 xpath => '//*[@tag="508"]'
20 label => l('Author Notes: '),
21 xpath => '' # Comes from added content...
25 BLOCK build_author_links;
26 FOR node IN ctx.marc_xml.findnodes(xpath);
34 tag = node.getAttribute('tag');
35 FOR subfield IN node.childNodes;
36 NEXT UNLESS subfield.nodeName == "subfield";
37 code = subfield.getAttribute('code');
39 relcode = subfield.textContent.substr(0,3);
40 tlabel = relators.$relcode || label;
44 linked_fields = [subfield.textContent()];
47 NEXT UNLESS code.match('[a-z]');
48 sf = subfield.textContent | html;
49 IF code.match('[acdq]');
50 sf_raw = subfield.textContent.replace('[#"^$\+\-,\.:;&|\[\]()]', ' ');
51 qterm = qterm _ ' ' _ sf_raw;
53 # Only Persons have birth/death dates in schema.org
54 IF code.match('d') && tag.substr(1,2) == '00';
55 IF subfield.textContent.match('^\s*\d{4}');
56 birthdate = subfield.textContent.replace('^\s*(\d{4}).*$', '$1');
58 IF subfield.textContent.match('-\d{4}\s*$');
59 deathdate = subfield.textContent.replace('^\s*.{4}\-(\d{4})\s*$', '$1');
62 term = term _ ' ' _ sf;
65 url = mkurl(ctx.opac_root _ '/results', {query => qterm, qtype => 'author'}, ['page', 'expand']);
66 author_type = (tlabel || label) | html;
70 IF args.schema.itemtype && args.schema.itemtype.match('MusicAlbum');
71 iprop = ' itemtype="http://schema.org/MusicGroup" itemscope itemprop="byArtist"';
73 iprop = ' itemtype="http://schema.org/Person" itemscope itemprop="author"';
75 ELSIF type == 'added';
76 iprop = ' itemprop="contributor"';
78 '<a href="' _ url _ '"' _ iprop _ '>';
79 IF iprop; '<span itemprop="name">'; END;
80 term.replace('^\s+', '');
81 IF iprop; '</span>'; END;
83 ' <span itemprop="birthDate">' _ birthdate _ '</span>-';
86 '<span itemprop="deathDate">' _ deathdate _ '</span>';
89 FOREACH link880 IN graphics;
92 diratt = ' dir="' _ link880.dir _ '"';
94 ' <span class="graphic880"' _ diratt _ '>';
98 ' (' _ author_type _ '). ';
103 <div class='rdetail_authors_div'>
104 [%- FOREACH author IN authors;
105 NEXT UNLESS author.xpath;
106 links = PROCESS build_author_links(
107 xpath=author.xpath, label=author.label, type=author.type
109 IF links.match('\S') %]
110 <span class='rdetail-author-div'>[% links %]</span>