Module: IsoDoc::Bipm::BaseConvert

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

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

#configurationObject



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

def configuration
  Metanorma::Bipm.configuration
end

#convert1(docxml, filename, dir) ⇒ Object



12
13
14
15
16
17
# File 'lib/isodoc/bipm/base_convert.rb', line 12

def convert1(docxml, filename, dir)
  @jcgm = docxml.at(ns(<<~XPATH))&.text == "JCGM"
    //bibdata/contributor[role/description = 'committee']/organization/subdivision[@type = 'Committee']/identifier[not(@type = 'full')]
  XPATH
  super
end

#middle_clause(_docxml) ⇒ Object



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

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

#table_footnote?(node) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/isodoc/bipm/base_convert.rb', line 32

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

#term_cleanup(docxml) ⇒ Object



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

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