/usr/lib/ruby/1.8/ramaze/helper/erector.rb is in libramaze-ruby1.8 2010.06.18-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | # Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.
require 'erector'
module Ramaze
# Allows you to use some shortcuts for Erector in your Controller.
# use this inside your controller to directly build Erector
# Refer to the Erector-documentation and testsuite for more examples.
# Usage:
# erector { h1 "Apples & Oranges" } #=> "<h1>Apples & Oranges</h1>"
# erector { h1(:class => 'fruits&floots'){ text 'Apples' } } #=> "<h1 class=\"fruits&floots\">Apples</h1>"
module Helper
module Erector
include ::Erector::Mixin
class ::Erector::Widget
alias :raw! :rawtext
alias :old_css :css
def strict_xhtml(*args, &block)
raw! '<?xml version="1.0" encoding="UTF-8"?>'
raw! '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">'
html(:xmlns => "http://www.w3.org/1999/xhtml", :"xml:lang" => "en", :lang => "en", &block)
end
def js(src)
script :src => src
end
def ie_if(expr, &block)
raw! "<!--[if #{expr}]>"
yield
raw! "<![endif]-->"
end
# Diagnostics
def inspect(elem)
text elem.inspect
end
def css(href, args = {})
attrs = {
:rel => "stylesheet",
:href => href,
:type => "text/css"
}.merge(args)
link attrs
end
end
end
end
end
|