我有一个类似于我在stackoverflow上发现的问题,但不完全相同.我想避免解决以下问题:
基本上,想要以下HTML输出:
<div class='myclass' extraattr='UNESCAPED <>& CONTENT'>
Content...
</div>
Run Code Online (Sandbox Code Playgroud)
我使用的HAML看起来像这样:
.myclass{ "extraattr" => "UNESCAPED <>& CONTENT" }
Content...
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚如何让内容以我想要的方式输出.尝试将.html_safe应用到字符串的末尾,但收到以下错误:
未定义的方法`html_safe'代表"UNESCAPED <>&CONTENT":字符串
后来意识到,对于这个特定的应用程序,我不使用Rails,只是ruby + HAML.(我继承了这个项目,我只是开始学习HAML,ruby和Rails)
而且,对于那些懒得单击链接并且没有阅读我提到的解决方案的人,我宁愿不将HAML配置为不为整个文件转义attrs,只是为了这个属性.
谢谢!
UPDATE
我刚刚找到了:普通过滤器,并且能够得到我想要的东西.但是,如果有一个我不知道的技巧,所以我不必编写所有的HTML,我会很感激.我的"修复":
:plain
<div class='myclass' extraattr='UNESCAPED <>& CONTENT'>
Content...
</div>
Run Code Online (Sandbox Code Playgroud) I've read around on StackOverflow, and found similar situations to mine, but none close enough for me to figure out what I should try to do next. I'm trying to pull fresh copies of libraries required to build a project I'm working on (git clone).
我发出以下命令(启用GIT_CURL_VERBOSE以获取更多信息)并获取以下数据:
[thexfactor@THISISMYSERVER ~]$ GIT_CURL_VERBOSE=1 git clone http://github.com/symfony/symfony.git
Cloning into 'symfony'...
* Couldn't find host github.com in the .netrc file, using defaults
* About to connect() to github.com port 80
* Trying 192.30.252.129... * connected
* …
Run Code Online (Sandbox Code Playgroud)