Permalink
Browse files

added issn registry

  • Loading branch information...
inukshuk committed Aug 4, 2012
1 parent 6162e0e commit f0b5173862ca16cb2f0d53a10ddbb49f9cdcacd8
Showing with 16 additions and 3 deletions.
  1. +2 −2 spec/independent_styles_spec.rb
  2. +5 −0 spec/repository_spec.rb
  3. +9 −1 spec/spec_helper.rb
@@ -1,7 +1,7 @@
Independents.each_pair do |id, (filename, path, style)|
describe "independent style #{id}" do
-
+
it "is a valid CSL 1.0 style" do
CSL.validate(path).should == []
end
@@ -77,7 +77,7 @@
style.macros.should have_key(node[:macro])
end
end
- end
+ end
end
end
View
@@ -11,4 +11,9 @@
it "does not contain any duplicate file names" do
(Independents.keys & Dependents.keys).should be_empty
end
+
+ # it "contains no duplicate ISSNs" do
+ # ISSN.select { |k,v| v.length > 1 }.should == []
+ # end
+
end
View
@@ -2,6 +2,8 @@
STYLE_ROOT = File.expand_path('../..', __FILE__)
+ISSN = Hash.new { |h,k| h[k] = [] }
+
def load_style(path)
filename = File.basename(path)
id = filename[0..-5]
@@ -11,7 +13,13 @@ def load_style(path)
rescue
# failed to parse the style. we'll report the error later
end
-
+
+ begin
+ ISSN[style.info.issn.to_s] << id if style.info.has_issn?
+ rescue
+ warn "Failed to extract ISSN of style #{id}"
+ end
+
[id, [filename, path, style]]
end

0 comments on commit f0b5173

Please sign in to comment.