diff options
Diffstat (limited to 'guides/rails_guides/generator.rb')
-rw-r--r-- | guides/rails_guides/generator.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/guides/rails_guides/generator.rb b/guides/rails_guides/generator.rb index c83538ad48..3d8f54ab34 100644 --- a/guides/rails_guides/generator.rb +++ b/guides/rails_guides/generator.rb @@ -17,13 +17,14 @@ module RailsGuides class Generator GUIDES_RE = /\.(?:erb|md)\z/ - def initialize(edge:, version:, all:, only:, kindle:, language:) + def initialize(edge:, version:, all:, only:, kindle:, language:, rtl: false) @edge = edge @version = version @all = all @only = only @kindle = kindle @language = language + @rtl = rtl if @kindle check_for_kindlegen @@ -116,6 +117,11 @@ module RailsGuides def copy_assets FileUtils.cp_r(Dir.glob("#{@guides_dir}/assets/*"), @output_dir) + + if @rtl + FileUtils.rm(Dir.glob("#{@output_dir}/stylesheets/main.css")) + FileUtils.mv("#{@output_dir}/stylesheets/main.rtl.css", "#{@output_dir}/stylesheets/main.css") + end end def output_file_for(guide) @@ -198,7 +204,7 @@ module RailsGuides 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 - unless anchors.member?(fragment_identifier) + unless anchors.member?(CGI.unescape(fragment_identifier)) guess = anchors.min { |a, b| Levenshtein.distance(fragment_identifier, a) <=> Levenshtein.distance(fragment_identifier, b) } |