module Jekyll::HTML

Constants

VERSION

Public Class Methods

generate_end_tag(tag_content) click to toggle source
# 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) click to toggle source
# 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|
    target_content = target.split("=")
    if target_content.length != 2
      result += target + " "
      next
    end

    key = target_content[0]
    value = target_content[1].tr("_", " ")

    result += "#{key}=\"#{value}\"\""
  end

  "<#{result[0, result.length - 1]}>"
end