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 sa ...
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 language
A template processor (also known as a template engine or template parser) is software designed to combine templates with a data model to produce result documents.
The language that the templates are written in is known as a template language ...
s such as
ERb
Erb, ERB or ErB may refer to:
People
* Edgar Rice Burroughs (1875–1950), American author
* Erb of Gwent (–), king of Gwent and Glywysing
Surname
* Abraham Erb (1772–1830), American-born Canadian settler
* Albrecht Erb (1628–1714), Aus ...
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
Jonathan Gillette, known by the pseudonym why the lucky stiff (often abbreviated as _why), is a writer, cartoonist, artist, and programmer notable for his work with the Ruby programming language. Annie Lowrey described him as "one of the most u ...
" 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 temp ...
*
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)
Camping is a web application microframework written in Ruby. Camping's source code is less than 4 KB in size.
It was created and updated by the programmer known as "Why the lucky stiff" until version 1.5. Around that time Why's focus shi ...
External links
Project homepageScreencast exampleInstall Git on CentOS 8
Ruby (programming language)
{{Compu-library-stub