class Jekyll::AuthorsGenerator
Public Instance Methods
generate(site)
click to toggle source
iterate through pages then pick those which are are markdown file then call Git#log on the page and add authors into its content
# File lib/jekyll-git-authors.rb, line 17 def generate(site) puts "\nGenerating authors" # Find every .md file that is in subdirectory, # then go into directory where page is located. # Git finds authors for us if we call Git#log in directory # where the file is located. site.pages.each do |page| file = page.path # If file ends with md and if it is subdir. # Jekyll does not add "./" into pages paths, # so we can use this approach. if file =~ /\.md/ and file =~ /\// Dir.chdir File.dirname(file) do |path| output = authors File.basename(file) page.content += output end end end end