'.html_safe'를 포함하면 스타일 지정 (lass = 'lead'style = 'font-size : 14px;')이 사용되지 않습니다. .html_safe를 제거하면 스타일이 적용되지만 이제 모든 HTML이 표시됩니다.레일즈 앱에서 html_safe로 스타일을 수정하는 방법은 무엇입니까?
해결 방법에 대한 조언이 있으십니까? HTML없이 @의 chapter.chaptext의
<p class = 'lead' style = 'font-size: 14px;'>
<div id = 'textcontainer'>
<%= @chapter.chaptext.html_safe %>
</div> <!-- end of textcontainer div -->
</p>
콘텐츠 : @chapter.chaptext
이 textcontainer
내부 문자열로 표현되고 있기 때문에
<p> Sanjaya said: <a href = '#' class = 'getannotation'><a href = '#' class = 'getannotation'><a href = '#' class = 'getannotation'><a href = '#' class = 'getannotation'><a href = '#' class = 'getannotation'><a href = '#' class = 'getannotation'><a href = '#' class = 'getannotation'><a href = '#' class = 'getannotation'><a href = '#' class = 'getannotation'>Lord Krishna</a></a></a></a></a></a></a></a></a> spoke these wor<a href = '#' class = 'getannotation'>ds to Arjuna</a> whose eyes were
<a href = '#' class = 'getannotation'><a href = '#' class = 'getannotation'>tearful and downcast</a></a>, and who was ov<a href = '#' class = 'getannotation'>erwh</a>elmed <a href = '#' class = 'getannotation'><a href = '#' class = 'getannotation'>with compassion and despair</a></a>.
(2.01) <p>
<p> The Supreme Lord said: How has the dejection come to you at this
juncture? This is n<a href = '#' class = 'getannotation'>ot fit for an Arya</a>n (or the people of noble mind and
deeds). It is disgraceful, and it does not lead one to heaven, O Arjuna.
(2.02)<br>
<p> Do not become a coward, O Arjuna, because it does not befit you. Shake
off this weakness of your heart and get up (for the battle), O Arjuna.
(2.03) <p>
'<% = @ chapter.chaptext.html_safe %> '의 HTML 출력을 표시 할 수 있습니까? – cortex
@cortex 방금 html 출력을 포함 시켰습니다. – sharataka