Module: RubyDocx::Convertor::Html
- Defined in:
- lib/ruby_docx/convertors/html.rb
Defined Under Namespace
Classes: Base, Br, Header, Hyperlink, Paragraph, Span, Table, Td, Th, Tr
Constant Summary collapse
- ROUTES =
{ default: 'Paragraph', h1: 'Header', h2: 'Header', h3: 'Header', h4: 'Header', h5: 'Header', h6: 'Header', a: 'Hyperlink' }
Class Method Summary collapse
Class Method Details
.convert(template, css_path = nil) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/ruby_docx/convertors/html.rb', line 25 def self.convert(template, css_path = nil) css = self.load_styles(css_path) doc = RubyDocx::Document.new body = Nokogiri::HTML(template).xpath('//body').first body.children.each { |child| doc.append self.create_node(child, css) } doc end |