Class: IsoDoc::MPFA::HtmlConvert
- Inherits:
-
HtmlConvert
- Object
- HtmlConvert
- IsoDoc::MPFA::HtmlConvert
- Includes:
- BaseConvert, Init
- Defined in:
- lib/isodoc/mpfa/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
- #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
- #make_body3(body, docxml) ⇒ Object
Methods included from Init
#fileloc, #i18n_init, #metadata_init, #xref_init
Methods included from BaseConvert
#clause, #clause_parse_title, #middle, #middle_clause, #ol_depth, #preface, #termdef_parse, #terms_defs
Constructor Details
#initialize(options) ⇒ HtmlConvert
Returns a new instance of HtmlConvert.
12 13 14 15 |
# File 'lib/isodoc/mpfa/html_convert.rb', line 12 def initialize() @libdir = File.dirname(__FILE__) super end |
Instance Method Details
#default_file_locations(_options) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/isodoc/mpfa/html_convert.rb', line 29 def default_file_locations() { htmlstylesheet: html_doc_path("htmlstyle.scss"), htmlcoverpage: html_doc_path("html_rsd_titlepage.html"), htmlintropage: html_doc_path("html_rsd_intro.html"), } end |
#default_fonts(options) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/isodoc/mpfa/html_convert.rb', line 19 def default_fonts() { bodyfont: ([:script] == "Hans" ? '"Source Han Sans",serif' : '"Titillium Web",sans-serif'), headerfont: ([:script] == "Hans" ? '"Source Han Sans",sans-serif' : '"Titillium Web",sans-serif'), monospacefont: '"Space Mono",monospace', normalfontsize: "15px", footnotefontsize: "0.9em", } end |
#googlefonts ⇒ Object
37 38 39 40 41 42 |
# File 'lib/isodoc/mpfa/html_convert.rb', line 37 def googlefonts " <link href=\"https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700\" rel=\"stylesheet\">\n <link href=\"https://fonts.googleapis.com/css?family=Titillium+Web:400,400i,700,700i\" rel=\"stylesheet\">\n HEAD\nend\n".freeze |
#make_body(xml, docxml) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/isodoc/mpfa/html_convert.rb', line 44 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
53 54 55 56 57 58 59 60 |
# File 'lib/isodoc/mpfa/html_convert.rb', line 53 def make_body3(body, docxml) body.div **{ class: "main-section" } do |div3| preface docxml, div3 middle docxml, div3 footnotes div3 comments div3 end end |