Class: Tags::TabsBlock

Inherits:
Liquid::Block
  • Object
show all
Defined in:
lib/tabs.rb

Instance Method Summary collapse

Instance Method Details

#convert(context) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/tabs.rb', line 9

def convert(context)
	liArray = context.gsub(/<li role="presentation" class="">(.+)<\/li>/)
	nextLine = "\n"
	tabOpenTag = nextLine + '<div class="tabs">' + nextLine
	ulOpenTag = nextLine + '<ul class="nav nav-tabs" role="tablist">' + nextLine
	tabContentOpenTag = nextLine + '<div class="tab-content">' + nextLine
	closedivTag = nextLine + '</div>' + nextLine
	ulCloseTag = nextLine + '</ul>' + nextLine
	lis = '' + nextLine
	liArray.each do|li|
		lis = lis + li + nextLine
	end		
	return tabOpenTag + ulOpenTag + lis + ulCloseTag + tabContentOpenTag +context.gsub(/<li role="presentation" class="">(.+)<\/li>/,'') + closedivTag + ulCloseTag + closedivTag
end

#render(context) ⇒ Object



5
6
7
8
# File 'lib/tabs.rb', line 5

def render(context)
			content = super(context)
			content = convert(content)
end