Markaby is a small
Ruby
A ruby is a pinkish red to blood-red colored gemstone, a variety of the mineral corundum (aluminium oxide). Ruby is one of the most popular traditional jewelry gems and is very durable. Other varieties of gem-quality corundum are called sapp ...
library for writing
HTML
The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScri ...
code in pure Ruby. It is an alternative to
templating languages such as
ERb and
HAML
Haml (HTML Abstraction Markup Language) is a templating system that is designed to avoid writing inline code in a web document and make the HTML cleaner. Haml gives the flexibility to have some dynamic content in HTML. Similar to other template s ...
which combine Ruby code with some form of markup. It was developed by the computer programmer "
why the lucky stiff" and its name comes from ''Markup as Ruby''.
Usage
require 'markaby'
mab = Markaby::Builder.new
mab.html do
head
body do
h1 "Boats.com has great deals"
ul do
li "$49 for a canoe"
li "$39 for a raft"
li "$29 for a huge boot that floats and can fit 5 people"
end
end
end
puts mab.to_s
Executing the above code will render the following HTML:
Boats.com
Boats.com has great deals
-
$49 for a canoe
-
$39 for a raft
-
$29 for a huge boot that floats and can fit 5 people
Distribution
Gem
gem install markaby
Rails
Rail or rails may refer to:
Rail transport
*Rail transport and related matters
* Rail (rail transport) or railway lines, the running surface of a railway
Arts and media Film
* ''Rails'' (film), a 1929 Italian film by Mario Camerini
* ''Rail'' ...
plugin
script/plugin install git://github.com/markaby/markaby.git
Camping
Markaby is the templating engine used for the
Camping micro web framework.
module HomePage::Views
# If you have a `layout' method like this, it
# will wrap the HTML in the other methods. The
# `self << yield' is where the HTML is inserted.
def layout
html do
title
body
end
end
# The `index' view. Inside your views, you express
# the HTML in Ruby. See http://code.whytheluckystiff.net/markaby/.
def index
p 'Hi my name is Charles.'
p 'Here are some links:'
ul do
li
li
end
end
# The `sample' view.
def sample
p 'A sample page'
end
end
See also
*
eRuby
Embedded Ruby (also shortened as ERB) is a templating system that embeds Ruby into a text document. It is often used to embed Ruby code in an HTML document, similar to ASP and JSP, and PHP and other server-side scripting languages. The templ ...
*
Haml
Haml (HTML Abstraction Markup Language) is a templating system that is designed to avoid writing inline code in a web document and make the HTML cleaner. Haml gives the flexibility to have some dynamic content in HTML. Similar to other template s ...
*
Camping (microframework)
External links
Project homepageScreencast exampleInstall Git on CentOS 8
Ruby (programming language)
{{Compu-library-stub