Class: OMF::Web::Widget::Text::Maruku::WidgetElement

Inherits:
Object
  • Object
show all
Defined in:
lib/omf-web/widget/text/maruku.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wdescr) ⇒ WidgetElement

Returns a new instance of WidgetElement.



44
45
46
47
# File 'lib/omf-web/widget/text/maruku.rb', line 44

def initialize(wdescr)
  @wdescr = wdescr
  @widget = OMF::Web::Widget.create_widget(wdescr)
end

Instance Attribute Details

#widgetObject (readonly)

Returns the value of attribute widget.



42
43
44
# File 'lib/omf-web/widget/text/maruku.rb', line 42

def widget
  @widget
end

Instance Method Details

#node_typeObject



58
59
60
# File 'lib/omf-web/widget/text/maruku.rb', line 58

def node_type
  :widget
end

#to_htmlObject



49
50
51
52
53
54
55
56
# File 'lib/omf-web/widget/text/maruku.rb', line 49

def to_html
  content = @widget.content
  h = content.to_html
  if title = @widget.title
    h += "<div class='caption'>#{title}</div>"
  end
  ::REXML::Document.new("<div class='embedded'>#{h}</div>").root
end