Hi, Saji N. Hameed wrote: > * Suraj Kurapati <snk / gna.org> [2008-11-17 13:42:39 +0900]: > >> "more content here" >> end >> %> > > hmmm...i have to use double quotes to delimit the text - not very > convenient. Well, you could also use Ruby's %Q{} or %q{} or <<EOS syntax for writing multi-line strings. But I agree, it is ugly. > According to eruby entry in Wikipedia http://en.wikipedia.org/wiki/ERuby > the following are equivalent, however the output from erbook is > different for each. Excellent find! I completely forgot about that eRuby capability. It is definitely more readable with a single % at the beginning of a line. :-) > <% chapter "Introduction" do %> > This is a chapter > <% end %> > > % chapter "Introduction" do > This is a chapter > % end They were treated differently because the latter was not enabled in erbook's usage of eRuby. If you apply the following patch, then the latter will work: diff --git a/bin/erbook b/bin/erbook index c5bf5bd..568c7d8 100755 --- a/bin/erbook +++ b/bin/erbook @@ -47,6 +47,9 @@ class Template < ERB # silence the code-only <% ... %> directive, just like PHP does args[0].gsub!( /^[ \t]*(<%[^%=]((?!<%).)*?[^%]%>)[ \t]*\r?\n/m ) { $1 } + # enable Ruby code processing for lines beginning with % + (args[2] ||= '') << '%' + # use @buffer to store the result of the ERB template args[3] = :@buffer super(*args) I'm currently refactoring the code to be more object-oriented, and I will include the above patch in the next release. Thanks for your help! -- Posted via http://www.ruby-forum.com/.