From 5f5496c7f3a9351d3e6caef727654fa2b4bdb311 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sun, 24 Oct 2010 00:35:47 +0200 Subject: switches guides code syntax highlighting to the better SyntaxHighlighter, I did my best with the theme, I swear --- railties/guides/rails_guides/generator.rb | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'railties/guides/rails_guides/generator.rb') diff --git a/railties/guides/rails_guides/generator.rb b/railties/guides/rails_guides/generator.rb index eaa9d79ce8..22d402ad21 100644 --- a/railties/guides/rails_guides/generator.rb +++ b/railties/guides/rails_guides/generator.rb @@ -207,10 +207,28 @@ module RailsGuides # with code blocks by hand. def with_workaround_for_notextile(body) code_blocks = [] + body.gsub!(%r{<(yaml|shell|ruby|erb|html|sql|plain)>(.*?)}m) do |m| - es = ERB::Util.h($2) - css_class = ['erb', 'shell'].include?($1) ? 'html' : $1 - code_blocks << %{
#{es}
} + brush = case $1 + when 'ruby', 'sql', 'plain' + $1 + when 'erb' + 'ruby; html-script: true' + when 'html' + 'xml' # html is understood, but there are .xml rules in the CSS + else + 'plain' + end + + code_blocks.push(< +
+
+#{ERB::Util.h($2).chomp}
+
+
+ +HTML "\ndirty_workaround_for_notextile_#{code_blocks.size - 1}\n" end -- cgit v1.2.3