G
Gavin Kistner
I have a situation where I need to create/write static web pages using
some non-trivial logic.
(This is separate from a web server.)
The PageTemplate project[1] looked cool, but the simple syntax doesn't
account for the kinds of tests I need to do.
(In short it's:
HTML chunk
foo.each{ |bar|
HTML chunk
}
HTML chunk
foo.each{ |bar|
const.each{ |jim|
conditional output based on bar.bork?(jim)
}
a bunch of conditional output based on return values
of methods on bar, including special processing of that content
}
Right now it's working, but it's a series of nasty:
file << %Q{ ... }
and
file << <<-ENDHTMLCHUNK
type constructs. It's horrific to look at, and certainly not easy to
figure out what's going on for the ancillary ruby-ignorant developers
who may want to tweak the HTML.
eRuby seemed like the ideal solution...but the solution needs to run on
Windows, and I can't seem to find a windows binary for eRuby.
1) Is there an eRuby binary for Windows? (The modruby website says no,
but perhaps it's outdated.) [This also needs to run 'natively' on
Windows...a cygwin type solution is no good, even if eRuby works
there.]
2) Is there a simple ruby-based eRuby-type template system, that lets
me intersperse arbitrary ruby code inside and around the HTML chunks I
want to output?
[1] http://coolnamehere.com/products/pagetemplate/
some non-trivial logic.
(This is separate from a web server.)
The PageTemplate project[1] looked cool, but the simple syntax doesn't
account for the kinds of tests I need to do.
(In short it's:
HTML chunk
foo.each{ |bar|
HTML chunk
}
HTML chunk
foo.each{ |bar|
const.each{ |jim|
conditional output based on bar.bork?(jim)
}
a bunch of conditional output based on return values
of methods on bar, including special processing of that content
}
Right now it's working, but it's a series of nasty:
file << %Q{ ... }
and
file << <<-ENDHTMLCHUNK
type constructs. It's horrific to look at, and certainly not easy to
figure out what's going on for the ancillary ruby-ignorant developers
who may want to tweak the HTML.
eRuby seemed like the ideal solution...but the solution needs to run on
Windows, and I can't seem to find a windows binary for eRuby.
1) Is there an eRuby binary for Windows? (The modruby website says no,
but perhaps it's outdated.) [This also needs to run 'natively' on
Windows...a cygwin type solution is no good, even if eRuby works
there.]
2) Is there a simple ruby-based eRuby-type template system, that lets
me intersperse arbitrary ruby code inside and around the HTML chunks I
want to output?
[1] http://coolnamehere.com/products/pagetemplate/