From efa7717b7ab71f026df4e464046519e973c31f9a Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Fri, 31 Aug 2012 17:49:17 -0400 Subject: 4.0 release note now renders correctly with index --- guides/rails_guides/markdown/renderer.rb | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'guides/rails_guides/markdown') diff --git a/guides/rails_guides/markdown/renderer.rb b/guides/rails_guides/markdown/renderer.rb index ea3b7fc044..ec0688f937 100644 --- a/guides/rails_guides/markdown/renderer.rb +++ b/guides/rails_guides/markdown/renderer.rb @@ -5,11 +5,23 @@ module RailsGuides super end + def block_code(code, language) + <<-HTML + +
+
+#{ERB::Util.h(code).strip}
+
+
+
+HTML + end + def header(text, header_level) # Always increase the heading level by, so we can use h1, h2 heading in the document header_level += 1 - %(#{text}) + %(#{text}) end def preprocess(full_document) @@ -18,6 +30,19 @@ module RailsGuides private + def brush_for(code_type) + case code_type + when 'ruby', 'sql', 'plain' + code_type + when 'erb' + 'ruby; html-script: true' + when 'html' + 'xml' # html is understood, but there are .xml rules in the CSS + else + 'plain' + end + end + def convert_notes(body) # The following regexp detects special labels followed by a # paragraph, perhaps at the end of the document. @@ -39,10 +64,6 @@ module RailsGuides %Q(

#{$2.strip}

\n) end end - - def dom_id(text) - text.downcase.gsub(/[^a-z0-9]+/, '-').strip - end end end end -- cgit v1.2.3