Class: IsoDoc::Vsd::HtmlConvert
- Inherits:
-
HtmlConvert
- Object
- HtmlConvert
- IsoDoc::Vsd::HtmlConvert
- Defined in:
- lib/isodoc/vsd/html_convert.rb
Overview
A Converter implementation that generates HTML output, and a document schema encapsulation of the document for validation
Instance Method Summary collapse
- #convert1(docxml, filename, dir) ⇒ Object
- #default_file_locations(_options) ⇒ Object
- #default_fonts(options) ⇒ Object
- #googlefonts ⇒ Object
-
#initialize(options) ⇒ HtmlConvert
constructor
A new instance of HtmlConvert.
- #make_body(xml, docxml) ⇒ Object
- #metadata_init(lang, script, labels) ⇒ Object
Constructor Details
#initialize(options) ⇒ HtmlConvert
Returns a new instance of HtmlConvert.
11 12 13 14 |
# File 'lib/isodoc/vsd/html_convert.rb', line 11 def initialize() @libdir ||= File.dirname(__FILE__) super end |
Instance Method Details
#convert1(docxml, filename, dir) ⇒ Object
16 17 18 19 20 |
# File 'lib/isodoc/vsd/html_convert.rb', line 16 def convert1(docxml, filename, dir) FileUtils.cp html_doc_path('logo.png'), File.join(@localdir, "logo.png") @files_to_delete << File.join(@localdir, "logo.png") super end |
#default_file_locations(_options) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/isodoc/vsd/html_convert.rb', line 30 def default_file_locations() { htmlstylesheet: html_doc_path("htmlstyle.scss"), htmlcoverpage: html_doc_path("html_vsd_titlepage.html"), htmlintropage: html_doc_path("html_vsd_intro.html"), scripts: html_doc_path("scripts.html"), } end |
#default_fonts(options) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/isodoc/vsd/html_convert.rb', line 22 def default_fonts() { bodyfont: ([:script] == "Hans" ? '"SimSun",serif' : '"Overpass",sans-serif'), headerfont: ([:script] == "Hans" ? '"SimHei",sans-serif' : '"Overpass",sans-serif'), monospacefont: '"Space Mono",monospace' } end |
#googlefonts ⇒ Object
43 44 45 46 47 48 |
# File 'lib/isodoc/vsd/html_convert.rb', line 43 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"> HEAD end |
#make_body(xml, docxml) ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/isodoc/vsd/html_convert.rb', line 50 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
39 40 41 |
# File 'lib/isodoc/vsd/html_convert.rb', line 39 def (lang, script, labels) @meta = Metadata.new(lang, script, labels) end |