Permalink
Browse files

Permit selected styles to have duplicate ISSNs

  • Loading branch information...
1 parent 5385cae commit d1b2bc891bbf8076138470475f7640218799e29b @inukshuk inukshuk committed Aug 12, 2012
Showing with 29 additions and 13 deletions.
  1. +3 −3 spec/repository_spec.rb
  2. +26 −10 spec/spec_helper.rb
View
@@ -13,7 +13,7 @@
end
it "contains no duplicate ISSNs" do
- ISSN.select { |k,v| v.length > 1 }.should == []
+ ISSN.select { |_, styles| styles.length > 1 }.should == {}
end
-
-end
+
+end
View
@@ -4,6 +4,20 @@
ISSN = Hash.new { |h,k| h[k] = [] }
+# These styles are ignored when checking for duplicate ISSNs
+ISSN_FILTER = %w{
+ science science-without-title molecular-psychiatry
+ molecular-psychiatry-letters frontiers-in-aging-neuroscience
+ frontiers-in-behavioral-neuroscience frontiers-in-evolutionary-neuroscience
+ frontiers-in-human-neuroscience frontiers-in-integrative-neuroscience
+ frontiers-in-molecular-neuroscience frontiers-in-neural-circuits
+ frontiers-in-neuroanatomy frontiers-in-neuroenergetics
+ frontiers-in-neuroengineering frontiers-in-neuroinformatics
+ frontiers-in-neurorobotics frontiers-in-synaptic-neuroscience
+ frontiers-in-systems-neuroscience frontiers-in-cellular-neuroscience
+ frontiers-in-computational-neuroscience
+}
+
def load_style(path)
filename = File.basename(path)
id = filename[0..-5]
@@ -15,17 +29,19 @@ def load_style(path)
end
begin
- if style.info.has_issn?
- Array(style.info.issn).each do |issn|
- ISSN[issn.to_s] << id
- end
- end
+ unless ISSN_FILTER.include?(id)
+ if style.info.has_issn?
+ Array(style.info.issn).each do |issn|
+ ISSN[issn.to_s] << id
+ end
+ end
- if style.info.has_eissn?
- Array(style.info.eissn).each do |issn|
- ISSN[issn.to_s] << id
- end
- end
+ if style.info.has_eissn?
+ Array(style.info.eissn).each do |issn|
+ ISSN[issn.to_s] << id
+ end
+ end
+ end
rescue
warn "Failed to extract ISSN of style #{id}"
end

0 comments on commit d1b2bc8

Please sign in to comment.