Module: IsoDoc::Ieee::BaseConvert

Included in:
HtmlConvert, WordConvert
Defined in:
lib/isodoc/ieee/base_convert.rb

Instance Method Summary collapse

Instance Method Details

#clause_attrs(node) ⇒ Object



7
8
9
# File 'lib/isodoc/ieee/base_convert.rb', line 7

def clause_attrs(node)
  { id: node["id"], type: node["type"] }
end

#example_label(_node, div, name) ⇒ Object



58
59
60
61
62
63
64
# File 'lib/isodoc/ieee/base_convert.rb', line 58

def example_label(_node, div, name)
  return if name.nil?

  div.p class: "example-title" do |p|
    name.children.each { |n| parse(n, p) }
  end
end

#middle_clause(_docxml = nil) ⇒ Object



28
29
30
31
# File 'lib/isodoc/ieee/base_convert.rb', line 28

def middle_clause(_docxml = nil)
  "//clause[parent::sections][not(@type = 'overview')]" \
    "[not(descendant::terms)][not(descendant::references)]"
end

#note_p_parse(node, div) ⇒ Object



37
38
39
40
41
42
43
44
45
46
# File 'lib/isodoc/ieee/base_convert.rb', line 37

def note_p_parse(node, div)
  name = node&.at(ns("./name"))&.remove
  div.p do |p|
    name and p.span class: "note_label" do |s|
      name.children.each { |n| parse(n, s) }
    end
    node.first_element_child.children.each { |n| parse(n, p) }
  end
  node.element_children[1..-1].each { |n| parse(n, div) }
end

#note_parse1(node, div) ⇒ Object



48
49
50
51
52
53
54
55
56
# File 'lib/isodoc/ieee/base_convert.rb', line 48

def note_parse1(node, div)
  name = node&.at(ns("./name"))&.remove
  name and div.p do |p|
    p.span class: "note_label" do |s|
      name.children.each { |n| parse(n, s) }
    end
  end
  node.children.each { |n| parse(n, div) }
end

#para_attrs(node) ⇒ Object



33
34
35
# File 'lib/isodoc/ieee/base_convert.rb', line 33

def para_attrs(node)
  super.merge(type: node["type"])
end

#scope(node, out, num) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/isodoc/ieee/base_convert.rb', line 17

def scope(node, out, num)
  out.div **attr_code(id: node["id"]) do |div|
    num = num + 1
    clause_name(node, node&.at(ns("./title")), div, nil)
    node.elements.each do |e|
      parse(e, div) unless e.name == "title"
    end
  end
  num
end

#top_element_render(elem, out) ⇒ Object



11
12
13
14
15
# File 'lib/isodoc/ieee/base_convert.rb', line 11

def top_element_render(elem, out)
  elem.name == "clause" && elem["type"] == "overview" and
    return scope(elem, out, 0)
  super
end