module Slaw::Grammars::ZA::Postprocess
Public Instance Methods
postprocess(doc)
click to toggle source
# File lib/slaw/grammars/za/postprocess.rb, line 7 def postprocess(doc) Slaw::Parse::Blocklists.adjust_blocklists(doc) schedule_aliases(doc) doc end
schedule_aliases(doc)
click to toggle source
Correct aliases for schedules to use the full textual content of the heading element
# File lib/slaw/grammars/za/postprocess.rb, line 14 def schedule_aliases(doc) for hcontainer in doc.xpath('//xmlns:doc/xmlns:mainBody/xmlns:hcontainer[@name="schedule"]') heading = hcontainer.at_xpath('./xmlns:heading') frbr_alias = hcontainer.at_xpath('../../xmlns:meta/xmlns:identification/xmlns:FRBRWork/xmlns:FRBRalias') if heading and frbr_alias text = heading.xpath('.//text()').map(&:text).join('') || frbr_alias['value'] frbr_alias['value'] = text unless text.empty? end end end