3 PROCESS "opac/parts/relators.tt2";
10 xpath => '//*[@tag="100"]|//*[@tag="110"]|//*[@tag="111"]'
13 label => l('Added Author'),
14 xpath => '//*[@tag="700"]|//*[@tag="710"]|//*[@tag="711"]'
18 xpath => '//*[@tag="508"]'
21 label => l('Author Notes: '),
22 xpath => '' # Comes from added content...
26 BLOCK build_author_links;
27 FOR node IN ctx.marc_xml.findnodes(xpath);
28 author_cnt = author_cnt + 1;
29 contrib_ref = '#schemacontrib' _ author_cnt;
37 tag = node.getAttribute('tag');
38 FOR subfield IN node.childNodes;
39 NEXT UNLESS subfield.nodeName == "subfield";
40 code = subfield.getAttribute('code');
42 relcode = subfield.textContent.substr(0,3);
43 tlabel = relators.$relcode || label;
47 linked_fields = [subfield.textContent()];
50 NEXT UNLESS code.match('[a-z]');
51 sf = subfield.textContent | html;
52 IF code.match('[acdq]');
53 sf_raw = subfield.textContent.replace('[#"^$\+\-,\.:;&|\[\]()]', ' ');
54 qterm = qterm _ ' ' _ sf_raw;
56 # Only Persons have birth/death dates in schema.org
57 IF code.match('d') && tag.substr(1,2) == '00';
58 IF subfield.textContent.match('^\s*\d{4}');
59 birthdate = subfield.textContent.replace('^\s*(\d{4}).*$', '$1');
61 IF subfield.textContent.match('-\d{4}.*$');
62 deathdate = subfield.textContent.replace('^\s*.{4}\-(\d{4}).*$', '$1');
65 term = term _ ' ' _ sf;
68 url = mkurl(ctx.opac_root _ '/results', {query => qterm, qtype => 'author'}, ['page', 'expand']);
69 author_type = (tlabel || label) | html;
73 IF tag.substr(1,2) == '10' && args.schema.itemtype && args.schema.itemtype.match('MusicAlbum');
74 iprop = ' typeof="MusicGroup" property="byArtist"';
75 ELSIF tag.substr(1,2) == '00';
76 iprop = ' typeof="Person" property="author"';
78 iprop = ' typeof="Organization" property="author"';
80 ELSIF type == 'added';
81 IF tag.substr(1,2) == '00';
82 iprop = ' typeOf="Person" property="contributor"';
84 iprop = ' typeOf="Organization" property="contributor"';
87 '<span' _ iprop _ ' resource="' _ contrib_ref _ '"><a href="' _ url _ '">';
88 IF iprop; '<span property="name" about="' _ contrib_ref _ '">'; END;
89 term.replace('^\s+', '');
90 IF iprop; '</span>'; END;
92 ' <span property="birthDate" about="' _ contrib_ref _ '">' _ birthdate _ '</span>-';
95 '<span property="deathDate" about="' _ contrib_ref _ '">' _ deathdate _ '</span>';
97 '</a>'; # End search link
98 FOREACH link880 IN graphics;
101 diratt = ' dir="' _ link880.dir _ '"';
103 ' <span class="graphic880"' _ diratt _ '>';
104 link880.value | html;
107 ' (<span property="description" about="' _ contrib_ref _ '">' _ author_type _ '</span>). ';
108 '</span>'; # End author span
113 <div class='rdetail_authors_div'>
114 [%- FOREACH author IN authors;
115 NEXT UNLESS author.xpath;
116 links = PROCESS build_author_links(
117 xpath=author.xpath, label=author.label, type=author.type
119 IF links.match('\S') %]
120 <span class='rdetail-author-div'>[% links %]</span>