Module: Context
- Defined in:
- lib/extensions/utils/block.rb
Overview
Helper methods handling whether to output inline content or a block. Will read the attributes of the current macro and output a HTML string that is either inline or a block (float-right).
Class Method Summary collapse
-
.format(attributes, target, pattern, label) ⇒ String
The raw HTML to be included in the target document.
Class Method Details
.format(attributes, target, pattern, label) ⇒ String
Returns the raw HTML to be included in the target document.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/extensions/utils/block.rb', line 10 def self.format(attributes, target, pattern, label) block = false block = true if attributes.key? 'block' if target[0] == "\:" block = true target[0] = '' end url = "#{pattern}/#{target}" html = if block if pattern == 'unknown' "<div style=\"float:right;padding-left:0.1em;\"><span class=\"label label-#{label}\" data-toggle=\"tooltip\" title=\"Missing config\">#{target}</span></div>" else "<div style=\"float:right;padding-left:0.1em;\"><a href=\"#{url}\"><span class=\"label label-#{label}\">#{target}</span></a></div>" end else if pattern == 'unknown' "<span class=\"label label-#{label}\" data-toggle=\"tooltip\" title=\"Missing config\">#{target}</span>" else "<a href=\"#{url}\"><span class=\"label label-#{label}\">#{target}</span></a>" end end html end |