class Muwu::RenderHtmlPartial::DocumentHtml
Attributes
destination[RW]
head_css_filename[RW]
head_css_method[RW]
head_js_filename[RW]
head_js_libraries[RW]
head_js_method[RW]
head_metadata[RW]
html_lang[RW]
html_title[RW]
project[RW]
tasks[RW]
Public Class Methods
new()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 28 def initialize @head_metadata = {} @tasks = [] end
Public Instance Methods
options()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 51 def options @project.options end
render()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 39 def render @destination.output_stream do render_tag_html_open @destination.padding_vertical(1) do render_head render_body end write_tag_html_close end end
render_body()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 56 def render_body @destination.padding_vertical(1) do write_tag_body_open render_body_manifest_tasks write_tag_body_close end end
render_body_manifest_tasks()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 65 def render_body_manifest_tasks @destination.padding_vertical(1) do @tasks.each do |task| task.render end end end
render_head()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 74 def render_head @destination.padding_vertical(1) do write_tag_head_open @destination.margin_indent do write_tag_title render_head_meta_tags render_head_css render_head_js end write_tag_head_close end end
render_head_css()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 88 def render_head_css case @head_css_method when :embed render_head_css_embed when :link render_head_css_link end end
render_head_css_embed()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 98 def render_head_css_embed write_tag_style_open write_css_if_manifest_exists write_tag_style_close end
render_head_css_link()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 105 def render_head_css_link write_tag_link_stylesheet end
render_head_js()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 110 def render_head_js case @head_js_method when :embed render_head_js_embed when :link render_head_js_link end end
render_head_js_embed()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 120 def render_head_js_embed write_tag_script_open @head_js_libraries.each do |library| write_js_library(library) end write_tag_script_close end
render_head_js_link()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 136 def render_head_js_link write_tag_script_src end
render_tag_html_open()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 153 def render_tag_html_open write_tag_doctype if @html_lang write_tag_html_open_lang else write_tag_html_open end end
write_css()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 172 def write_css @destination.write_inline SassC::Engine.new(File.read(@project.css_manifest_filename), syntax: :scss, load_paths: ['config/css']).render end
write_css_if_manifest_exists()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 163 def write_css_if_manifest_exists if @project.exceptions_include?(ProjectException::CssManifestFileNotFound) write_css_missing_comment else write_css end end
write_css_missing_comment()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 177 def write_css_missing_comment @destination.write_line "/*" @destination.write_line "#{ProjectException::CssManifestFileNotFound}" @destination.write_line " - CSS manifest file could not be found." @destination.write_line " - Expecting `#{project.css_manifest_filename}`" @destination.write_line "*/" end
write_js_library(library)
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 186 def write_js_library(library) @destination.write_inline RenderHtmlPartial::JsLibrary.new.find(library) end
write_tag_body_close()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 191 def write_tag_body_close @destination.write_line tag_body_close end
write_tag_body_open()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 196 def write_tag_body_open @destination.write_line tag_body_open end
write_tag_doctype()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 201 def write_tag_doctype @destination.write_line tag_doctype end
write_tag_head_close()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 206 def write_tag_head_close @destination.write_line tag_head_close end
write_tag_head_open()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 211 def write_tag_head_open @destination.write_line tag_head_open end
write_tag_html_close()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 216 def write_tag_html_close @destination.write_line tag_html_close end
write_tag_html_open()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 221 def write_tag_html_open @destination.write_line tag_html_open end
write_tag_html_open_lang()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 226 def write_tag_html_open_lang @destination.write_line tag_html_open_lang end
write_tag_link_stylesheet()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 231 def write_tag_link_stylesheet @destination.write_line tag_link_stylesheet end
write_tag_meta(key, value)
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 236 def write_tag_meta(key, value) @destination.write_line tag_meta(key, value) end
write_tag_meta_charset_utf8()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 241 def write_tag_meta_charset_utf8 @destination.write_line tag_meta_charset_utf8 end
write_tag_meta_generator()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 246 def write_tag_meta_generator @destination.write_line tag_meta_generator end
write_tag_meta_instance_date()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 256 def write_tag_meta_instance_date @destination.write_line tag_meta_instance_date end
write_tag_meta_viewport()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 251 def write_tag_meta_viewport @destination.write_line tag_meta_viewport end
write_tag_script_close()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 261 def write_tag_script_close @destination.write_line tag_script_close end
write_tag_script_open()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 266 def write_tag_script_open @destination.write_line tag_script_open end
write_tag_script_src()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 271 def write_tag_script_src @destination.write_line tag_script_src end
write_tag_style_close()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 276 def write_tag_style_close @destination.write_line tag_style_close end
write_tag_style_open()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 281 def write_tag_style_open @destination.write_line tag_style_open end
write_tag_title()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 286 def write_tag_title @destination.write_line tag_title end
Private Instance Methods
tag_body_close()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 295 def tag_body_close "</body>" end
tag_body_open()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 300 def tag_body_open "<body>" end
tag_doctype()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 305 def tag_doctype "<!DOCTYPE html>" end
tag_head_close()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 310 def tag_head_close "</head>" end
tag_head_open()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 315 def tag_head_open "<head>" end
tag_html_close()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 320 def tag_html_close "</html>" end
tag_html_open()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 325 def tag_html_open "<html>" end
tag_html_open_lang()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 330 def tag_html_open_lang "<html lang='#{@html_lang}'>" end
tag_link_stylesheet()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 335 def tag_link_stylesheet "<link rel='stylesheet' href='#{@head_css_filename}' type='text/css'>" end
tag_meta(key, value)
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 340 def tag_meta(key, value) "<meta name='#{key}' value='#{value}'>" end
tag_meta_charset_utf8()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 345 def tag_meta_charset_utf8 "<meta charset='UTF-8'>" end
tag_meta_generator()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 350 def tag_meta_generator "<meta name='generator' content='Muwu #{Muwu::VERSION}'>" end
tag_meta_instance_date()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 355 def tag_meta_instance_date "<meta name='date_of_this_edition' value='#{@project.instance_date}'>\n" end
tag_meta_viewport()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 360 def tag_meta_viewport "<meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=yes'>" end
tag_script_close()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 365 def tag_script_close "</script>" end
tag_script_open()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 370 def tag_script_open "<script>" end
tag_script_src()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 375 def tag_script_src "<script src='#{@head_js_filename}'></script>" end
tag_style_close()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 380 def tag_style_close "</style>" end
tag_style_open()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 385 def tag_style_open "<style>" end
tag_title()
click to toggle source
# File lib/muwu/render_html_partial/render_document_html.rb, line 390 def tag_title "<title>#{@html_title}</title>" end