class RubyMarkup

Please note that this is an experimental version of RubyMarkup. It currently supports very few tags and does not support attributes. For more information, please visit christianjr.github.io/rbml

Public Class Methods

body() { || ... } click to toggle source

All the body tags currently supported

# File lib/rubymarkup.rb, line 18
def self.body
        $document << "<body>\n"
        # Allows for child elements
        yield
        $document << "</body>\n"
end
button(button) click to toggle source
# File lib/rubymarkup.rb, line 44
def self.button(button)
        $document << "<button>#{button}</button>\n"
end
deploy(file) click to toggle source

Deploys it to the destination

# File lib/rubymarkup.rb, line 59
def self.deploy(file)
        $document << "</html>"
        puts "Deploying to #{file}..."
        File.open file, "w" do |file|
                file.write $document
        end
        puts "Successfully deployed to #{file}"
end
embed(script) click to toggle source

Allows you to embed javascript as a string

# File lib/rubymarkup.rb, line 55
def self.embed(script)
        $document << "#{script}\n"
end
h1(h1) click to toggle source
# File lib/rubymarkup.rb, line 24
def self.h1(h1)
        $document << "<h1>#{h1}</h1>\n"
end
h2(h2) click to toggle source
# File lib/rubymarkup.rb, line 27
def self.h2(h2)
        $document << "<h2>#{h2}</h2>\n"
end
h3(h3) click to toggle source
# File lib/rubymarkup.rb, line 30
def self.h3(h3)
        $document << "<h3>#{h3}</h3>\n"
end
head() { || ... } click to toggle source

All the head tags currently supported

# File lib/rubymarkup.rb, line 8
def self.head
        $document << "<head>\n"
        # Allows for child elements
        yield
        $document << "</head>\n"
end
li(li) click to toggle source
# File lib/rubymarkup.rb, line 41
def self.li(li)
        $document << "<li>#{li}</li>\n"
end
p(p) click to toggle source
# File lib/rubymarkup.rb, line 33
def self.p(p)
        $document << "<p>#{p}</p>\n"
end
script() { || ... } click to toggle source

End of body tags Basic javascript support

# File lib/rubymarkup.rb, line 49
def self.script
        $document << "<script>\n"
        yield
        $document << "</script>\n"
end
title(title) click to toggle source
# File lib/rubymarkup.rb, line 14
def self.title(title)
        $document << "<title>#{title}</title>\n"
end
ul() { || ... } click to toggle source
# File lib/rubymarkup.rb, line 36
def self.ul
        $document << "<ul>\n"
        yield # for list elements
        $document << "</ul>\n"
end