0
我試圖使用語法突出顯示讓我的嵌入代碼看起來很棒。我可以在html文件上做到這一點,但是當我在我的rails博客上嘗試時,它不起作用。讓語法突出顯示器與我的rails博客一起工作
我的直覺告訴我,這是值得做我的控制器:
<pre class="brush: ruby;">
puts "Do you use Facebook? (Y/N)"
</pre>
<p>
<b>Entry:</b>
</p>
<%=sanitize @thought.entry %>
但HTML的頂部位仍在運行就好...
<!DOCTYPE html>
<html>
<head>
<title>Blog</title>
<script src="/assets/shCore.js?body=1" type="text/javascript"></script>
<script src="/assets/shBrushRuby.js?body=1" type="text/javascript"></script>
<link href="/assets/shCoreDefault.css?body=1" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript">SyntaxHighlighter.all();</script>
<meta content="authenticity_token" name="csrf-param" />
<meta content="1OAMJ6dGJ8c7CHunEe9IBkNrcIJwrfYdwtskSFRGvUQ=" name="csrf-token" />
</head>
<body>
<p id="notice"></p>
<p>
<b>Title:</b>
Facehook
</p>
<p>
<b>Entry:</b>
</p>
<pre class="brush: ruby;">
puts "Do you use Facebook? (Y/N)"
facehooked = gets
if facehooked == "Y" #upper- or lower-case?
puts "How many friends do you have?"
friends = gets
if friends > 30
puts "I asked how many friends you have. Not how many friends you have on Facebook. You are Facehooked."
elsif friends == 0
puts "I am sorry to hear that."
else
#How sociable are you in the real world?
#TODO - data-type checking
puts "Please answer the following questions with a number:\nHow many people would you like to see on a weekly basis?"
buddies = gets
puts "How many people do you happen to see on a weekly basis?"
acquaintances = gets
puts "How many people that you do not like do you have to see on a daily basis?"
forced = gets
puts "How many people would you love to see on a daily basis?"
true_friends = gets
people = buddies + acquaintances + forced + true_friends
#ratios
true_friends_to_buddies = true_friends/buddies
buddies_to_acquaintances = buddes/acquaintances
true_friends_to_acquaintances = true_friends/aquaintances
puts "How many 'friends' do you have on Facebook?"
facehooks = gets
if people == 0
puts "You are ninja. You drift among this world without a connection. Please do not kill me."
elsif people >= 500
puts "You are one social motherfucker!"
else
end
end
elsif facehooked == "N"
puts "You do not have a hook in your face. Congratulations."
else
puts "That question required a yes or no answer."
end
puts "You should follow @ricburton on Twitter - he likes talking to new people, making acquaintances and building friendships."
</pre>
<a href="/thoughts/1/edit">Edit</a> |
<a href="/thoughts">Back</a>
</body>
</html>
任何幫助將非常感謝!
看起來像JavaScript是在內容被風格加載之前發射 - 嘗試在頁面底部粘貼js(這通常是一個很好的做法) – 2011-12-22 00:25:24