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



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

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_parsex(node, div) ⇒ Object

TODO kill



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

def note_p_parsex(node, div)
  name = node&.at(ns("./fmt-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_parse1x(node, div) ⇒ Object

TODO kill



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

def note_parse1x(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("./fmt-title")), div, nil)
    node.elements.each do |e|
      parse(e, div) unless e.name == "fmt-title"
    end
  end
  num
end

#span_parse(node, out) ⇒ Object



68
69
70
71
72
# File 'lib/isodoc/ieee/base_convert.rb', line 68

def span_parse(node, out)
  node["class"] == "fmt-obligation" and
    node["class"] = "obligation"
  super
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