Class: IsoDoc::ITU::PdfConvert

Inherits:
PdfConvert
  • Object
show all
Includes:
BaseConvert
Defined in:
lib/isodoc/itu/pdf_convert.rb

Overview

A Converter implementation that generates PDF HTML output, and a document schema encapsulation of the document for validation

Constant Summary

Constants included from BaseConvert

BaseConvert::ELSEWHERE_TERMS, BaseConvert::FRONT_CLAUSE, BaseConvert::HERE_TERMS

Instance Method Summary collapse

Methods included from BaseConvert

#annex_name, #biblio_list, #cleanup, #eref_parse, #fileloc, #get_eref_linkend, #i18n_init, #info, #initial_anchor_names, #load_yaml, #metadata_init, #noniso_bibitem_entry, #norm_ref, #norm_ref_preface, #preface, #split_bibitems, #term_cleanup, #term_defs_boilerplate, #termdef_parse, #termdef_parse1, #terms_parse

Constructor Details

#initialize(options) ⇒ PdfConvert

Returns a new instance of PdfConvert.



10
11
12
13
# File 'lib/isodoc/itu/pdf_convert.rb', line 10

def initialize(options)
  @libdir = File.dirname(__FILE__)
  super
end

Instance Method Details

#convert1(docxml, filename, dir) ⇒ Object



15
16
17
18
19
# File 'lib/isodoc/itu/pdf_convert.rb', line 15

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

#default_file_locations(_options) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/isodoc/itu/pdf_convert.rb', line 33

def default_file_locations(_options)
  {
    htmlstylesheet: html_doc_path("htmlstyle.scss"),
    htmlcoverpage: html_doc_path("html_itu_titlepage.html"),
    htmlintropage: html_doc_path("html_itu_intro.html"),
    scripts_pdf: html_doc_path("scripts.pdf.html"),
  }
end

#default_fonts(options) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/isodoc/itu/pdf_convert.rb', line 25

def default_fonts(options)
  {
    bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Open Sans",sans-serif'),
    headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Open Sans",sans-serif'),
    monospacefont: '"Space Mono",monospace'
  }
end

#googlefontsObject



42
43
44
45
46
# File 'lib/isodoc/itu/pdf_convert.rb', line 42

def googlefonts()
  <<~HEAD.freeze
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,800|Space+Mono:400,700" rel="stylesheet">
  HEAD
end

#html_toc(docxml) ⇒ Object



21
22
23
# File 'lib/isodoc/itu/pdf_convert.rb', line 21

def html_toc(docxml)
  docxml
end

#make_body(xml, docxml) ⇒ Object



48
49
50
51
52
53
54
55
# File 'lib/isodoc/itu/pdf_convert.rb', line 48

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

#make_body3(body, docxml) ⇒ Object



57
58
59
60
61
62
63
64
65
# File 'lib/isodoc/itu/pdf_convert.rb', line 57

def make_body3(body, docxml)
  body.div **{ class: "main-section" } do |div3|
    abstract docxml, div3
    preface docxml, div3
    middle docxml, div3
    footnotes div3
    comments div3
  end
end