// here's what I'm doing atm
<r:erb_tag name="langLink" >
<r:erb><%# url = <%= <r:expand tag="url" /> %><%= if (/\/en/.match(url))
url.sub(/\/([^\/]+)/,"/ja")
else
url.sub(/\/([^\/]+)/,"/en")
end %></r:erb></r:erb_tag>
<ul class="lang-links">
<li><r:if_url matches="^\/ja"><em>日本語</em></r:if_url><r:unless_url matches="^\/ja"><a href="<r:langLink></r:langLink>" title="<r:title /> in Japanese">日本語</a></r:unless_url></li>
<li><r:if_url matches="^\/en"><em>English</em></r:if_url><r:unless_url matches="^\/en"><a href="<r:langLink></r:langLink>" title="<r:title /> の英文ページ" class="last">Engish</a></r:unless_url></li>
</ul>
// but this gives me urls like this (note line break from if/else)
<li><a href="
/ja/" title="This page in Japanese">日本語</a></li>
// so let's hack BackDoor's erg tag
tag "erb" do |tag|
ERB.new( tag.expand).result( binding)
end
// here's the documentation from erb.new
If trim_mode is passed a String containing one or more of the following modifiers, ERB will adjust its code generation as listed:
% enables Ruby code processing for lines beginning with %
<> omit newline for lines starting with <% and ending in %>
> omit newline for lines ending in %>
// here's your new erb tag
tag "er" do |tag|
ERB.new(tag.expand, nil, true).result(binding)
end
// but I'm not sure how to call it
<r:er trim_mode=">"> <!-- looks wack and doesn't work -->