Module: IsoDoc::Bipm::BaseConvert

Included in:
HtmlConvert, PdfConvert
Defined in:
lib/isodoc/bipm/base_convert.rb

Constant Summary collapse

TOP_ELEMENTS =
IsoDoc::Function::ToWordHtml::TOP_ELEMENTS +
" | //doccontrol[@displayorder]".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#jcgmObject

Returns the value of attribute jcgm.



6
7
8
# File 'lib/isodoc/bipm/base_convert.rb', line 6

def jcgm
  @jcgm
end

Instance Method Details

#blacksquare_parse(_node, out) ⇒ Object



41
42
43
# File 'lib/isodoc/bipm/base_convert.rb', line 41

def blacksquare_parse(_node, out)
  out << "&#x25a0;"
end

#configurationObject



8
9
10
# File 'lib/isodoc/bipm/base_convert.rb', line 8

def configuration
  Metanorma::Bipm.configuration
end

#convert1(docxml, filename, dir) ⇒ Object



15
16
17
18
19
# File 'lib/isodoc/bipm/base_convert.rb', line 15

def convert1(docxml, filename, dir)
  @jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/" \
                        "@acronym"))&.value == "JCGM"
  super
end

#error_parse(node, out) ⇒ Object



34
35
36
37
38
39
# File 'lib/isodoc/bipm/base_convert.rb', line 34

def error_parse(node, out)
  case node.name
  when "blacksquare" then blacksquare_parse(node, out)
  else super
  end
end

#middle_clause(_docxml) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/isodoc/bipm/base_convert.rb', line 21

def middle_clause(_docxml)
  if @jcgm
    "//clause[parent::sections][not(@type = 'scope')]" \
      "[not(descendant::terms)][not(descendant::references)]"
  else
    "//sections/*[not(local-name() = 'references')][not(.//references)]"
  end
end

#sections_namesObject



45
46
47
# File 'lib/isodoc/bipm/base_convert.rb', line 45

def sections_names
  super + %w[doccontrol]
end

#table_footnote?(node) ⇒ Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/isodoc/bipm/base_convert.rb', line 56

def table_footnote?(node)
  super && !node.ancestors.map(&:name).include?("quote")
end

#term_cleanup(docxml) ⇒ Object



30
31
32
# File 'lib/isodoc/bipm/base_convert.rb', line 30

def term_cleanup(docxml)
  @jcgm ? docxml : super
end

#top_element_render(elem, out) ⇒ Object



49
50
51
52
53
54
# File 'lib/isodoc/bipm/base_convert.rb', line 49

def top_element_render(elem, out)
  case elem.name
  when "doccontrol" then doccontrol elem, out
  else super
  end
end