0
t = "Some "
t += content_tag :span, "random ", class: "bold_style"
t += "words."
return t
문자열을 연결하고 단어 중 하나를 굵게 표시해야하므로 해당 단어를 스팬 태그 및 클래스로 묶고 싶습니다.문자열의 내용 태그
레일스에 텍스트가 아닌 스팬 태그라고 어떻게 말할 수 있습니까?
t = "Some "
t += content_tag :span, "random ", class: "bold_style"
t += "words."
return t
문자열을 연결하고 단어 중 하나를 굵게 표시해야하므로 해당 단어를 스팬 태그 및 클래스로 묶고 싶습니다.문자열의 내용 태그
레일스에 텍스트가 아닌 스팬 태그라고 어떻게 말할 수 있습니까?
때 사용 html_safe
예를 내부 HTML이 출력 할 문자열 :
s = "string 1"
s.html_safe # outputs string 1
s2 = "<p> string 2 </p>"
s2.html_safe # will generate p tag with string 2 text inside
그럴 수
return t.html_safe
을