Rakefile: siteify_file should allow overrides from task [ci skip]

This commit is contained in:
Parker Moore 2016-03-10 10:21:15 -06:00
parent 0f8a3b2971
commit 3acf4beb81
5 changed files with 11 additions and 9 deletions

View File

@ -4,9 +4,10 @@ Hi there! Interested in contributing to Jekyll? We'd love your help. Jekyll is a
## Where to get help or report a problem
* If you have a question about using Jekyll, start a discussion on https://talk.jekyllrb.com.
* If you have a question about using Jekyll, start a discussion on [Jekyll Talk](https://talk.jekyllrb.com).
* If you think you've found a bug within a Jekyll plugin, open an issue in that plugin's repository.
* If you think you've found a bug within Jekyll itself, [open an issue](https://github.com/jekyll/jekyll/issues/new)
* More resources are listed on our [Help page](https://jekyllrb.com/help/)
## Ways to contribute

View File

@ -87,7 +87,7 @@ def converted_history(markdown)
normalize_bullets(markdown)))))
end
def siteify_file(file, front_matter = {})
def siteify_file(file, overrides_front_matter = {})
abort "You seem to have misplaced your #{file} file. I can haz?" unless File.exists?(file)
title = begin
File.read(file).match(/\A# (.*)$/)[1]
@ -95,12 +95,12 @@ def siteify_file(file, front_matter = {})
File.basename(file, ".*").downcase.capitalize
end
slug = File.basename(file, ".markdown").downcase
front_matter = front_matter.merge({
front_matter = {
"title" => title,
"layout" => "docs",
"permalink" => "/docs/#{slug}/",
"note" => "This file is autogenerated. Edit /#{file} instead."
})
}.merge(overrides_front_matter)
contents = "#{front_matter.to_yaml}---\n\n#{content_for(file)}"
File.write("site/_docs/#{slug}.md", contents)
end

View File

@ -117,7 +117,7 @@ namespace :site do
desc "Copy the contributing file"
task :contributing do
siteify_file('.github/CONTRIBUTING.markdown')
siteify_file('.github/CONTRIBUTING.markdown', "title" => "Contributing")
end
desc "Write the site latest_version.txt file"

View File

@ -1,10 +1,10 @@
---
redirect_from: "/conduct/index.html"
editable: false
title: Code of Conduct
layout: docs
permalink: "/docs/conduct/"
note: This file is autogenerated. Edit /CONDUCT.markdown instead.
redirect_from: "/conduct/index.html"
editable: false
---
As contributors and maintainers of this project, and in the interest of

View File

@ -1,5 +1,5 @@
---
title: Contributing to Jekyll
title: Contributing
layout: docs
permalink: "/docs/contributing/"
note: This file is autogenerated. Edit /.github/CONTRIBUTING.markdown instead.
@ -9,9 +9,10 @@ Hi there! Interested in contributing to Jekyll? We'd love your help. Jekyll is a
## Where to get help or report a problem
* If you have a question about using Jekyll, start a discussion on https://talk.jekyllrb.com.
* If you have a question about using Jekyll, start a discussion on [Jekyll Talk](https://talk.jekyllrb.com).
* If you think you've found a bug within a Jekyll plugin, open an issue in that plugin's repository.
* If you think you've found a bug within Jekyll itself, [open an issue](https://github.com/jekyll/jekyll/issues/new)
* More resources are listed on our [Help page](https://jekyllrb.com/help/)
## Ways to contribute