Module: Jekyll::Html
- Defined in:
- lib/jekyll-html.rb,
lib/jekyll-html/end_tag.rb,
lib/jekyll-html/start_tag.rb
Defined Under Namespace
Classes: EndTag, StartTag
Class Method Summary
collapse
Class Method Details
.generate_end_tag(tag_content) ⇒ Object
38
39
40
41
42
43
44
45
46
|
# File 'lib/jekyll-html.rb', line 38
def generate_end_tag(tag_content)
raise('Tag content cannot be null!') if tag_content.nil?
raise('Tag content cannot be empty!') if tag_content.empty?
content = tag_content.split(' ')
raise('Splitted content cannot be empty!') if content.empty?
"</#{content[0]}>"
end
|
.generate_start_tag(tag_content) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/jekyll-html.rb', line 13
def generate_start_tag(tag_content)
raise('Tag content cannot be null!') if tag_content.nil?
raise('Tag content cannot be empty!') if tag_content.empty?
content = tag_content.split(' ')
raise('Splitted content cannot be empty!') if content.empty?
result = ''
content.each do |target|
targetContent = target.split('=')
if targetContent.length != 2
result += target + ' '
next
end
key = targetContent[0]
value = targetContent[1].tr('_', ' ')
result += "#{key}=\"#{value}\"\""
end
"<#{result[0, result.length - 1]}>"
end
|