Sha256: d0d141085ecb2c8dc81fe23a571310f6c4034e3de60e01e9ee888f55cb9f0033
Contents?: true
Size: 984 Bytes
Versions: 41
Compression:
Stored size: 984 Bytes
Contents
# frozen_string_literal: true module OoxmlParser # Class for parsing `w:fldSimple` tags class FieldSimple < OOXMLDocumentObject # @return [String] instruction value attr_reader :instruction # @return [Array<ParagraphRun>] instruction value attr_reader :runs def initialize(parent: nil) @runs = [] super end # Parse FieldSimple object # @param node [Nokogiri::XML:Element] node to parse # @return [FieldSimple] result of parsing def parse(node) node.attributes.each do |key, value| case key when 'instr' @instruction = value.value.to_s end end node.xpath('*').each do |node_child| case node_child.name when 'r' @runs << ParagraphRun.new(parent: self).parse(node_child) end end self end # @return [True, False] is field simple page numbering def page_numbering? instruction.include?('PAGE') end end end
Version data entries
41 entries across 41 versions & 1 rubygems