class Playbook::HTMLBlockCode
def preprocess(full_document)
def preprocess(full_document) full_document.gsub(/\[component (.*)\]/) do @string = Regexp.last_match(1) @default_height = "160" @attr = ["", @default_height] # Set src from attributes @string.gsub(/src="(.*?)"/) do @attr[0] = Regexp.last_match(1) end # Set height from attributes @string.gsub(/height="(.*?)"/) do @attr[1] = (Regexp.last_match(1) || @default_height) end %(\n<div class="uix-component-frame"><iframe scrolling="no" id="component-preview" src="#{@attr[0]}" width="100%" height="#{@attr[1]}"></iframe><a href="#{@attr[0]}" target="_blank" class="uix-component-link">View component</a></div>\n) end end