嵌入式 ruby​​“erb”标签[重复]

2024-02-17

我一直在学习 Ruby 和 Ruby on Rails 的速成课程,但我无法弄清楚: 在嵌入的 ruby​​ html 文件中,有几个标签。 用于执行 用于输出,但是这些标签有什么作用:,末尾的“-”符号是什么呢?

Thanks.


这个链接 http://wayback.archive.org/web/20100215150502/http://cheat.errtheblog.com/s/erb/包含对 erb 标记的很好的概述。

从网站:

识别标签

ERB 可识别所提供模板中的某些标签并进行转换
它们基于以下规则:

<% Ruby code -- inline with output %>

<%= Ruby expression -- replace with result %>

<%# comment -- ignored -- useful in testing %>

% a line of Ruby code -- treated as <% line %> (optional -- see ERB.new)

%% replaced with % if first thing on a line and % processing is used

<%% or %%> -- replace with <% or %> respectively

所有其他文本均不变地通过 ERB 过滤。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

嵌入式 ruby​​“erb”标签[重复] 的相关文章

随机推荐