module Govspeak class PostProcessor @extensions = [] class << self attr_reader :extensions end def self.process(html, govspeak_document) new(html, govspeak_document).output end def self.extension(title, &block) @extensions << [title, block] end extension("add class to last p of blockquote") do |document| document.css("blockquote p:last-child").map do |el| el[:class] = "last-child" end end extension("covert legislative list ul to ol") do |document| document.css(".legislative-list-wrapper").map do |el| el.inner_html = el.inner_html .sub("", "") .gsub("