Class: IsoDoc::Mpfd::HtmlConvert

Inherits:
HtmlConvert
  • Object
show all
Includes:
BaseConvert
Defined in:
lib/isodoc/mpfd/html_convert.rb

Overview

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

Constant Summary

Constants included from BaseConvert

BaseConvert::FRONT_CLAUSE, BaseConvert::SECTIONS_XPATH, BaseConvert::TERM_CLAUSE

Instance Method Summary collapse

Methods included from BaseConvert

#annex_name, #annex_name_lbl, #annex_names, #annex_names1, #annex_naming, #clause, #clause_names, #clause_parse_title, #container_names, #convert1, #fileloc, #i18n_init, #initial_anchor_names, #metadata_init, #middle, #ol_depth, #preface, #sect_names, #termdef_parse, #terms_defs, #terms_defs_title

Constructor Details

#initialize(options) ⇒ HtmlConvert

Returns a new instance of HtmlConvert.



11
12
13
14
# File 'lib/isodoc/mpfd/html_convert.rb', line 11

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

Instance Method Details

#default_file_locations(_options) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/isodoc/mpfd/html_convert.rb', line 26

def default_file_locations(_options)
  {
    htmlstylesheet: html_doc_path("htmlstyle.scss"),
    htmlcoverpage: html_doc_path("html_rsd_titlepage.html"),
    htmlintropage: html_doc_path("html_rsd_intro.html"),
    scripts: html_doc_path("scripts.html"),
  }
end

#default_fonts(options) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/isodoc/mpfd/html_convert.rb', line 18

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

#googlefontsObject



35
36
37
38
39
40
41
# File 'lib/isodoc/mpfd/html_convert.rb', line 35

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

#make_body(xml, docxml) ⇒ Object



43
44
45
46
47
48
49
50
# File 'lib/isodoc/mpfd/html_convert.rb', line 43

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



52
53
54
55
56
57
58
59
# File 'lib/isodoc/mpfd/html_convert.rb', line 52

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