Camping without markaby.

2013-12-22 Thread carmen
i've been using this

def H _
  # Ruby object-literal syntax as HTML constructors
  case _
  when Hash then
'<'+(_[:_]||:div).to_s+(_.keys-[:_,:c]).map{|a|
  ' '+a.to_s+'='+"'"+
  _[a].to_s.hsub({"'"=>'%27',
   '>'=>'%3E',
   '<'=>'%3C'})+"'"}.join+'>'+
  (_[:c] ? (H _[:c]) : '')+
  (_[:_] == :link ? '' : (''))
  when Array then
_.map{|n|H n}.join
  else
_.to_s if _
  end
end

class String
  def hsub h; map{|e|h[e]||e} end
end

irb(main):001:0> H ['',
   {_: :html,
 c: [{_: :head,
   c: ['',
   {_: :link, href:'/css/misc/favicon.ico', rel: :icon}]},
 {_: :body, c: {_: :h1, c: 'hello woyld'}}]}]

=> "hello 
woyld"

linebreaks can be nice for view-source (also, long lines tend to slow down 
text-editors to a crawl, at least emacs on mid 00s thinkpads)

class Array
  def intersperse i
inject([]){|a,b|a << b << i}[0..-2]
  end
  def cr; intersperse "\n" end
end

irb(main):017:0> puts H %w{dog piglets duck geese galago}.map{|a|{_: :li, c: 
a}}.cr
dog
piglets
duck
geese
galago
=> nil
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Camping without markaby.

2013-12-22 Thread Magnus Holm
This should work:

Camping.goes :Xmas

module Xmas::Controllers
  class Index
def get
  render :index
end
  end
end

__END__

@@ index.erb
Hello <%= 'world' %>

// Magnus Holm


On Sun, Dec 22, 2013 at 10:26 PM, Tim Uckun  wrote:
> How can I use something other than markaby for my views? My understanding is
> that markaby is very slow.
>
> Thanks.
>
> ___
> Camping-list mailing list
> Camping-list@rubyforge.org
> http://rubyforge.org/mailman/listinfo/camping-list
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Camping without markaby.

2013-12-22 Thread Tim Uckun
How can I use something other than markaby for my views? My understanding
is that markaby is very slow.

Thanks.
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list