File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ module Properties
1414require "openxml/docx/properties/string_property"
1515require "openxml/docx/properties/on_off_property"
1616require "openxml/docx/properties/toggle_property"
17+ require "openxml/docx/properties/explicit_toggle_property"
1718require "openxml/docx/properties/string_property"
1819require "openxml/docx/properties/container_property"
1920require "openxml/docx/properties/transparent_container_property"
Original file line number Diff line number Diff line change 11module OpenXml
22 module Docx
33 module Properties
4- class Bold < ToggleProperty
4+ class Bold < ExplicitToggleProperty
55 tag :b
66
77 end
Original file line number Diff line number Diff line change 1+ module OpenXml
2+ module Docx
3+ module Properties
4+ class ExplicitToggleProperty < ToggleProperty
5+
6+ def to_xml ( xml )
7+ return if value . nil?
8+ return xml [ "w" ] . public_send ( tag , "w:val" => value ) if value == false
9+ xml [ "w" ] . public_send ( tag )
10+ end
11+
12+ end
13+ end
14+ end
15+ end
Original file line number Diff line number Diff line change 11module OpenXml
22 module Docx
33 module Properties
4- class Italics < ToggleProperty
4+ class Italics < ExplicitToggleProperty
55 tag :i
66
77 end
Original file line number Diff line number Diff line change 1212
1313 with_value ( false ) do
1414 it_should_work
15- it_should_output ""
15+ it_should_output "<w:b w:val= \" false \" /> "
1616 end
1717
1818 with_value ( nil ) do
Original file line number Diff line number Diff line change 1212
1313 with_value ( false ) do
1414 it_should_work
15- it_should_output ""
15+ it_should_output "<w:i w:val= \" false \" /> "
1616 end
1717
1818 with_value ( nil ) do
You can’t perform that action at this time.
0 commit comments