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 normalize_qterm;
27 subfield.textContent.replace('[#"^$\+\-,\.:;&|\[\]()]', ' ');
30 BLOCK normalize_authors;
31 link_term = link_term _ ' ' _ sf;
32 sf_raw = PROCESS normalize_qterm;
33 qterm = qterm _ ' ' _ sf_raw;
37 BLOCK build_author_links;
38 FOR node IN ctx.marc_xml.findnodes(xpath);
39 author_cnt = author_cnt + 1;
40 contrib_ref = '#schemacontrib' _ author_cnt;
41 iprop = ''; # schema.org item type / property
42 link_term = ''; # Linked term (e.g. Personal name + Fuller form of name)
43 supp_term = ''; # Supplementary terms
44 qterm = ''; # Search query
49 tag = node.getAttribute('tag');
50 FOR subfield IN node.childNodes;
52 NEXT UNLESS subfield.nodeName == "subfield";
53 code = subfield.getAttribute('code');
55 relcode = subfield.textContent.substr(0,3);
56 tlabel = relators.$relcode || label;
60 linked_fields = [subfield.textContent()];
63 NEXT UNLESS code.match('[a-z]');
64 sf = subfield.textContent | html;
66 # Only Persons have birth/death dates in schema.org
67 # Match personal/corporate/conference MODS subfields
68 IF tag.substr(1,2) == '00';
69 IF code.match('[abcqu]');
70 PROCESS normalize_authors;
73 IF subfield.textContent.match('^\s*\d{4}');
74 birthdate = subfield.textContent.replace('^\s*(\d{4}).*$', '$1');
76 IF subfield.textContent.match('-\d{4}.*$');
77 deathdate = subfield.textContent.replace('^\s*.{4}\-(\d{4}).*$', '$1');
80 sf_raw = PROCESS normalize_qterm;
81 qterm = qterm _ sf_raw;
83 ELSIF tag.substr(1,2) == '10';
84 IF code.match('[abcdn]');
85 PROCESS normalize_authors;
87 ELSIF code.match('[acdeq]');
88 PROCESS normalize_authors;
91 supp_term = supp_term _ ' ' _ sf;
94 url = mkurl(ctx.opac_root _ '/results', {query => qterm.replace('^\s*(.*?)\s*$', '$1'), qtype => 'author'}, stop_parms.merge(expert_search_parms, general_search_parms));
95 author_type = (tlabel || label) | html;
99 IF tag.substr(1,2) == '10' && args.schema.itemtype && args.schema.itemtype.match('MusicAlbum');
100 iprop = ' typeof="MusicGroup" property="byArtist"';
101 ELSIF tag.substr(1,2) == '00';
102 iprop = ' typeof="Person" property="author"';
104 iprop = ' typeof="Organization" property="author"';
106 ELSIF type == 'added';
107 IF tag.substr(1,2) == '00';
108 iprop = ' typeof="Person" property="contributor"';
110 iprop = ' typeof="Organization" property="contributor"';
113 authtml = ' <span class="rdetail-author-div"' _ iprop _ ' resource="' _ contrib_ref _ '"><a href="' _ url _ '"><span resource="' _ contrib_ref _ '">';
114 IF iprop; authtml = authtml _ '<span property="name">'; END;
115 authtml = authtml _ link_term.replace('^\s+', '');
116 IF iprop; authtml = authtml _ '</span>'; END;
118 authtml = authtml _ ' <span property="birthDate">' _ birthdate _ '</span>-';
121 authtml = authtml _ '<span property="deathDate">' _ deathdate _ '</span>';
123 authtml = authtml _ '</span></a>'; # End search link
125 # Display supplemental terms (mostly about the author's work)
127 authtml = authtml _ ' ' _ supp_term;
130 # Display linked 880 fields
131 FOREACH link880 IN graphics;
134 diratt = ' dir="' _ link880.dir _ '"';
136 authtml = authtml _ ' <span class="graphic880"' _ diratt _ '>';
137 link880.value | html;
138 authtml = authtml _ '</span>';
140 authtml = authtml _ ' (<span property="description">' _ author_type _ '</span>). ';
141 authtml = authtml _ '</span>'; # End author span
142 authlist.push(authtml);
147 <div class='rdetail_authors_div'>
148 [%- FOREACH author IN authors;
149 NEXT UNLESS author.xpath;
151 PROCESS build_author_links(
152 xpath=author.xpath, label=author.label, type=author.type
155 FOREACH authtml IN authlist;