Skip to content

Commit

Permalink
Rakefile: siteify_file should allow overrides from task [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
parkr committed Mar 10, 2016
1 parent 0f8a3b2 commit 3acf4be
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .github/CONTRIBUTING.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 87,20 @@ 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]
rescue
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
Expand Down
2 changes: 1 addition & 1 deletion rake/site.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions site/_docs/conduct.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions site/_docs/contributing.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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

Expand Down

0 comments on commit 3acf4be

Please sign in to comment.