Sha256: bd6cd7faecaf9bef5378017573d2a8f3fb7e63a63a33750fb12a46bb34b3bbf8
Contents?: true
Size: 1.06 KB
Versions: 7
Compression:
Stored size: 1.06 KB
Contents
module Sablon module Processor class SectionProperties def self.process(xml_node, env) processor = new(xml_node) processor.write_properties(env.section_properties) end def initialize(xml_node) @properties_node = xml_node.at_xpath(".//w:sectPr") end def write_properties(properties = {}) return unless properties["start_page_number"] self.start_page_number = properties["start_page_number"] end def start_page_number pg_num_type && pg_num_type["w:start"] end def start_page_number=(number) find_or_add_pg_num_type["w:start"] = number end private def find_or_add_pg_num_type pg_num_type || begin node = Nokogiri::XML::Node.new "w:pgNumType", @properties_node.document @properties_node.children.after node node end end def pg_num_type @pg_num_type ||= @properties_node.at_xpath(".//w:pgNumType") end end end end
Version data entries
7 entries across 7 versions & 1 rubygems