qterm = '';
iprop = '';
tlabel = '';
+ birthdate = '';
+ deathdate = '';
+ graphics = [];
+ tag = node.getAttribute('tag');
FOR subfield IN node.childNodes;
NEXT UNLESS subfield.nodeName == "subfield";
code = subfield.getAttribute('code');
relcode = subfield.textContent.substr(0,3);
tlabel = relators.$relcode || label;
END;
+ IF code == '6';
+ target_field = tag;
+ linked_fields = [subfield.textContent()];
+ get_linked_880s;
+ END;
NEXT UNLESS code.match('[a-z]');
sf = subfield.textContent | html;
- term = term _ ' ' _ sf;
IF code.match('[acdq]');
sf_raw = subfield.textContent.replace('[#"^$\+\-,\.:;&|\[\]()]', ' ');
qterm = qterm _ ' ' _ sf_raw;
END;
+ # Only Persons have birth/death dates in schema.org
+ IF code.match('d') && tag.substr(1,2) == '00';
+ IF subfield.textContent.match('^\s*\d{4}');
+ birthdate = subfield.textContent.replace('^\s*(\d{4}).*$', '$1');
+ END;
+ IF subfield.textContent.match('-\d{4}\s*$');
+ deathdate = subfield.textContent.replace('^\s*.{4}\-(\d{4})\s*$', '$1');
+ END;
+ ELSE;
+ term = term _ ' ' _ sf;
+ END;
END;
url = mkurl(ctx.opac_root _ '/results', {query => qterm, qtype => 'author'}, ['page', 'expand']);
author_type = (tlabel || label) | html;
# schema.org changes
IF type == 'author';
- iprop = ' property="accountablePerson"';
+ IF args.schema.itemtype && args.schema.itemtype.match('MusicAlbum');
+ iprop = ' typeof="http://schema.org/MusicGroup" property="byArtist"';
+ ELSIF tag.substr(1,2) == '00';
+ iprop = ' typeof="http://schema.org/Person" property="author"';
+ ELSE;
+ iprop = ' typeof="http://schema.org/Organization" property="author"';
+ END;
ELSIF type == 'added';
- iprop = ' property="contributor"';
+ IF tag.substr(1,2) == '00';
+ iprop = ' typeof="http://schema.org/Person" property="contributor"';
+ ELSE;
+ iprop = ' typeof="http://schema.org/Organization" property="contributor"';
+ END;
+ END;
+ '<a href="' _ url _ '"' _ iprop _ '>';
+ IF iprop; '<span property="name">'; END;
+ term.replace('^\s+', '');
+ IF iprop; '</span>'; END;
+ IF birthdate;
+ ' <span property="birthDate">' _ birthdate _ '</span>-';
+ END;
+ IF deathdate;
+ '<span property="deathDate">' _ deathdate _ '</span>';
+ END;
+ '</a>';
+ FOREACH link880 IN graphics;
+ diratt = '';
+ IF link880.dir;
+ diratt = ' dir="' _ link880.dir _ '"';
+ END;
+ ' <span class="graphic880"' _ diratt _ '>';
+ link880.value | html;
+ '</span>';
END;
- '<a href="' _ url _ '"' _ iprop _ '>' _ term.replace('^\s+', '') _ '</a> (' _ author_type _ '). ';
+ ' (' _ author_type _ '). ';
END;
END;
%]
xpath = xpath || '//*[starts-with(@tag,"5")]';
FOR node IN ctx.marc_xml.findnodes(xpath);
all_content = [];
+ graphics = [];
FOR subfield IN node.childNodes;
NEXT UNLESS subfield.nodeName == "subfield";
code = subfield.getAttribute('code');
+ IF code == '6';
+ linked_fields = [subfield.textContent()];
+ target_field = node.getAttribute('tag');
+ get_linked_880s;
+ END;
NEXT UNLESS code.match('[a-z]');
all_content.push(subfield.textContent);
END;
total_contents = all_content.join(" ").replace('\s+$', '');
%] [% total_contents;
IF total_contents.size; "<br/>"; END;
+ FOREACH link880 IN graphics;
+ '<div class="graphic880"' _ link880.dir _ '>';
+ link880.value | html;
+ '</div>';
+ END;
END;
END
%]
xpath = xpath || '//*[starts-with(@tag,"6")]';
FOR node IN ctx.marc_xml.findnodes(xpath);
all_terms = [];
+ graphics = [];
FOR subfield IN node.childNodes;
NEXT UNLESS subfield.nodeName == "subfield";
code = subfield.getAttribute('code');
+ IF code == '6';
+ linked_fields = [subfield.textContent()];
+ target_field = node.getAttribute('tag');
+ get_linked_880s;
+ END;
NEXT UNLESS code.match('[a-z]');
IF code.match('[vxyz]'); " > "; END;
# at this point, we actually have a partial term to use.
<a href="[% mkurl(ctx.opac_root _ '/results', {qtype=>'subject', query=>total_term}, stop_parms); %]">[% single_term %]</a>
[%- END;
IF all_terms.size; "<br/>"; END;
+ FOREACH link880 IN graphics;
+ '<div class="graphic880"' _ link880.dir _ '>';
+ link880.value | html;
+ '</div>';
+ END;
END;
END
%]
<li id='rdetail_edition'>
<strong class='rdetail_label'>[% l("Edition:") %]</strong>
<span class='rdetail_value'>[% attrs.edition | html %]</span>
+ [%-
+ FOR entry IN attrs.graphic_editions;
+ FOR alt IN entry.graphic;
+ diratt = "";
+ IF alt.dir;
+ diratt = ' dir="' _ alt.dir _ '"';
+ END;
+ -%]
+ <div class="graphic880 rdetail_value"[% diratt %]>
+ [% alt.value | html %]
+ </div>
+ [%-
+ END;
+ END;
+ -%]
</li>
[%- END %]
[%- IF attrs.publisher %]
[%- IF attrs.pubdate; %]
<span property="datePublished">[% attrs.pubdate | html; %]</span>
[%- END; %]
+ [%-
+ IF attrs.graphic_pubinfos.size > 0;
+ FOR entry IN attrs.graphic_pubinfos;
+ FOR alt IN entry.graphic;
+ diratt = "";
+ IF alt.dir;
+ diratt = ' dir="' _ alt.dir _ '"';
+ END;
+ -%]
+ <div class="graphic880"[% diratt %]>
+ [% alt.value | html %]
+ </div>
+ [%-
+ END;
+ END;
+ END
+ -%]
</li>
[%- END %]
</ul>