Sha256: 04691fc7cc832b41f6ab71c0f0aa77d9ba4e60b4dea7656e829113ce6fb5d527

Contents?: true

Size: 752 Bytes

Versions: 6

Compression:

Stored size: 752 Bytes

Contents

require 'jazzy/jazzy_markdown'

module Jazzy
  module ReadmeGenerator
    def self.generate(source_module)
      readme = readme_path

      unless readme && File.exist?(readme) && readme = File.read(readme)
        readme = generated_readme(source_module)
      end

      rendered_readme = Jazzy.markdown.render(readme)
      "<div class='readme'>#{rendered_readme}</div>"
    end

    def self.readme_path
      %w(README.md README.markdown README.mdown README).each do |potential_name|
        if File.exist? potential_name
          return potential_name
        end
      end
      nil
    end

    def self.generated_readme(source_module)
      %(
# #{ source_module.name }

### Authors

#{ source_module.author_name }
      )
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jazzy-0.0.20 lib/jazzy/readme_generator.rb
jazzy-0.0.19 lib/jazzy/readme_generator.rb
jazzy-0.0.18 lib/jazzy/readme_generator.rb
jazzy-0.0.17 lib/jazzy/readme_generator.rb
jazzy-0.0.16 lib/jazzy/readme_generator.rb
jazzy-0.0.15 lib/jazzy/readme_generator.rb