Class: IsoDoc::Ogc::HtmlConvert

Inherits:
HtmlConvert
  • Object
show all
Includes:
BaseConvert
Defined in:
lib/isodoc/ogc/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::MIDDLE_CLAUSE, BaseConvert::REQ_TBL_ATTR, BaseConvert::SUBMITTINGORGS

Instance Method Summary collapse

Methods included from BaseConvert

#abstract, #anchor_names, #annex_name, #cleanup, #conformance, #error_parse, #example_parse, #fileloc, #foreword, #info, #initial_anchor_names, #keywords, #load_yaml, #middle, #middle_section_asset_names, #permission_anchor_names, #permission_label, #permission_parse, #preface_names, #recommend_name_parse, #recommend_table_attr, #recommendation_anchor_names, #recommendation_label, #recommendation_parse, #requirement_anchor_names, #requirement_label, #requirement_parse, #submitters, #submittingorgs, #term_cleanup, #term_defs_boilerplate

Constructor Details

#initialize(options) ⇒ HtmlConvert

Returns a new instance of HtmlConvert.



13
14
15
16
17
18
# File 'lib/isodoc/ogc/html_convert.rb', line 13

def initialize(options)
  @libdir = File.dirname(__FILE__)
  super
  #FileUtils.cp html_doc_path('logo.jpg'), "logo.jpg"
  #@files_to_delete << "logo.jpg"
end

Instance Method Details

#admonition_class(node) ⇒ Object



49
50
51
52
53
54
55
56
# File 'lib/isodoc/ogc/html_convert.rb', line 49

def admonition_class(node)
  case node["type"]
  when "important" then "Admonition.Important"
  when "warning" then "Admonition.Warning"
  else
    "Admonition"
  end
end

#default_file_locations(_options) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/isodoc/ogc/html_convert.rb', line 28

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

#default_fonts(options) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/isodoc/ogc/html_convert.rb', line 20

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

#googlefontsObject



41
42
43
44
45
46
47
# File 'lib/isodoc/ogc/html_convert.rb', line 41

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=Teko:300,400,500" rel="stylesheet">
  HEAD
end

#html_toc(docxml) ⇒ Object



67
68
69
# File 'lib/isodoc/ogc/html_convert.rb', line 67

def html_toc(docxml)
  docxml
end

#make_body(xml, docxml) ⇒ Object



58
59
60
61
62
63
64
65
# File 'lib/isodoc/ogc/html_convert.rb', line 58

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



71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/isodoc/ogc/html_convert.rb', line 71

def make_body3(body, docxml)
  body.div **{ class: "main-section" } do |div3|
    @prefacenum = 0
    abstract docxml, div3
    keywords docxml, div3
    foreword docxml, div3
    submittingorgs docxml, div3
    submitters docxml, div3
    middle docxml, div3
    footnotes div3
    comments div3
  end
end

#metadata_init(lang, script, labels) ⇒ Object



37
38
39
# File 'lib/isodoc/ogc/html_convert.rb', line 37

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