class Slaw::Grammars::Schedules::Schedule
Public Instance Methods
schedule_id(heading_text, i)
click to toggle source
# File lib/slaw/grammars/schedules_nodes.rb, line 84 def schedule_id(heading_text, i) heading_text.downcase().strip().gsub(/[^a-z0-9]/i, '').gsub(/ +/, '') end
to_xml(b, idprefix=nil, i=1)
click to toggle source
# File lib/slaw/grammars/schedules_nodes.rb, line 88 def to_xml(b, idprefix=nil, i=1) # reset counters for this new schedule document Slaw::Grammars::Counters.reset! heading_text = self.schedule_title.heading_text if not heading_text heading_text = "Schedule" heading_text << " #{i}" if i > 1 end # the schedule id is derived from the heading schedule_id = self.schedule_id(heading_text, i) eId = "att_#{i}" b.attachment(eId: eId) { |b| schedule_title.to_xml(b, '', heading_text) b.doc_(name: "schedule") { |b| b.meta { |b| b.identification(source: "#slaw") { |b| b.FRBRWork { |b| b.FRBRthis(value: "#{WORK_URI}/!#{schedule_id}") b.FRBRuri(value: WORK_URI) b.FRBRalias(value: heading_text) b.FRBRdate(date: '1980-01-01', name: 'Generation') b.FRBRauthor(href: '#council') b.FRBRcountry(value: 'za') } b.FRBRExpression { |b| b.FRBRthis(value: "#{EXPRESSION_URI}/!#{schedule_id}") b.FRBRuri(value: EXPRESSION_URI) b.FRBRdate(date: '1980-01-01', name: 'Generation') b.FRBRauthor(href: '#council') b.FRBRlanguage(language: 'eng') } b.FRBRManifestation { |b| b.FRBRthis(value: "#{MANIFESTATION_URI}/!#{schedule_id}") b.FRBRuri(value: MANIFESTATION_URI) b.FRBRdate(date: Time.now.strftime('%Y-%m-%d'), name: 'Generation') b.FRBRauthor(href: '#slaw') } } } b.mainBody { |b| body.children.elements.each_with_index { |e| e.to_xml(b, eId + "__", i) } if body.is_a? Body } } } end