Module: IsoDoc::Acme::BaseConvert

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

Instance Method Summary collapse

Instance Method Details

#annex_name(annex, name, div) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/isodoc/acme/base_convert.rb', line 23

def annex_name(annex, name, div)
  div.h1 **{ class: "Annex" } do |t|
    t << "#{anchor(annex['id'], :label)} "
    t.br
    t.b do |b|
      name&.children&.each { |c2| parse(c2, b) }
    end
  end
end

#cleanup(docxml) ⇒ Object



42
43
44
45
# File 'lib/isodoc/acme/base_convert.rb', line 42

def cleanup(docxml)
  super
  term_cleanup(docxml)
end

#convert1(docxml, filename, dir) ⇒ Object



8
9
10
11
12
# File 'lib/isodoc/acme/base_convert.rb', line 8

def convert1(docxml, filename, dir)
  FileUtils.cp html_doc_path('logo.jpg'), File.join(@localdir, "logo.jpg")
  @files_to_delete << File.join(@localdir, "logo.jpg")
  super
end

#fileloc(loc) ⇒ Object



38
39
40
# File 'lib/isodoc/acme/base_convert.rb', line 38

def fileloc(loc)
  File.join(File.dirname(__FILE__), loc)
end

#i18n_init(lang, script) ⇒ Object



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

def i18n_init(lang, script)
  super
  @annex_lbl = "Appendix"
end

#info(isoxml, out) ⇒ Object



18
19
20
21
# File 'lib/isodoc/acme/base_convert.rb', line 18

def info(isoxml, out)
  @meta.security isoxml, out
  super
end

#make_body(xml, docxml) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/isodoc/acme/base_convert.rb', line 56

def make_body(xml, docxml)
  body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72", "xml:lang": "EN-US", class: "container" }
  xml.body **body_attr do |body|
    make_body1(body, docxml)
    make_body2(body, docxml)
    make_body3(body, docxml)
  end
end

#metadata_init(lang, script, labels) ⇒ Object



14
15
16
# File 'lib/isodoc/acme/base_convert.rb', line 14

def (lang, script, labels)
  @meta = Metadata.new(lang, script, labels)
end

#term_cleanup(docxml) ⇒ Object



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

def term_cleanup(docxml)
  docxml.xpath("//p[@class = 'Terms']").each do |d|
    h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
    h2.add_child("&nbsp;")
    h2.add_child(d.remove)
  end
  docxml
end