When asserting that we are publishing an ISBN, move the "(pbk.)"
and similar such matter outside of the schema.org <span property="isbn">
element.
See "The walking dead" in the sample dataset for an example.
Signed-off-by: Dan Scott <dscott@laurentian.ca>
args.isbns = [];
FOR isbn IN xml.findnodes('//*[@tag="020"]/*[@code="a"]');
- args.isbns.push(isbn.textContent);
+ args.isbns.push(isbn.textContent.trim);
END;
args.upcs = [];
FOR upc IN xml.findnodes('//*[@tag="024"]/*[@code="a"]');
- args.upcs.push(upc.textContent);
+ args.upcs.push(upc.textContent.trim);
END;
args.upc = args.upcs.0; # use first UPC as the default
args.issns = [];
FOR sub IN xml.findnodes('//*[@tag="022"]/*[@code="a"]');
- args.issns.push(sub.textContent);
+ args.issns.push(sub.textContent.trim);
END;
args.issn = (args.issns.size) ? args.issn.0 : '';
<h2 id='rdetail_record_details'>[% l("Record details") %]</h2>
<ul>
- [%- IF attrs.isbns.0; FOR isbn IN attrs.isbns %]
+ [%- IF attrs.isbns.0;
+ FOR isbn IN attrs.isbns;
+ isbn_extra = '';
+ IF (matches = isbn.match('^(.+?)(\s.+)$'));
+ isbn = matches.0;
+ isbn_extra = matches.1;
+ END;
+ %]
<li class='rdetail_isbns'>
<strong class='rdetail_label'>[% l('ISBN:'); %]</strong>
- <span class='rdetail_value' property='isbn'>[% isbn | html %]</span>
+ <span class='rdetail_value' property='isbn'>[% isbn | html %]</span>[% isbn_extra | html %]
</li>
[%- END %]
[%- END %]