@@ -6,20 +6,19 @@ class Level < OpenXml::Docx::Element
66 tag :lvl
77
88 with_namespace :w do
9- attribute :level , expects : :integer , displays_as : :ilvl
10- # The following are "UI attributes:" tplc is an entirely opaque
11- # Word "template code" and "tenative" just means it wasn't used but
12- # was generated anyway.
9+ attribute :level , expects : :integer , displays_as : :ilvl # required
10+ # tplc is an entirely opaque "Word template code" and is
11+ # "application-specific" according to the spec
1312 # attribute :tplc
14- # attribute :tentative
13+ attribute :tentative , expects : :boolean
1514 end
1615
1716 value_property :start
1817 value_property :number_format
19- # value_property :lvl_restart
18+ value_property :level_restart
2019 # value_property :p_style
2120 # value_property :is_lgl
22- # value_property :suff
21+ value_property :suffix
2322 value_property :level_text
2423 # value_property :lvl_pic_bullet_id
2524 value_property :alignment , as : :level_alignment
@@ -37,8 +36,14 @@ def property_xml(xml)
3736 return if props . none? ( &:render? )
3837
3938 props . each { |prop | prop . to_xml ( xml ) }
40- @paragraph_style . property_xml ( xml ) unless @paragraph_style . nil?
41- @character_style . property_xml ( xml ) unless @character_style . nil?
39+ end
40+
41+ def to_xml ( xml )
42+ xml [ "w" ] . public_send ( tag , xml_attributes ) {
43+ property_xml ( xml )
44+ @paragraph_style . property_xml ( xml ) unless @paragraph_style . nil?
45+ @character_style . property_xml ( xml ) unless @character_style . nil?
46+ }
4247 end
4348 end
4449 end
0 commit comments