lib/nistbib/nist_bibliography.rb in nistbib-0.1.0 vs lib/nistbib/nist_bibliography.rb in nistbib-0.1.1
- old
+ new
@@ -15,10 +15,18 @@
# @param code [String] the NIST standard Code to look up (e..g "8200")
# @param year [String] the year the standard was published (optional)
# @param opts [Hash] options; restricted to :all_parts if all-parts reference is required
# @return [String] Relaton XML serialisation of reference
- def get(code, year, opts)
+ def get(code, year = nil, opts = {})
+ if year.nil?
+ /^(?<code1>[^:]+):(?<year1>[^:]+)$/ =~ code
+ unless code1.nil?
+ code = code1
+ year = year1
+ end
+ end
+
code += '-1' if opts[:all_parts]
ret = nistbib_get1(code, year, opts)
return nil if ret.nil?
ret.to_most_recent_reference unless year || opts[:keep_year]
ret.to_all_parts if opts[:all_parts]
\ No newline at end of file