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}.*$');
59 deathdate = subfield.textContent.replace('^\s*.{4}\-(\d{4}).*$', '$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"';
72 ELSIF tag.substr(1,2) == '00';
73 iprop = ' itemtype="http://schema.org/Person" itemscope itemprop="author"';
75 iprop = ' itemtype="http://schema.org/Organization" itemscope itemprop="author"';
77 ELSIF type == 'added';
78 IF tag.substr(1,2) == '00';
79 iprop = ' itemtype="http://schema.org/Person" itemscope itemprop="contributor"';
81 iprop = ' itemtype="http://schema.org/Organization" itemscope itemprop="contributor"';
84 '<a href="' _ url _ '"' _ iprop _ '>';
85 IF iprop; '<span itemprop="name">'; END;
86 term.replace('^\s+', '');
87 IF iprop; '</span>'; END;
89 ' <span itemprop="birthDate">' _ birthdate _ '</span>-';
92 '<span itemprop="deathDate">' _ deathdate _ '</span>';
95 FOREACH link880 IN graphics;
98 diratt = ' dir="' _ link880.dir _ '"';
100 ' <span class="graphic880"' _ diratt _ '>';
101 link880.value | html;
104 ' (' _ author_type _ '). ';
109 <div class='rdetail_authors_div'>
110 [%- FOREACH author IN authors;
111 NEXT UNLESS author.xpath;
112 links = PROCESS build_author_links(
113 xpath=author.xpath, label=author.label, type=author.type
115 IF links.match('\S') %]
116 <span class='rdetail-author-div'>[% links %]</span>