Created
February 10, 2011 22:01
-
-
Save femto113/821445 to your computer and use it in GitHub Desktop.
Server-side view source for Rails via after_filter with SyntaxHighlighter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyController < ApplicationController | |
after_filter { response.body = %Q{<html><body><pre>#{CGI.escapeHTML(response.body)}</pre></body></html>} } | |
#... | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyController < ApplicationController | |
after_filter { response.body = %Q{ | |
<html> | |
<head> | |
<title>source for #{request.url}</title> | |
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js"></script> | |
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js"></script> | |
<link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" rel="stylesheet" type="text/css" /> | |
<link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css" rel="stylesheet" type="text/css" /> | |
</head> | |
<body> | |
<pre class="brush: xml">#{CGI.escapeHTML(response.body)}</pre> | |
<script type="text/javascript">SyntaxHighlighter.all()</script> | |
</body> | |
</html> | |
} if request.url =~ /VS$/ } | |
#... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment