app/mixin_logic/metadata_helper.rb in umlaut-4.0.3 vs app/mixin_logic/metadata_helper.rb in umlaut-4.1.0.pre.alpha.1

- old
+ new

@@ -72,11 +72,11 @@ # Change ampersands to 'and' for consistency, we see it both ways. title.gsub!(/\&/, ' and ') if options[:normalize_ampersand] # remove non-alphanumeric, excluding apostrophe - title.gsub!(/[^\w\s\']/, ' ') if options[:remove_punctuation] + title.gsub!(/[^[[:alnum:]][[:space:]]\']/, ' ') if options[:remove_punctuation] # apostrophe not to space, just eat it. title.gsub!(/[\']/, '') if options[:remove_punctuation] && ! options[:keep_apostrophes] # compress whitespace @@ -339,12 +339,18 @@ end # Look at weird bad OpenURLs, use heuristics to see if the 'title' probably # represents a journal rather than a book. A guess at best, based on the bad # data we've seen, sigh. - def title_is_serial?(rft) - rft.format != "book" && - ( rft.metadata['jtitle'].present? || %w{journal article}.include?(rft.metadata["genre"]) ) && - rft.metadata['btitle'].blank? + def title_is_serial?(rft) + ( rft.format != "book" && rft.format != "dissertation") && + ( rft.metadata["btitle"].blank? ) && + ( %w{journal article}.include?(rft.metadata["genre"]) || + rft.metadata['jtitle'].present? || + (rft.metadata["genre"].blank? && rft.metadata["issn"].present?) + ) end + # Mark it a module function so it can be called as a utility as + # MetadataHelper.title_is_serial?(referent) + module_function :title_is_serial? end