Class: Html2Doc::Ieee_Wp

Inherits:
Html2Doc show all
Defined in:
lib/html2doc/ieee_wp.rb,
lib/html2doc/ieee_wp/lists.rb

Instance Method Summary collapse

Instance Method Details

#list2para(list) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/html2doc/ieee_wp/lists.rb', line 3

def list2para(list)
  list.name == "ol" and return super
  return if list.xpath("./li").empty?

  list.xpath("./li/p").each do |p|
    p["class"] ||= "BulletedList"
  end
  list.xpath("./li").each do |l|
    l.name = "p"
    l["class"] ||= "BulletedList"
    next unless l.first_element_child&.name == "p"

    l["style"] ||= ""
    l["style"] += (l.first_element_child["style"]&.sub(/mso-list[^;]+;/, "") || "")
    l.first_element_child.replace(l.first_element_child.children)
  end
  list.replace(list.children)
end