diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-08-14 02:13:00 -0300 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-08-14 13:17:32 +0200 |
commit | b95d6e84b00bd926b1118f6a820eca7a870b8c35 (patch) | |
tree | 0753080f3b0dabbe0b2f62abe044c24d6b4ed5c4 /railties/guides/rails_guides | |
parent | 36a84a4f15f29b41c7cac2f8de410055006a8a8d (diff) | |
download | rails-b95d6e84b00bd926b1118f6a820eca7a870b8c35.tar.gz rails-b95d6e84b00bd926b1118f6a820eca7a870b8c35.tar.bz2 rails-b95d6e84b00bd926b1118f6a820eca7a870b8c35.zip |
Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;)
Diffstat (limited to 'railties/guides/rails_guides')
-rw-r--r-- | railties/guides/rails_guides/generator.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/railties/guides/rails_guides/generator.rb b/railties/guides/rails_guides/generator.rb index bb7cdb6756..5a5ce54503 100644 --- a/railties/guides/rails_guides/generator.rb +++ b/railties/guides/rails_guides/generator.rb @@ -32,7 +32,7 @@ # # Separate many using commas: # -# # generates only +# # generates only # ONLY=assoc,migrations ruby rails_guides.rb # # Note that if you are working on a guide generation will by default process @@ -77,7 +77,7 @@ module RailsGuides def initialize_dirs(output) @guides_dir = File.join(File.dirname(__FILE__), '..') @source_dir = File.join(@guides_dir, "source") - @output_dir = output || File.join(@guides_dir, "output") + @output_dir = output || File.join(@guides_dir, "output") end def create_output_dir_if_needed @@ -116,7 +116,7 @@ module RailsGuides def output_file_for(guide) guide.sub(GUIDES_RE, '.html') end - + def generate?(source_file, output_file) fin = File.join(source_dir, source_file) fout = File.join(output_dir, output_file) @@ -213,9 +213,9 @@ module RailsGuides code_blocks << %{<div class="code_container"><code class="#{css_class}">#{es}</code></div>} "\ndirty_workaround_for_notextile_#{code_blocks.size - 1}\n" end - + body = yield body - + body.gsub(%r{<p>dirty_workaround_for_notextile_(\d+)</p>}) do |_| code_blocks[$1.to_i] end @@ -225,7 +225,7 @@ module RailsGuides anchors = extract_anchors(html) check_fragment_identifiers(html, anchors) end - + def extract_anchors(html) # Textile generates headers with IDs computed from titles. anchors = Set.new @@ -241,7 +241,7 @@ module RailsGuides anchors += Set.new(html.scan(/<p\s+class="footnote"\s+id="([^"]+)/).flatten) return anchors end - + def check_fragment_identifiers(html, anchors) html.scan(/<a\s+href="#([^"]+)/).flatten.each do |fragment_identifier| next if fragment_identifier == 'mainCol' # in layout, jumps to some DIV |