Sha256: 7b84f06e09c5725f702b58eb620c887593412fa6a70f3fd2643b011277a672fb
Contents?: true
Size: 1020 Bytes
Versions: 5
Compression:
Stored size: 1020 Bytes
Contents
module RelatonW3c class W3cBibliographicItem < RelatonBib::BibliographicItem TYPES = %w[ candidateRecommendation groupNote proposedEditedRecommendation proposedRecommendation recommendation retired workingDraft ].freeze attr_reader :doctype # @param doctype [String] def initialize(**args) if args[:doctype] && !TYPES.include?(args[:doctype]) warn "[relaton-w3c] invalid document type: #{args[:doctype]}" end @doctype = args.delete :doctype super **args end # @param builder [Nokogiri::XML::Builder, NilClass] # @param opts [Hash] # @option opts [TrueClass, FalseClass, NilClass] bibdata def to_xml(builder = nil, **opts) super builder, **opts do |b| if opts[:bibdata] && doctype b.ext do |e| e.doctype doctype if doctype end end end end # @return [Hash] def to_hash hash = super hash["doctype"] = doctype if doctype hash end end end
Version data entries
5 entries across 5 versions & 1 rubygems