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 tlabels.push( relators.$relcode || label );
59 tlabels.push( subfield.textContent() );
64 linked_fields = [subfield.textContent()];
67 NEXT UNLESS code.match('[a-z]');
68 sf = subfield.textContent | html;
70 # Only Persons have birth/death dates in schema.org
71 # Match personal/corporate/conference MODS subfields
72 IF tag.substr(1,2) == '00';
73 IF code.match('[abcqu]');
74 PROCESS normalize_authors;
77 IF subfield.textContent.match('^\s*\d{4}');
78 birthdate = subfield.textContent.replace('^\s*(\d{4}).*$', '$1');
80 IF subfield.textContent.match('-\d{4}.*$');
81 deathdate = subfield.textContent.replace('^\s*.{4}\-(\d{4}).*$', '$1');
84 sf_raw = PROCESS normalize_qterm;
85 qterm = qterm _ sf_raw;
87 ELSIF tag.substr(1,2) == '10';
88 IF code.match('[abcdn]');
89 PROCESS normalize_authors;
91 ELSIF code.match('[acdeq]');
92 PROCESS normalize_authors;
95 supp_term = supp_term _ ' ' _ sf;
98 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));
99 tlabel = tlabels.join(', ');
101 author_type = (tlabel || label) | html;
105 IF tag.substr(1,2) == '10' && args.schema.itemtype && args.schema.itemtype.match('MusicAlbum');
106 iprop = ' typeof="MusicGroup" property="byArtist"';
107 ELSIF tag.substr(1,2) == '00';
108 iprop = ' typeof="Person" property="author"';
110 iprop = ' typeof="Organization" property="author"';
112 ELSIF type == 'added';
113 IF tag.substr(1,2) == '00';
114 iprop = ' typeof="Person" property="contributor';
116 iprop = ' typeof="Organization" property="contributor';
119 iprop = iprop _ ' http://id.loc.gov/vocabulary/relators/' _ relcode;
123 authtml = ' <span class="rdetail-author-div"' _ iprop _ ' resource="' _ contrib_ref _ '"><a href="' _ url _ '"><span resource="' _ contrib_ref _ '">';
124 IF iprop; authtml = authtml _ '<span property="name">'; END;
125 authtml = authtml _ link_term.replace('^\s+', '');
126 IF iprop; authtml = authtml _ '</span>'; END;
128 authtml = authtml _ ' <span property="birthDate">' _ birthdate _ '</span>-';
131 authtml = authtml _ '<span property="deathDate">' _ deathdate _ '</span>';
133 authtml = authtml _ '</span></a>'; # End search link
135 # Display supplemental terms (mostly about the author's work)
137 authtml = authtml _ ' ' _ supp_term;
140 # Display linked 880 fields
141 FOREACH link880 IN graphics;
144 diratt = ' dir="' _ link880.dir _ '"';
146 authtml = authtml _ ' <span class="graphic880"' _ diratt _ '>';
147 link880.value | html;
148 authtml = authtml _ '</span>';
150 authtml = authtml _ ' (<span property="description">' _ author_type _ '</span>). ';
151 authtml = authtml _ '</span>'; # End author span
152 authlist.push(authtml);
157 <div class='rdetail_authors_div'>
158 [%- FOREACH author IN authors;
159 NEXT UNLESS author.xpath;
161 PROCESS build_author_links(
162 xpath=author.xpath, label=author.label, type=author.type
165 FOREACH authtml IN authlist;