lib/rrtf/formatting.rb in rrtf-1.2.0 vs lib/rrtf/formatting.rb in rrtf-1.3.0

- old
+ new

@@ -330,9 +330,36 @@ else RRTF::RTFError.fire("Invalid shading '#{value}'.") end # case end, "to_rtf" => lambda{ |value, document| value.rtf_formatting(document) unless value.nil? } + }, + "tabs" => { + "default" => nil, + "from_user" => lambda do |value| + case value + when Array + value.collect do |t| + case t + when Hash + RRTF::TabStyle.new(t) + when RRTF::TabStyle + t + else + RRTF::RTFError.fire("Invalid tab '#{t}'.") + end # case + end # collect + when Hash + [RRTF::TabStyle.new(value)] + when RRTF::TabStyle + [value] + else + RRTF::RTFError.fire("Invalid border '#{value}'.") + end # case + end, + "to_rtf" => lambda do |value, document| + value.collect{ |tab| tab.rtf_formatting }.join(' ') unless value.nil? + end } }.freeze # Generates attribute accessors for all paragraph attributes when the module # is included in another module or class.