a simple Ruby library for generating XML, HTML and CSS.
A very tiny Markaby-like XML,HTML and CSS builder
A very tiny Markaby-like XML,HTML and CSS builder
Similar Projects: Ipsum, Fixed Width Structures, Adsense Info
gem install Remarkably
require 'remarkably/engines/xml' include Remarkably::Common result = xml do 5.times do |item_no| item :id => item_no do text "This is Item number #{item_no}" end end end puts result.to_s # => <xml><item id="0">This is Item number 0</item><item id="1">This is Item number 1</item><item id="2">This is Item number 2</item><item id="3">This is Item number 3</item><item id="4">This is Item number 4</item></xml>
require 'remarkably/engines/html' include Remarkably::Common result = html do head do title "Greeting the planet" end body do div :id => :main do P "Hello World!" end end end puts result.to_s # => <html><head><title>Greeting the planet</title></head><body><div id="main"><p>Hello World!</p></div></body></html>
require 'remarkably/engines/css' require 'remarkably/engines/css/helpers' include Remarkably::Common result = body do P do background_color :white border 1.px, :solid, :black end div do color 'blue' end table do tr do width 300.px line_height 24.pt end end report! do number? do text_align :right end div do background_color :red color :white end end end.to_s puts result # => body p {background-color:white;border:1px solid black} # body div {color:blue} # body table tr {width:300px;line-height:24pt} # body #report .number {text-align:right} # body #report div {background-color:red;color:white}
require 'remarkably/engines/html' require 'remarkably/engines/css/helpers' include Remarkably::Common result = html do head do style do P do background_color :white border 1.px, :solid, :black end div do color 'blue' end table do tr do width 300.px line_height 24.pt end end report! do number? do text_align :right end div do background_color :red color :white P { color :blue; font_weight :bold } end end end end body do div :id => :report do P "Hello!" end end end.to_s puts result # => <html><head><style> # p {background-color:white;border:1px solid black} # div {color:blue} # table tr {width:300px;line-height:24pt} # #report .number {text-align:right} # #report div {background-color:red;color:white} # #report div p {color:blue;font-weight:bold} # </style></head><body><div id="report"><p>Hello!</p></div></body></html>
git clone https://bitbucket.org/clivecrous/remarkably
cd remarkably
git clone git://github.com/clivecrous/remarkably
cd remarkably
View all Libraries