From 03bb1ebec513de779908af110c46e16b9c882673 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Wed, 4 Feb 2009 01:44:58 +0000 Subject: Convert the guides from asciidoc to textile and integrate with the new design. If you're a guide writer and want to generate the guides, Run : ruby railties/guides/rails_guides.rb And guides HTML will get generated inside railties/guides/output directory. --- railties/guides/rails_guides/textile_extensions.rb | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 railties/guides/rails_guides/textile_extensions.rb (limited to 'railties/guides/rails_guides/textile_extensions.rb') diff --git a/railties/guides/rails_guides/textile_extensions.rb b/railties/guides/rails_guides/textile_extensions.rb new file mode 100644 index 0000000000..a7fc5ba49c --- /dev/null +++ b/railties/guides/rails_guides/textile_extensions.rb @@ -0,0 +1,38 @@ +module RailsGuides + module TextileExtensions + def notestuff(body) + body.gsub!(/^(IMPORTANT|CAUTION|WARNING|NOTE|INFO)(?:\.|\:)(.*)$/) do |m| + css_class = $1.downcase + css_class = 'warning' if ['caution', 'important'].include?(css_class) + + result = "

" + result << $2.strip + result << '

' + result + end + end + + def tip(body) + body.gsub!(/^(TIP)\:(.*)$/) do |m| + result = "

" + result << $2.strip + result << '

' + result + end + end + + def plusplus(body) + body.gsub!(/\+(.*?)\+/) do |m| + "#{$1}" + end + end + + def code(body) + body.gsub!(/\<(yaml|shell|ruby|erb|html|sql)\>(.*?)\<\/\1\>/m) do |m| + es = ERB::Util.h($2) + css_class = ['erb', 'shell'].include?($1) ? 'html' : $1 + "#{es}\n" + end + end + end +end -- cgit v1.2.3