lib/nistbib/nist_bibliographic_item.rb in nistbib-0.1.5 vs lib/nistbib/nist_bibliographic_item.rb in nistbib-0.1.6
- old
+ new
@@ -1,9 +1,9 @@
module NistBib
class NistBibliographicItem < RelatonBib::BibliographicItem
- # @return [NistBib::NistSeries, NilClass]
- attr_reader :nistseries
+ # @return [String]
+ attr_reader :doctype
# @return [Array<NistBib::Keyword>]
attr_reader :keyword
# @return [NistBib::CommentPeriod]
@@ -27,10 +27,11 @@
# @param extent [Array<Relaton::BibItemLocality>]
# @param accesslocation [Array<String>]
# @param classification [RelatonBib::Classification, NilClass]
# @param validity [RelatonBib:Validity, NilClass]
# @param fetched [Date, NilClass] default nil
+ # @param doctype [String]
# @param keyword [Array<NistBib::Keyword>]
# @param commentperiod [NistBib::CommentPeriod]
#
# @param dates [Array<Hash>]
# @option dates [String] :type
@@ -52,24 +53,26 @@
#
# @param relations [Array<Hash>]
# @option relations [String] :type
# @option relations [RelatonBib::BibliographicItem] :bibitem
# @option relations [Array<RelatonBib::BibItemLocality>] :bib_locality
- #
- # @param nistseries [Nist::NistSeries, NilClass]
def initialize(**args)
- @nistseries = args.delete :nistseries
+ @doctype = "stadard"
@keyword = args.delete(:keyword) || []
@commentperiod = args.delete :commentperiod
super
end
# @param builder [Nokogiri::XML::Builder]
- def to_xml(builder = nil)
- super builder, root: :bibitem, date_format: :short do |b|
- nistseries&.to_xml b
- keyword.each { |kw| kw.to_xml b }
- commentperiod&.to_xml b
+ def to_xml(builder = nil, **opts)
+ super builder, date_format: :short, **opts do |b|
+ if opts[:bibdata]
+ b.ext do
+ b.doctype doctype
+ keyword.each { |kw| kw.to_xml b }
+ commentperiod&.to_xml b
+ end
+ end
end
end
end
end