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('[#"^$\+\-,\.:;&|\[\]()]', ' ');
28 subfield.textContent.replace('\s{2,}', ' ');
31 BLOCK normalize_authors;
32 link_term = link_term _ ' ' _ sf;
33 sf_raw = PROCESS normalize_qterm;
34 qterm = qterm _ ' ' _ sf_raw;
38 BLOCK build_author_links;
39 FOR node IN ctx.marc_xml.findnodes(xpath);
40 author_cnt = author_cnt + 1;
41 contrib_ref = '#schemacontrib' _ author_cnt;
42 iprop = ''; # schema.org item type / property
43 link_term = ''; # Linked term (e.g. Personal name + Fuller form of name)
44 supp_term = ''; # Supplementary terms
45 qterm = ''; # Search query
50 tag = node.getAttribute('tag');
51 FOR subfield IN node.childNodes;
53 NEXT UNLESS subfield.nodeName == "subfield";
54 code = subfield.getAttribute('code');
56 relcode = subfield.textContent.substr(0,3);
57 tlabels.push( relators.$relcode || label );
60 tlabels.push( subfield.textContent() );
65 linked_fields = [subfield.textContent()];
68 NEXT UNLESS code.match('[a-z]');
69 sf = subfield.textContent | html;
71 # Only Persons have birth/death dates in schema.org
72 # Match personal/corporate/conference MODS subfields
73 IF tag.substr(1,2) == '00';
74 IF code.match('[abcqu]');
75 PROCESS normalize_authors;
78 IF subfield.textContent.match('^\s*\d{4}');
79 birthdate = subfield.textContent.replace('^\s*(\d{4}).*$', '$1');
81 IF subfield.textContent.match('-\d{4}.*$');
82 deathdate = subfield.textContent.replace('^\s*.{4}\-(\d{4}).*$', '$1');
85 sf_raw = PROCESS normalize_qterm;
86 qterm = qterm _ sf_raw;
88 ELSIF tag.substr(1,2) == '10';
89 IF code.match('[abcdn]');
90 PROCESS normalize_authors;
92 ELSIF code.match('[acdeq]');
93 PROCESS normalize_authors;
96 supp_term = supp_term _ ' ' _ sf;
99 url = mkurl(ctx.opac_root _ '/results', {query => qterm.replace('^\s*(.*?)\s*$', '$1'), qtype => 'author'}, stop_parms.merge(expert_search_parms, general_search_parms, browse_search_parms, facet_search_parms));
100 tlabel = tlabels.join(', ');
102 author_type = (tlabel || label) | html;
106 IF tag.substr(1,2) == '10' && args.schema.itemtype && args.schema.itemtype.match('MusicAlbum');
107 iprop = ' typeof="MusicGroup" property="byArtist"';
108 ELSIF tag.substr(1,2) == '00';
109 iprop = ' typeof="Person" property="author"';
111 iprop = ' typeof="Organization" property="author"';
113 ELSIF type == 'added';
114 IF tag.substr(1,2) == '00';
115 iprop = ' typeof="Person" property="contributor';
117 iprop = ' typeof="Organization" property="contributor';
120 iprop = iprop _ ' http://id.loc.gov/vocabulary/relators/' _ relcode;
124 authtml = ' <span class="rdetail-author-div"' _ iprop _ ' resource="' _ contrib_ref _ '"><a href="' _ url _ '"><span resource="' _ contrib_ref _ '">';
125 IF iprop; authtml = authtml _ '<span property="name">'; END;
126 authtml = authtml _ link_term.replace('^\s+', '');
127 IF iprop; authtml = authtml _ '</span>'; END;
129 authtml = authtml _ ' <span property="birthDate">' _ birthdate _ '</span>-';
132 authtml = authtml _ '<span property="deathDate">' _ deathdate _ '</span>';
134 authtml = authtml _ '</span></a>'; # End search link
136 # Display supplemental terms (mostly about the author's work)
138 authtml = authtml _ ' ' _ supp_term;
141 # Display linked 880 fields
142 FOREACH link880 IN graphics;
145 diratt = ' dir="' _ link880.dir _ '"';
147 authtml = authtml _ ' <span class="graphic880"' _ diratt _ '>';
148 link880.value | html;
149 authtml = authtml _ '</span>';
151 authtml = authtml _ ' (<span property="description">' _ author_type _ '</span>). ';
152 authtml = authtml _ '</span>'; # End author span
153 authlist.push(authtml);
158 <div class='rdetail_authors_div'>
159 [%- FOREACH author IN authors;
160 NEXT UNLESS author.xpath;
162 PROCESS build_author_links(
163 xpath=author.xpath, label=author.label, type=author.type
166 FOREACH authtml IN authlist;