class Parchment::ODT::Style
Constants
- ALIGNMENT_CONVERSION
Because the OpenOffice standard uses ‘start’, ‘end’, etc.
- TEXT_PROPERTIES
Public Class Methods
new(node)
click to toggle source
# File lib/parchment/formats/odt/style.rb, line 21 def initialize(node) @node = node @node.attributes.map { |k, v| [k, v.value] }.each do |prop| prop_name = prop[0].gsub('-', '_') instance_variable_set("@#{prop_name}", prop[1]) end instance_variable_set("@id", @name) @node.children.each do |style_child| case style_child.name when 'paragraph-properties' if style_child.attributes['text-align'] @text_align = ALIGNMENT_CONVERSION[style_child.attributes['text-align'].value.to_sym] end when 'text-properties' TEXT_PROPERTIES.each do |prop| style_attr = style_child.attributes[prop] if style_attr value = style_attr.value value = value.to_i if prop == 'font-size' instance_variable_set("@#{prop.gsub('-', '_')}", value) end end end end end