Module: SilkLayout

Defined in:
lib/silk_layout.rb,
lib/silk_layout/version.rb,
lib/silk_layout/css/rule.rb,
lib/silk_layout/html/node.rb,
lib/silk_layout/css/parser.rb,
lib/silk_layout/layout/box.rb,
lib/silk_layout/css/cascade.rb,
lib/silk_layout/html/parser.rb,
lib/silk_layout/layout/root.rb,
lib/silk_layout/css/selector.rb,
lib/silk_layout/layout/engine.rb,
lib/silk_layout/layout/inline.rb,
lib/silk_layout/css/properties.rb,
lib/silk_layout/layout/context.rb,
lib/silk_layout/render/painter.rb,
lib/silk_layout/css/computed_style.rb,
lib/silk_layout/layout/box_builder.rb,
lib/silk_layout/layout/flex_layout.rb,
lib/silk_layout/layout/block_layout.rb,
lib/silk_layout/render/font_library.rb,
lib/silk_layout/render/pdf_renderer.rb,
lib/silk_layout/layout/inline_formatter.rb,
lib/silk_layout/layout/formatting_builder.rb

Defined Under Namespace

Modules: CSS, HTML, Layout, Render

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.render_document(html_document, out, url: nil) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/silk_layout.rb', line 48

def self.render_document(html_document, out, url: nil)
  dom, stylesheets = SilkLayout::HTML::Parser.parse_document(html_document, url: url)
  rules = SilkLayout::CSS::Parser.parse_all(stylesheets)
  box_tree = SilkLayout::Layout::Engine.layout(dom, rules)

  SilkLayout::Render::PdfRenderer.render(box_tree, out)
end